/* ============================================================
   Portal de Hermanos — sistema de diseño "estampa litúrgica"
   Hermandad Nazareno Marbella · área del hermano
   Serif devocional, oro, papel crema. Reusa la marca del panel.
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:ital,wght@0,500;0,600;0,700;1,500&family=Spectral:ital,wght@0,300;0,400;0,500;0,600;1,400&display=swap');

:root {
    /* Morados nazarenos */
    --pp-950: #1f1530;
    --pp-900: #2a1e3d;
    --pp-800: #382850;
    --pp-700: #4c3763;
    --pp-100: #f3edf8;
    /* Oro / pan de oro */
    --gold-800: #6f5316;
    --gold-700: #8b6a1a;
    --gold-600: #b8923a;
    --gold:     #c9a75a;
    --gold-200: #f5e9c8;
    --gold-100: #fdf6e3;
    /* Papel / crema */
    --cream:     #faf6ef;
    --paper:     #f7f1e8;
    --cream-200: #ece4d2;
    --cream-300: #d8cdba;
    /* Tinta */
    --ink:      #2a2236;
    --ink-soft: #6b5f7a;
    /* Estados */
    --ok:   #1f6a44;  --ok-bg:   #e8f3ec;
    --warn: #a35a1a;  --warn-bg: #fbf0db;
    --err:  #8b2a2a;  --err-bg:  #f7e6e4;
    --info: #4c3763;  --info-bg: #efeaf6;

    --font-display: 'Cormorant Garamond', 'Hoefler Text', Georgia, serif;
    --font-body:    'Spectral', Georgia, 'Times New Roman', serif;

    --shadow-card: 0 1px 2px rgba(42, 30, 61, .04), 0 14px 34px -22px rgba(42, 30, 61, .45);
    --shadow-soft: 0 10px 30px -20px rgba(42, 30, 61, .55);
    --radius: 14px;
    --rule: linear-gradient(90deg, transparent, var(--gold) 18%, var(--gold-600) 50%, var(--gold) 82%, transparent);
}

/* ---------- Base ---------- */
* { box-sizing: border-box; }

body.portal {
    margin: 0;
    font-family: var(--font-body);
    font-size: 16.5px;
    line-height: 1.6;
    color: var(--ink);
    background-color: var(--cream);
    /* atmósfera: papel + halo dorado tenue arriba */
    background-image:
        radial-gradient(120% 70% at 50% -10%, rgba(201, 167, 90, .14), transparent 60%),
        radial-gradient(90% 50% at 100% 0%, rgba(76, 55, 99, .06), transparent 55%),
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.025'/%3E%3C/svg%3E");
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    min-height: 100vh;
}

h1, h2, h3, h4, .display { font-family: var(--font-display); font-weight: 600; color: var(--pp-900); letter-spacing: .2px; }
a { color: var(--pp-700); text-decoration-color: var(--gold); text-underline-offset: 3px; }
a:hover { color: var(--gold-700); }

/* Ornamento dorado reutilizable */
.rule-gold { height: 2px; border: 0; background: var(--rule); opacity: .9; }
.flourish { color: var(--gold-600); font-family: var(--font-display); }
.eyebrow {
    font-family: var(--font-body); font-weight: 600; font-size: .72rem;
    letter-spacing: .22em; text-transform: uppercase; color: var(--gold-700);
}

/* ---------- Shell ---------- */
.portal-shell { min-height: 100vh; display: flex; flex-direction: column; }

.topbar {
    position: sticky; top: 0; z-index: 30;
    background:
        linear-gradient(180deg, var(--pp-800), var(--pp-900) 70%, var(--pp-950));
    color: var(--gold-100);
    border-bottom: 1px solid rgba(201, 167, 90, .35);
    box-shadow: 0 10px 30px -18px rgba(0,0,0,.7);
}
.topbar::after { content: ""; display: block; height: 2px; background: var(--rule); opacity: .7; }
.topbar-inner {
    max-width: 1120px; margin: 0 auto; padding: .7rem 1.25rem;
    display: flex; align-items: center; gap: 1rem;
}
.brand { display: flex; align-items: center; gap: .8rem; text-decoration: none; color: inherit; }
.brand img { height: 46px; width: auto; display: block; filter: drop-shadow(0 3px 6px rgba(0,0,0,.4)); }
.brand .brand-lines { display: flex; flex-direction: column; line-height: 1.05; }
.brand .brand-kicker { font-size: .64rem; letter-spacing: .24em; text-transform: uppercase; color: var(--gold); }
.brand .brand-name { font-family: var(--font-display); font-size: 1.32rem; font-weight: 600; color: #fff; }
.topbar .spacer { flex: 1; }
.topbar .who { text-align: right; font-size: .82rem; color: var(--gold-200); display: none; }
.topbar .who strong { display: block; font-family: var(--font-display); font-size: 1.02rem; color: #fff; font-weight: 600; }

.btn-exit {
    font-family: var(--font-body); font-size: .85rem; font-weight: 500;
    color: var(--gold-100); text-decoration: none;
    border: 1px solid rgba(201,167,90,.5); border-radius: 999px;
    padding: .38rem .95rem; transition: all .2s ease; white-space: nowrap;
}
.btn-exit:hover { background: rgba(201,167,90,.16); border-color: var(--gold); color: #fff; }

/* ---------- Layout con nav ---------- */
.portal-main { flex: 1; max-width: 1120px; width: 100%; margin: 0 auto; padding: 1.6rem 1.25rem 3rem; }
.portal-grid { display: grid; grid-template-columns: 248px 1fr; gap: 1.7rem; align-items: start; }

.nav-card {
    background: linear-gradient(180deg, #fff, var(--paper));
    border: 1px solid var(--cream-200);
    border-radius: var(--radius);
    box-shadow: var(--shadow-card);
    overflow: hidden;
    position: sticky; top: 88px;
}
.nav-card .nav-head {
    padding: .85rem 1.1rem .55rem;
    border-bottom: 1px solid var(--cream-200);
    background: linear-gradient(180deg, rgba(201,167,90,.08), transparent);
}
.nav-card .nav-head .eyebrow { font-size: .64rem; }
.nav-card .nav-head .title { font-family: var(--font-display); font-size: 1.12rem; color: var(--pp-900); }
.nav-list { display: flex; flex-direction: column; padding: .5rem; gap: .12rem; }
.nav-link {
    display: flex; align-items: center; gap: .7rem;
    padding: .62rem .8rem; border-radius: 9px;
    color: var(--ink); text-decoration: none; font-weight: 500;
    border-left: 3px solid transparent; transition: background .18s, color .18s, border-color .18s;
}
.nav-link i { font-size: 1.05rem; color: var(--pp-700); width: 1.2em; text-align: center; transition: color .18s; }
.nav-link:hover { background: var(--pp-100); color: var(--pp-900); }
.nav-link.is-active {
    background: linear-gradient(90deg, rgba(201,167,90,.16), rgba(201,167,90,.04));
    border-left-color: var(--gold-600); color: var(--pp-900); font-weight: 600;
}
.nav-link.is-active i { color: var(--gold-700); }

/* ---------- Cards genéricas (override Bootstrap) ---------- */
.card {
    position: relative;
    background: #fff;
    border: 1px solid var(--cream-200) !important;
    border-radius: var(--radius) !important;
    box-shadow: var(--shadow-card) !important;
    overflow: hidden;
}
.card::before {
    content: ""; position: absolute; top: 0; left: 0; right: 0; height: 3px;
    background: var(--rule); opacity: .85;
}
.card .card-body { padding: 1.4rem 1.5rem; }
.card-body > h1:first-child, .card-body > h2:first-child { margin-top: .15rem; }

/* Títulos de sección con filete */
h1.h4, h1.h3, .page-title { font-family: var(--font-display); font-weight: 600; font-size: 1.85rem; color: var(--pp-900); margin-bottom: 1.1rem; position: relative; }
h2.h6 { font-family: var(--font-body); font-weight: 600; letter-spacing: .16em; text-transform: uppercase; font-size: .72rem; color: var(--gold-700) !important; margin-bottom: .8rem; }

/* ---------- Botones ---------- */
.btn { font-family: var(--font-body); font-weight: 500; border-radius: 999px; letter-spacing: .01em; transition: all .2s ease; }
.btn-primary, .btn-nazareno {
    background: linear-gradient(180deg, var(--pp-700), var(--pp-900)) !important;
    border: 1px solid var(--pp-900) !important; color: #fff !important;
    padding: .55rem 1.4rem; box-shadow: 0 8px 18px -10px rgba(42,30,61,.8);
}
.btn-primary:hover, .btn-nazareno:hover { filter: brightness(1.08); box-shadow: 0 10px 22px -10px rgba(42,30,61,.9), inset 0 0 0 1px var(--gold); }
.btn-outline-secondary {
    border: 1px solid var(--cream-300) !important; color: var(--pp-700) !important; background: #fff !important;
}
.btn-outline-secondary:hover { background: var(--pp-100) !important; border-color: var(--gold-600) !important; color: var(--pp-900) !important; }
.btn-sm { padding: .3rem .85rem; font-size: .82rem; }

/* ---------- Formularios ---------- */
.form-label { font-weight: 600; font-size: .82rem; letter-spacing: .04em; color: var(--ink-soft); margin-bottom: .35rem; }
.form-control, .form-select {
    font-family: var(--font-body); border: 1px solid var(--cream-300); border-radius: 10px;
    padding: .6rem .8rem; background: #fffdf9; color: var(--ink); transition: border-color .18s, box-shadow .18s;
}
.form-control:focus, .form-select:focus {
    border-color: var(--gold-600); box-shadow: 0 0 0 3px rgba(201,167,90,.22); background: #fff;
}
.form-text { color: var(--ink-soft); }

/* ---------- Tablas ---------- */
.table { font-family: var(--font-body); color: var(--ink); margin: 0; }
.table thead th {
    font-family: var(--font-body); font-weight: 600; text-transform: uppercase;
    letter-spacing: .1em; font-size: .68rem; color: var(--gold-700);
    border-bottom: 1.5px solid var(--cream-200); background: linear-gradient(180deg, var(--paper), #fff);
    padding: .7rem .9rem;
}
.table tbody td { padding: .72rem .9rem; border-bottom: 1px solid var(--cream-200); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background .15s; }
.table tbody tr:hover { background: var(--gold-100); }

/* ---------- Alerts ---------- */
.alert { border: 0; border-left: 3px solid; border-radius: 10px; font-weight: 500; box-shadow: var(--shadow-soft); }
.alert-success { background: var(--ok-bg); color: var(--ok); border-left-color: var(--ok); }
.alert-danger  { background: var(--err-bg); color: var(--err); border-left-color: var(--err); }
.alert-warning { background: var(--warn-bg); color: var(--warn); border-left-color: var(--warn); }
.alert-info    { background: var(--info-bg); color: var(--info); border-left-color: var(--gold-600); }

/* ---------- Badges de estado ---------- */
.estado-chip {
    display: inline-block; font-size: .72rem; font-weight: 600; letter-spacing: .04em;
    padding: .18rem .65rem; border-radius: 999px; text-transform: capitalize;
    background: var(--cream-200); color: var(--ink-soft); border: 1px solid var(--cream-300);
}
.estado-pendiente, .estado-solicitada { background: var(--warn-bg); color: var(--warn); border-color: rgba(163,90,26,.25); }
.estado-pagado, .estado-pagada, .estado-asignada, .estado-salio { background: var(--ok-bg); color: var(--ok); border-color: rgba(31,106,68,.25); }
.estado-devuelto, .estado-cancelada, .estado-anulada, .estado-no_salio { background: var(--err-bg); color: var(--err); border-color: rgba(139,42,42,.22); }

/* ---------- Dashboard hero + tiles ---------- */
.hero {
    position: relative; overflow: hidden;
    background: linear-gradient(135deg, var(--pp-800), var(--pp-950));
    color: var(--gold-100); border-radius: var(--radius);
    padding: 1.7rem 1.7rem; box-shadow: var(--shadow-card);
    border: 1px solid var(--pp-900);
}
.hero::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 3px; background: var(--rule); }
.hero::after {
    content: ""; position: absolute; right: -40px; bottom: -60px; width: 220px; height: 220px;
    background: var(--hero-logo, none) center / contain no-repeat; opacity: .08; pointer-events: none;
}
.hero .eyebrow { color: var(--gold); }
.hero h1 { color: #fff; font-size: 2rem; margin: .2rem 0 .15rem; }
.hero .meta { color: var(--gold-200); font-size: .95rem; }
.hero .meta b { color: #fff; font-weight: 600; }

.tile {
    display: block; text-decoration: none; height: 100%;
    background: #fff; border: 1px solid var(--cream-200); border-radius: var(--radius);
    box-shadow: var(--shadow-card); padding: 1.2rem 1.3rem;
    transition: transform .2s ease, box-shadow .2s ease, border-color .2s; position: relative; overflow: hidden;
}
.tile::before { content: ""; position: absolute; top: 0; left: 0; right: 0; height: 3px; background: var(--rule); opacity: 0; transition: opacity .2s; }
.tile:hover { transform: translateY(-3px); box-shadow: 0 18px 38px -22px rgba(42,30,61,.6); border-color: var(--gold-600); }
.tile:hover::before { opacity: 1; }
.tile .tile-ico { font-size: 1.5rem; color: var(--gold-700); }
.tile .tile-num { font-family: var(--font-display); font-size: 2.4rem; font-weight: 600; color: var(--pp-900); line-height: 1; }
.tile .tile-label { color: var(--ink-soft); font-size: .9rem; }
.tile .tile-title { font-family: var(--font-display); font-size: 1.3rem; color: var(--pp-900); }

/* ---------- Footer ---------- */
.portal-footer { margin-top: auto; padding: 1.6rem 1.25rem 2rem; text-align: center; color: var(--ink-soft); }
.portal-footer .rule-gold { max-width: 220px; margin: 0 auto 1rem; }
.portal-footer img { height: 30px; opacity: .8; margin-bottom: .4rem; }
.portal-footer .small { font-size: .8rem; }
.portal-footer .flourish { letter-spacing: .3em; }

/* ---------- Auth (login / claim) ---------- */
body.portal-auth {
    display: grid; place-items: center; padding: 2rem 1rem;
    background-color: var(--pp-950);
    background-image:
        radial-gradient(80% 60% at 50% -5%, rgba(201,167,90,.22), transparent 60%),
        radial-gradient(70% 50% at 50% 110%, rgba(76,55,99,.5), transparent 60%),
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.04'/%3E%3C/svg%3E");
    color: var(--ink);
}
.auth-card {
    width: 100%; max-width: 430px; position: relative;
    background: linear-gradient(180deg, #fffdf8, var(--paper));
    border: 1px solid var(--gold-600); border-radius: 18px;
    box-shadow: 0 40px 90px -40px rgba(0,0,0,.8), inset 0 0 0 1px rgba(255,255,255,.6);
    padding: 2.1rem 2rem 1.9rem; overflow: hidden;
}
.auth-card::before { content: ""; position: absolute; top: 0; left: 0; right: 0; height: 3px; background: var(--rule); }
.auth-crest { text-align: center; margin-bottom: .4rem; }
.auth-crest img { height: 88px; width: auto; filter: drop-shadow(0 6px 12px rgba(42,30,61,.3)); }
.auth-kicker { text-align: center; }
.auth-title { text-align: center; font-family: var(--font-display); font-weight: 700; font-size: 1.7rem; color: var(--pp-900); margin: .1rem 0 .2rem; }
.auth-sub { text-align: center; color: var(--ink-soft); font-size: .92rem; margin-bottom: 1.3rem; }
.auth-divider { display: flex; align-items: center; gap: .8rem; color: var(--cream-300); margin: 1.2rem 0 .8rem; }
.auth-divider::before, .auth-divider::after { content: ""; flex: 1; height: 1px; background: var(--cream-300); }
.auth-divider span { font-size: 1rem; color: var(--gold-600); }
.auth-foot { text-align: center; font-size: .88rem; color: var(--ink-soft); }

/* ---------- Motion ---------- */
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
.rise { animation: rise .6s cubic-bezier(.2,.7,.2,1) both; }
.rise-1 { animation-delay: .05s; } .rise-2 { animation-delay: .13s; }
.rise-3 { animation-delay: .21s; } .rise-4 { animation-delay: .29s; }
@media (prefers-reduced-motion: reduce) { .rise { animation: none; } }

/* ---------- Responsive ---------- */
@media (min-width: 720px) { .topbar .who { display: block; } }
@media (max-width: 860px) {
    .portal-grid { grid-template-columns: 1fr; }
    .nav-card { position: static; }
    .nav-list { flex-direction: row; flex-wrap: wrap; }
    .nav-link { border-left: 0; border-bottom: 3px solid transparent; padding: .5rem .7rem; }
    .nav-link.is-active { border-left: 0; border-bottom-color: var(--gold-600); }
    .nav-card .nav-head { display: none; }
}
@media (max-width: 640px) {
    /* Tablas anchas (p.ej. procesión, 7 columnas): scroll horizontal dentro de la card */
    .card-body.p-0 { overflow-x: auto; -webkit-overflow-scrolling: touch; }
    .card-body.p-0 .table { min-width: 540px; }
}
@media (max-width: 480px) {
    body.portal { font-size: 16px; }
    .brand .brand-name { font-size: 1.12rem; }
    .brand .brand-kicker { font-size: .58rem; }
    .hero h1 { font-size: 1.6rem; }
    .card .card-body { padding: 1.15rem 1.15rem; }
}
