/* ============================================================
   PORTAL DEL HERMANO · Hoja de estilos
   Colores corporativos: azul marino + dorado (= app principal)
   ============================================================ */

/* ── Fuentes (igual que app principal) ─────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@400;600;700&family=Crimson+Pro:ital,wght@0,300;0,400;0,600;1,300;1,400&display=swap');

/* ── Variables corporativas ────────────────────────────────── */
:root {
    /* Dorado */
    --gold:        #b8972b;
    --gold-light:  #d4af50;
    --gold-pale:   #f5edcc;

    /* Azul marino — color corporativo principal */
    --crimson:     #1a3560;
    --crimson-dk:  #0f2040;
    --crimson-lt:  #e8eef7;

    /* Fondos */
    --cream:       #f7f9fc;
    --cream-dk:    #eaf0f8;
    --surface:     #ffffff;
    --bg:          #f7f9fc;

    /* Tipografía */
    --ink:         #0d1b2e;
    --ink-soft:    #2c3e5a;
    --muted:       #6b7d96;
    --border:      #c5d3e8;
    --white:       #ffffff;

    /* Estados */
    --success:     #15803d;
    --success-bg:  #dcfce7;
    --error:       #b91c1c;
    --error-bg:    #fee2e2;
    --warning:     #92400e;
    --warning-bg:  #fef3c7;

    /* Tipografías */
    --font-display: 'Cinzel', serif;
    --font-body:    'Crimson Pro', Georgia, serif;

    /* Sombras y radio */
    --radius:      6px;
    --shadow:      0 2px 8px rgba(15,32,64,.08);
    --shadow-md:   0 4px 20px rgba(15,32,64,.13);
}

/* ── Reset y base ──────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; scroll-behavior: smooth; }

body {
    font-family: var(--font-body);
    font-size: 1.05rem;
    background: var(--bg);
    color: var(--ink);
    line-height: 1.5;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ── Header corporativo ────────────────────────────────────── */
.portal-header {
    background: var(--crimson-dk);
    border-bottom: 3px solid var(--gold);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-md);
}
.portal-header__inner {
    padding: 0 1.25rem;
    min-height: 68px;
    display: flex;
    align-items: center;
    gap: 1rem;
    padding-top: .6rem;
    padding-bottom: .6rem;
}
.portal-header__brand {
    display: flex;
    align-items: center;
    gap: .85rem;
    text-decoration: none;
    flex: 1;
    min-width: 0;
}
.portal-header__escudo {
    height: 58px;
    width: 58px;
    object-fit: contain;
    filter: drop-shadow(0 2px 6px rgba(0,0,0,.45));
    flex-shrink: 0;
}
.portal-header__cross {
    font-size: 2rem;
    color: var(--gold-light);
    opacity: .85;
    line-height: 1;
    flex-shrink: 0;
}
.portal-header__text {
    display: flex;
    flex-direction: column;
    gap: .1rem;
    min-width: 0;
}
.portal-header__nombre {
    font-family: var(--font-display);
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: .06em;
    color: var(--gold-light);
    /* Permite que el nombre se rompa en 2 líneas en móvil */
    line-height: 1.2;
    word-break: break-word;
    overflow-wrap: break-word;
}
.portal-header__sub {
    font-size: .7rem;
    letter-spacing: .18em;
    text-transform: uppercase;
    color: rgba(212,175,80,.65);
    white-space: nowrap;
}
.portal-header__user {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: .25rem;
    flex-shrink: 0;
}
.portal-header__hola {
    font-size: .75rem;
    color: rgba(212,175,80,.7);
    white-space: nowrap;
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
}
.portal-header__logout {
    font-size: .72rem;
    font-family: var(--font-body);
    color: rgba(255,255,255,.8);
    text-decoration: none;
    padding: .28rem .65rem;
    border: 1px solid rgba(212,175,80,.35);
    border-radius: var(--radius);
    white-space: nowrap;
    transition: background .15s;
}
.portal-header__logout:hover { background: rgba(212,175,80,.12); }

@media (min-width: 480px) {
    .portal-header__inner  { padding: .6rem 2rem; min-height: 88px; }
    .portal-header__escudo { height: 72px; width: 72px; }
    .portal-header__nombre { font-size: 1.15rem; }
    .portal-header__sub    { font-size: .72rem; }
    .portal-header__hola   { max-width: 180px; }
}

@media (min-width: 768px) {
    .portal-header__inner  { min-height: 100px; padding: .6rem 2.5rem; }
    .portal-header__escudo { height: 88px; width: 88px; }
    .portal-header__nombre { font-size: 1.3rem; }
}

/* ── Navegación inferior (mobile) ──────────────────────────── */
.portal-nav {
    position: fixed;
    bottom: 0;
    left: 0; right: 0;
    background: var(--surface);
    border-top: 2px solid var(--border);
    display: flex;
    z-index: 100;
    box-shadow: 0 -2px 8px rgba(15,32,64,.08);
}
.portal-nav__item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: .55rem .25rem;
    text-decoration: none;
    color: var(--muted);
    font-size: .65rem;
    gap: .2rem;
    transition: color .15s;
    font-family: var(--font-body);
}
.portal-nav__item.active,
.portal-nav__item:hover { color: var(--crimson); }
.portal-nav__item.active .portal-nav__icon { filter: none; }
.portal-nav__icon { font-size: 1.3rem; line-height: 1; }

/* ── Footer ────────────────────────────────────────────────── */
.site-footer {
    text-align: center;
    padding: 1rem;
    font-size: .78rem;
    letter-spacing: .05em;
    color: var(--muted);
    border-top: 1px solid var(--border);
    background: var(--cream-dk);
    margin-bottom: 56px; /* espacio para nav fija */
}
@media (min-width: 768px) {
    .site-footer { margin-bottom: 0; }
}

/* ── Contenido principal ───────────────────────────────────── */
.portal-main {
    flex: 1;
    padding: 1.25rem 1rem 5.5rem;
    max-width: 680px;
    margin: 0 auto;
    width: 100%;
}

@media (min-width: 640px) {
    .portal-main { padding: 1.75rem 1.5rem 5.5rem; max-width: 760px; }
}
@media (min-width: 768px) {
    .portal-main { padding: 2rem 2rem 5.5rem; max-width: 860px; }
}
@media (min-width: 1024px) {
    .portal-main { padding: 2rem 2.5rem 5.5rem; max-width: 980px; }
}
@media (min-width: 1280px) {
    .portal-main { max-width: 1100px; }
}

/* ── Cards ─────────────────────────────────────────────────── */
.card {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 1rem;
    overflow: hidden;
}
.card-header {
    padding: .75rem 1rem;
    font-family: var(--font-display);
    font-weight: 600;
    font-size: .72rem;
    letter-spacing: .08em;
    text-transform: uppercase;
    border-bottom: 1px solid var(--border);
    color: var(--crimson);
    background: var(--crimson-lt);
}
.card-body { padding: 1rem; }

/* ── Filas de datos ────────────────────────────────────────── */
.detail-row {
    display: flex;
    align-items: baseline;
    gap: .5rem;
    padding: .5rem 0;
    border-bottom: 1px solid var(--border);
    font-size: .95rem;
}
.detail-row:last-child { border-bottom: none; }
.detail-label {
    white-space: nowrap;
    color: var(--muted);
    font-size: .82rem;
    flex-shrink: 0;
}
.detail-value { font-weight: 500; flex: 1; }

/* ── Filas de datos con dos pares (móvil: apilados, tablet+: paralelos) ── */
.detail-row--2col {
    flex-direction: column;
    gap: 0;
    padding: 0;
}
.detail-col {
    display: flex;
    align-items: baseline;
    gap: .5rem;
    padding: .45rem 0;
}
.detail-col + .detail-col {
    border-top: 1px solid var(--border);
}
@media (min-width: 480px) {
    .detail-row--2col {
        flex-direction: row;
        padding: .5rem 0;
        gap: 0;
    }
    .detail-col {
        flex: 1;
        padding: 0 1.25rem 0 0; /* separación a la derecha = "columna vacía" */
    }
    .detail-col + .detail-col {
        border-top: none;
        border-left: 2px solid var(--border);
        padding: 0 0 0 1.25rem; /* separación a la izquierda */
    }
}

/* ── Grid de formulario: 1 col móvil, 2 col tablet+ ───────── */
.form-grid-2 {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0;
}
@media (min-width: 480px) {
    .form-grid-2 {
        grid-template-columns: 1fr 1fr;
        gap: .65rem;
    }
}

/* ── Formularios ───────────────────────────────────────────── */
.form-group { margin-bottom: .9rem; }
.form-group label {
    display: block;
    font-size: .8rem;
    font-weight: 600;
    color: var(--muted);
    margin-bottom: .3rem;
    text-transform: uppercase;
    letter-spacing: .05em;
}
.form-control {
    width: 100%;
    padding: .6rem .85rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: .95rem;
    font-family: var(--font-body);
    color: var(--ink);
    background: var(--surface);
    transition: border-color .15s;
}
.form-control:focus {
    outline: none;
    border-color: var(--crimson);
    box-shadow: 0 0 0 3px rgba(26,53,96,.12);
}
.form-hint {
    font-size: .75rem;
    color: var(--muted);
    margin-top: .25rem;
}

/* ── Botones ───────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .4rem;
    padding: .65rem 1.25rem;
    border-radius: var(--radius);
    font-size: .9rem;
    font-weight: 600;
    font-family: var(--font-body);
    cursor: pointer;
    border: none;
    text-decoration: none;
    transition: opacity .15s, transform .1s;
    white-space: nowrap;
}
.btn:active { transform: scale(.98); }
.btn-primary  { background: var(--crimson); color: #fff; }
.btn-primary:hover  { background: var(--crimson-dk); }
.btn-secondary { background: var(--border); color: var(--ink); }
.btn-secondary:hover { background: #b0bfda; }
.btn-gold { background: var(--gold); color: #fff; }
.btn-gold:hover { background: var(--gold-light); }
.btn-full { width: 100%; }
.btn-sm { padding: .4rem .8rem; font-size: .82rem; }

/* ── Alertas / Flash ───────────────────────────────────────── */
.alert {
    padding: .85rem 1rem;
    border-radius: var(--radius);
    font-size: .9rem;
    margin-bottom: 1rem;
    display: flex;
    align-items: flex-start;
    gap: .6rem;
}
.alert-error   { background: var(--error-bg);   color: var(--error);   border-left: 3px solid var(--error); }
.alert-success { background: var(--success-bg); color: var(--success); border-left: 3px solid var(--success); }
.alert-warning { background: var(--warning-bg); color: var(--warning); border-left: 3px solid #d97706; }

/* ── Badges de estado ──────────────────────────────────────── */
.badge {
    display: inline-block;
    padding: .2rem .55rem;
    border-radius: 999px;
    font-size: .72rem;
    font-weight: 600;
}
.badge-pagado   { background: var(--success-bg); color: var(--success); }
.badge-pendiente{ background: var(--warning-bg); color: var(--warning); }
.badge-devuelto { background: #e0e7ff; color: #3730a3; }
.badge-anulado  { background: #f3f4f6; color: var(--muted); }

/* ── Login / Solicitud (páginas centradas) ─────────────────── */
.auth-wrap {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 1.5rem 1rem;

    /* Fondo corporativo: azul marino oscuro con patrón de rombos (igual que login.php) */
    background-color: #08111f;
    background-image:
        radial-gradient(ellipse at 50% 0%,   rgba(26,53,96,.5) 0%, transparent 60%),
        radial-gradient(ellipse at 50% 100%, rgba(26,53,96,.3) 0%, transparent 60%),
        repeating-linear-gradient(
            45deg,
            transparent,
            transparent 28px,
            rgba(255,255,255,.025) 28px,
            rgba(255,255,255,.025) 29px
        ),
        repeating-linear-gradient(
            -45deg,
            transparent,
            transparent 28px,
            rgba(255,255,255,.025) 28px,
            rgba(255,255,255,.025) 29px
        );
}

/* Líneas decorativas arriba y abajo */
.auth-wrap::before,
.auth-wrap::after {
    content: '';
    position: fixed;
    left: 0; right: 0;
    height: 3px;
    background: linear-gradient(to right, transparent, rgba(255,255,255,.4), transparent);
}
.auth-wrap::before { top: 0; }
.auth-wrap::after  { bottom: 0; }
.auth-box {
    width: 100%;
    max-width: 420px;
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    overflow: hidden;
}
.auth-box-header {
    background: var(--crimson);
    border-bottom: 3px solid var(--gold);
    padding: 1.75rem 1.75rem 1.5rem;
    text-align: center;
}
.auth-box-header__escudo {
    height: 130px;
    object-fit: contain;
    margin-bottom: .75rem;
    filter: drop-shadow(0 3px 8px rgba(0,0,0,.4));
}
.auth-box-header__cross {
    font-size: 3rem;
    color: var(--gold-light);
    opacity: .85;
    display: block;
    margin-bottom: .5rem;
}
.auth-box-header__nombre {
    font-family: var(--font-display);
    font-size: 1.05rem;
    font-weight: 700;
    letter-spacing: .07em;
    color: var(--gold-light);
    line-height: 1.2;
}
.auth-box-header__sub {
    font-size: .75rem;
    letter-spacing: .18em;
    text-transform: uppercase;
    color: rgba(212,175,80,.65);
    margin-top: .3rem;
}
.auth-box-body {
    padding: 1.75rem;
}
.auth-box h2 {
    font-family: var(--font-display);
    font-size: .9rem;
    font-weight: 600;
    letter-spacing: .04em;
    margin-bottom: 1.25rem;
    color: var(--crimson);
    text-transform: uppercase;
}

/* ── Password toggle ───────────────────────────────────────── */
.pass-wrap { position: relative; }
.pass-wrap .form-control { padding-right: 2.75rem; }
.pass-toggle {
    position: absolute;
    right: .75rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    color: var(--muted);
    padding: .25rem;
    line-height: 1;
}
.pass-toggle:hover { color: var(--ink); }

/* ── Strength bar ──────────────────────────────────────────── */
.strength-bar {
    height: 4px;
    border-radius: 2px;
    background: var(--border);
    margin-top: .4rem;
    overflow: hidden;
}
.strength-bar__fill {
    height: 100%;
    border-radius: 2px;
    transition: width .3s, background .3s;
    width: 0%;
}

/* ── Historial de fiscalía (colapsable) ────────────────────── */
.historial-item {
    border-bottom: 1px solid var(--border);
}
.historial-item:last-child { border-bottom: none; }

/* Quitar el triángulo nativo del navegador */
.historial-item summary { list-style: none; }
.historial-item summary::-webkit-details-marker { display: none; }

.historial-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: .75rem;
    padding: .75rem 1rem;
    cursor: pointer;
    user-select: none;
    transition: background .15s;
}
.historial-head:hover { background: var(--crimson-lt); }

.historial-head__text { flex: 1; min-width: 0; }

.historial-nombre {
    display: block;
    font-size: .9rem;
    font-weight: 600;
    color: var(--ink);
    line-height: 1.3;
}
.historial-fecha {
    display: block;
    font-size: .76rem;
    color: var(--muted);
    margin-top: .1rem;
}

.historial-head__right {
    display: flex;
    align-items: center;
    gap: .5rem;
    flex-shrink: 0;
}
.historial-anio {
    white-space: nowrap;
    font-size: .75rem;
}
.historial-chevron {
    font-size: .85rem;
    color: var(--muted);
    transition: transform .2s;
    line-height: 1;
}
.historial-item[open] .historial-chevron {
    transform: rotate(180deg);
}

.historial-datos {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: .35rem .75rem;
    padding: .5rem 1rem .85rem;
    border-top: 1px solid var(--border);
}
.historial-dato {
    display: flex;
    flex-direction: column;
    font-size: .82rem;
    color: var(--ink-soft);
}
.historial-dato .dato-label {
    font-size: .7rem;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: .05em;
    margin-bottom: .05rem;
}

@media (min-width: 640px) {
    .historial-datos {
        grid-template-columns: 1fr 1fr 1fr 1fr;
    }
}

/* ── Paginación del historial ──────────────────────────────── */
.historial-paginacion {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: .75rem 1rem;
    border-top: 2px solid var(--border);
    gap: .5rem;
}
.pag-btn {
    display: inline-flex;
    align-items: center;
    padding: .4rem .9rem;
    border-radius: var(--radius);
    font-size: .85rem;
    font-family: var(--font-body);
    font-weight: 600;
    text-decoration: none;
    background: var(--crimson-lt);
    color: var(--crimson);
    border: 1px solid var(--border);
    transition: background .15s;
    white-space: nowrap;
}
.pag-btn:hover { background: var(--border); }
.pag-btn--disabled {
    opacity: .35;
    cursor: default;
    pointer-events: none;
}
.pag-info {
    font-size: .82rem;
    color: var(--muted);
    text-align: center;
}

/* ── Tabla de recibos ──────────────────────────────────────── */
.recibo-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: .7rem 0;
    border-bottom: 1px solid var(--border);
    gap: .5rem;
}
.recibo-item:last-child { border-bottom: none; }
.recibo-periodo { font-size: .9rem; font-weight: 500; }
.recibo-importe { font-weight: 700; font-size: .95rem; color: var(--crimson); }

/* ── Paso a paso (solicitud) ───────────────────────────────── */
.steps {
    display: flex;
    gap: .5rem;
    margin-bottom: 1.5rem;
    align-items: center;
    justify-content: center;
}
.step {
    width: 28px; height: 28px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: .78rem; font-weight: 700;
    border: 2px solid var(--border);
    color: var(--muted);
    background: var(--surface);
}
.step.active { border-color: var(--crimson); color: var(--crimson); background: var(--crimson-lt); }
.step.done   { border-color: var(--success); background: var(--success); color: #fff; }
.step-line   { flex: 1; height: 2px; background: var(--border); max-width: 40px; }

/* ── Botón de tema (portal) ────────────────────────────────── */
.btn-theme {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 1px solid rgba(212,175,80,.35);
    border-radius: var(--radius);
    color: rgba(212,175,80,.7);
    cursor: pointer;
    padding: .3rem .35rem;
    line-height: 1;
    transition: border-color .18s, color .18s, background .18s;
}
.btn-theme:hover {
    border-color: rgba(212,175,80,.65);
    color: var(--gold-light);
    background: rgba(212,175,80,.1);
}

/* ── Tema oscuro (portal) ──────────────────────────────────── */
[data-theme="dark"] {
    --gold:        #c9a84c;
    /* --gold-pale se mantiene claro para cabeceras de tabla */

    /* --crimson pasa a azul claro para legibilidad sobre fondo oscuro */
    --crimson:     #6a9fd8;
    --crimson-lt:  #0d1828;

    --cream:       #111825;
    --cream-dk:    #0d1520;
    --surface:     #192438;
    --bg:          #111825;

    --ink:         #dde9f8;
    --ink-soft:    #9ab0cc;
    --muted:       #7a90aa;
    --border:      #253550;
    --white:       #192438;

    --success:     #4ade80;
    --success-bg:  #0a1f12;
    --error:       #f87171;
    --error-bg:    #1f0a0a;
    --warning:     #d4a060;
    --warning-bg:  #1a1200;
}

/* Overrides de colores literales en modo oscuro (portal) */

/* Badges de recibo */
[data-theme="dark"] .badge-pagado   { background:#0d2010; color:#4ade80; }
[data-theme="dark"] .badge-pendiente{ background:#1a1400; color:#d4a060; }
[data-theme="dark"] .badge-devuelto { background:#1a1a3a; color:#9090e0; }
[data-theme="dark"] .badge-anulado  { background:#1e2030; color:var(--muted); }

/* Botones */
[data-theme="dark"] .btn-secondary       { background:#1e2d44; color:var(--ink); border:1px solid var(--border); }
[data-theme="dark"] .btn-secondary:hover { background:#253550; }

/* Formularios */
[data-theme="dark"] .form-control {
    background: #0d1520;
    color: var(--ink);
    border-color: var(--border);
}
[data-theme="dark"] .form-control:focus {
    background: #111825;
    border-color: var(--gold);
    box-shadow: 0 0 0 3px rgba(184,151,43,.18);
}

/* Paginación historial */
[data-theme="dark"] .pag-btn       { background:var(--crimson-lt); color:var(--ink-soft); }
[data-theme="dark"] .pag-btn:hover { background:#253550; }

/* Paso a paso */
[data-theme="dark"] .step { background:var(--surface); border-color:var(--border); color:var(--muted); }
