/* ==========================================================================
   colebiosanjuan / webapp
   App de socios — estilo mobile-first, responsivo hasta desktop.
   Paleta base:  azul institucional #0d3b66, celeste #1976d2, acento #ffb703.
   ========================================================================== */

*, *::before, *::after { box-sizing: border-box; }

:root {
    --bg:            #f2f5f9;
    --surface:       #ffffff;
    --surface-alt:   #f7f9fc;
    --border:        #e3e7ee;

    --text:          #1c2434;
    --text-soft:     #55627a;
    --text-mute:     #8a95ab;

    --primary:       #0d3b66;
    --primary-600:   #0a2e51;
    --primary-100:   #e6ecf3;
    --accent:        #ffb703;
    --info:          #1976d2;
    --danger:        #d0342c;
    --success:       #2e7d32;

    --radius:        14px;
    --radius-sm:     10px;
    --shadow-sm:     0 1px 2px rgba(15, 23, 42, .06),
                     0 2px 8px rgba(15, 23, 42, .04);
    --shadow-md:     0 8px 24px rgba(15, 23, 42, .10);
    --font-sans:     system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue",
                     Arial, "Noto Sans", sans-serif;
}

html, body {
    margin: 0;
    padding: 0;
    height: 100%;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-sans);
    font-size: 16px;
    line-height: 1.45;
    -webkit-font-smoothing: antialiased;
    -webkit-tap-highlight-color: transparent;
}

button { font-family: inherit; }

/* El atributo HTML `hidden` (display:none) tiene MUY baja especificidad,
   asi que cualquier `.splash { display: flex }` lo pisa. Con !important
   nos aseguramos que hidden gane siempre — critico para el splash, el
   menu de usuario y los alerts, que si no siguen tapando la pantalla. */
[hidden] { display: none !important; }

/* -------------------------------------------------------------------------
   Splash inicial (mientras el JS chequea sesion)
   ------------------------------------------------------------------------- */
.splash {
    position: fixed; inset: 0;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    gap: 20px;
    background: linear-gradient(160deg, var(--primary) 0%, var(--primary-600) 100%);
    color: #fff;
    z-index: 9999;
}
.splash__logo {
    font-weight: 800;
    font-size: 34px;
    letter-spacing: .02em;
    padding: 14px 22px;
    border: 2px solid rgba(255, 255, 255, .3);
    border-radius: 16px;
}
.splash__spinner {
    width: 28px; height: 28px;
    border: 3px solid rgba(255, 255, 255, .25);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* -------------------------------------------------------------------------
   Views
   ------------------------------------------------------------------------- */
.view { min-height: 100dvh; }

/* -------------------------------------------------------------------------
   Login
   ------------------------------------------------------------------------- */
.view--login {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px 16px;
    background:
        radial-gradient(1200px 600px at 100% -10%, rgba(255, 183, 3, .15), transparent 60%),
        radial-gradient(1000px 500px at -20% 110%, rgba(25, 118, 210, .18), transparent 60%),
        linear-gradient(160deg, var(--primary) 0%, var(--primary-600) 100%);
}

.login-card {
    width: 100%;
    max-width: 420px;
    background: var(--surface);
    border-radius: 20px;
    box-shadow: var(--shadow-md);
    padding: 28px 24px 20px;
    animation: pop-in .35s ease-out;
}
@keyframes pop-in {
    from { opacity: 0; transform: translateY(10px) scale(.98); }
    to   { opacity: 1; transform: none; }
}

.login-card__header { margin-bottom: 22px; }
.login-card__footer {
    margin-top: 18px;
    text-align: center;
    color: var(--text-mute);
    font-size: 12.5px;
}

.brand { display: flex; align-items: center; gap: 14px; }
.brand__mark {
    width: 56px; height: 56px;
    border-radius: 14px;
    background: linear-gradient(160deg, var(--primary) 0%, var(--info) 100%);
    color: #fff;
    font-weight: 800;
    display: flex; align-items: center; justify-content: center;
    letter-spacing: .02em;
    box-shadow: var(--shadow-sm);
    flex-shrink: 0;
}
.brand__mark--sm { width: 40px; height: 40px; font-size: 14px; border-radius: 10px; }
.brand__text h1 {
    margin: 0;
    font-size: 18px;
    color: var(--primary);
    letter-spacing: .01em;
}
.brand__text p {
    margin: 2px 0 0;
    font-size: 14px;
    color: var(--text-soft);
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.field { display: flex; flex-direction: column; gap: 6px; }
.field__label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-soft);
    padding-left: 2px;
}
.field input {
    width: 100%;
    padding: 12px 14px;
    font-size: 16px;
    color: var(--text);
    background: var(--surface-alt);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    outline: none;
    transition: border-color .15s, box-shadow .15s, background-color .15s;
}
.field input:focus {
    border-color: var(--info);
    background: #fff;
    box-shadow: 0 0 0 3px rgba(25, 118, 210, .18);
}

.alert {
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    line-height: 1.35;
}
.alert--error {
    background: #fde8e6;
    border: 1px solid #f5b7b3;
    color: var(--danger);
}

.btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 18px;
    font-size: 15px;
    font-weight: 600;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    cursor: pointer;
    transition: transform .05s, background-color .15s, box-shadow .15s, color .15s;
    user-select: none;
}
.btn:active { transform: translateY(1px); }
.btn--block { width: 100%; margin-top: 6px; }
.btn--primary {
    background: var(--primary);
    color: #fff;
}
.btn--primary:hover { background: var(--primary-600); }
.btn[disabled] { opacity: .7; cursor: default; }

.btn__spinner {
    display: none;
    width: 16px; height: 16px;
    border: 2px solid rgba(255, 255, 255, .35);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}
.btn.is-loading .btn__label { opacity: .0; }
.btn.is-loading .btn__spinner { display: inline-block; position: absolute; }

/* -------------------------------------------------------------------------
   Dashboard: topbar
   ------------------------------------------------------------------------- */
.topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 16px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    padding-top: max(10px, env(safe-area-inset-top));
}

.topbar__brand {
    display: flex; align-items: center; gap: 10px;
    min-width: 0;
}
.topbar__title {
    font-size: 16px;
    font-weight: 700;
    color: var(--primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.topbar__user { position: relative; }

.user-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px 6px 6px;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 999px;
    cursor: pointer;
    transition: background-color .15s, border-color .15s;
}
.user-btn:hover { background: var(--surface-alt); border-color: #cfd6e2; }
.user-btn__avatar {
    width: 30px; height: 30px;
    border-radius: 50%;
    background: linear-gradient(160deg, var(--primary), var(--info));
    color: #fff;
    font-weight: 700;
    font-size: 13px;
    display: inline-flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.user-btn__name {
    font-size: 14px;
    color: var(--text);
    max-width: 140px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.user-btn__chev { color: var(--text-mute); font-size: 12px; }

.user-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 240px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-md);
    overflow: hidden;
    animation: pop-in .15s ease-out;
}
.user-menu__header {
    padding: 12px 14px;
    background: var(--surface-alt);
    border-bottom: 1px solid var(--border);
}
.user-menu__name { font-weight: 600; color: var(--text); font-size: 14px; }
.user-menu__mail { color: var(--text-mute); font-size: 12.5px; word-break: break-all; }

.user-menu__item {
    display: block;
    width: 100%;
    text-align: left;
    padding: 12px 14px;
    background: transparent;
    border: 0;
    font-size: 14px;
    color: var(--text);
    cursor: pointer;
    transition: background-color .12s;
}
.user-menu__item:hover { background: var(--surface-alt); }
.user-menu__item--danger { color: var(--danger); font-weight: 600; }

/* Ocultamos el nombre en pantallas muy chicas para dejar solo el avatar */
@media (max-width: 420px) {
    .user-btn__name, .user-btn__chev { display: none; }
    .user-btn { padding: 4px; }
}

/* -------------------------------------------------------------------------
   Dashboard: contenido
   ------------------------------------------------------------------------- */
.dashboard {
    max-width: 1080px;
    margin: 0 auto;
    padding: 20px 16px 40px;
}

.hero {
    padding: 8px 4px 20px;
}
.hero__hello {
    margin: 0;
    font-size: 22px;
    color: var(--primary);
}
.hero__sub {
    margin: 6px 0 0;
    color: var(--text-soft);
    font-size: 15px;
}

.tiles {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}
@media (min-width: 640px) {
    .tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
}
@media (min-width: 960px) {
    .tiles { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
    .hero__hello { font-size: 26px; }
}

.tile {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 16px 14px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    text-decoration: none;
    box-shadow: var(--shadow-sm);
    transition: transform .12s, box-shadow .15s, border-color .15s;
}
.tile:hover {
    transform: translateY(-2px);
    border-color: #cfd6e2;
    box-shadow: var(--shadow-md);
}
.tile:active { transform: none; }
.tile__icon {
    font-size: 28px;
    line-height: 1;
    margin-bottom: 4px;
}
.tile__title {
    font-weight: 700;
    color: var(--primary);
    font-size: 15px;
}
.tile__sub {
    color: var(--text-soft);
    font-size: 13px;
    line-height: 1.3;
}
