/* ============================================================
   css/styles.css
   Estilos principales - Sistema Reuniones Tripartitas
   Paleta: Navy + Gold + Crema  |  Fuentes: Playfair + DM Sans
   ============================================================ */

/* -- Variables de diseño -- */
:root {
    --navy:        #0f2044;
    --navy-light:  #1a3460;
    --navy-dark:   #08152c;
    --gold:        #c9a227;
    --gold-light:  #e8c84a;
    --gold-pale:   #f5e9c0;
    --cream:       #faf7f0;
    --white:       #ffffff;
    --gray-100:    #f4f4f6;
    --gray-200:    #e8e8ed;
    --gray-400:    #9898a8;
    --gray-600:    #5a5a70;
    --gray-800:    #2a2a3a;
    --success:     #1e7d4f;
    --success-bg:  #e8f5ee;
    --danger:      #c0392b;
    --danger-bg:   #fdecea;
    --warn:        #d68910;
    --warn-bg:     #fef9e7;

    --radius-sm:   6px;
    --radius-md:   12px;
    --radius-lg:   20px;
    --radius-xl:   32px;
    --shadow-sm:   0 2px 8px rgba(15,32,68,.08);
    --shadow-md:   0 4px 20px rgba(15,32,68,.12);
    --shadow-lg:   0 8px 40px rgba(15,32,68,.18);
    --transition:  all .25s cubic-bezier(.4,0,.2,1);
}

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

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

body {
    font-family: 'DM Sans', sans-serif;
    background: var(--cream);
    color: var(--gray-800);
    line-height: 1.6;
    min-height: 100vh;
}

/* ============================================================
   HOME PAGE
   ============================================================ */
.page-home {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--navy-dark);
    overflow: hidden;
    position: relative;
}

/* Círculos decorativos de fondo */
.bg-decoration { position: fixed; inset: 0; pointer-events: none; z-index: 0; }
.circle {
    position: absolute;
    border-radius: 50%;
    opacity: .06;
}
.circle-1 {
    width: 600px; height: 600px;
    background: var(--gold);
    top: -200px; right: -150px;
}
.circle-2 {
    width: 400px; height: 400px;
    background: var(--gold-light);
    bottom: -100px; left: -100px;
}
.circle-3 {
    width: 250px; height: 250px;
    background: var(--white);
    top: 40%; left: 40%;
    transform: translate(-50%,-50%);
}

.home-container {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 900px;
    padding: 3rem 1.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2.5rem;
}

/* Header */
.home-header {
    text-align: center;
    color: var(--white);
}
.school-badge {
    width: 80px; height: 80px;
    border-radius: 50%;
    background: rgba(201,162,39,.12);
    border: 1px solid rgba(201,162,39,.3);
    display: flex; align-items: center; justify-content: center;
    margin: 0 auto 1.5rem;
    animation: pulse-badge 3s ease-in-out infinite;
}
@keyframes pulse-badge {
    0%, 100% { box-shadow: 0 0 0 0 rgba(201,162,39,.2); }
    50%       { box-shadow: 0 0 0 16px rgba(201,162,39,.0); }
}
.home-title {
    font-family: 'Playfair Display', serif;
    font-size: clamp(2.2rem, 5vw, 3.5rem);
    font-weight: 900;
    line-height: 1.1;
    letter-spacing: -.02em;
}
.home-title span { color: var(--gold); }
.home-subtitle {
    margin-top: .75rem;
    color: rgba(255,255,255,.55);
    font-size: .95rem;
    font-weight: 300;
    letter-spacing: .05em;
    text-transform: uppercase;
}

/* Role Cards */
.role-cards {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    width: 100%;
}
@media (max-width: 640px) {
    .role-cards { grid-template-columns: 1fr; }
}

.role-card {
    background: rgba(255,255,255,.04);
    border: 1px solid rgba(255,255,255,.1);
    border-radius: var(--radius-xl);
    padding: 2rem 1.75rem;
    color: var(--white);
    display: flex;
    flex-direction: column;
    gap: 1rem;
    transition: var(--transition);
    backdrop-filter: blur(8px);
}
.role-card:hover {
    background: rgba(255,255,255,.07);
    border-color: rgba(201,162,39,.4);
    transform: translateY(-4px);
    box-shadow: 0 16px 48px rgba(0,0,0,.3);
}
.role-icon {
    width: 72px; height: 72px;
    border-radius: var(--radius-md);
    background: rgba(201,162,39,.15);
    display: flex; align-items: center; justify-content: center;
    color: var(--gold);
}
.admin-icon { background: rgba(255,255,255,.08); color: var(--white); }

.role-card h2 {
    font-family: 'Playfair Display', serif;
    font-size: 1.35rem;
    font-weight: 700;
}
.role-card p {
    color: rgba(255,255,255,.55);
    font-size: .9rem;
    line-height: 1.7;
    flex: 1;
}

/* Botones de rol */
.btn-role {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .6rem;
    padding: .85rem 1.5rem;
    border: none;
    border-radius: var(--radius-md);
    font-family: 'DM Sans', sans-serif;
    font-size: .9rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    width: 100%;
}
.btn-padres {
    background: var(--gold);
    color: var(--navy-dark);
}
.btn-padres:hover {
    background: var(--gold-light);
    transform: translateX(4px);
}
.btn-admin {
    background: rgba(255,255,255,.1);
    color: var(--white);
    border: 1px solid rgba(255,255,255,.2);
}
.btn-admin:hover {
    background: rgba(255,255,255,.18);
    transform: translateX(4px);
}

/* Footer home */
.home-footer {
    color: rgba(255,255,255,.25);
    font-size: .8rem;
    text-align: center;
}

/* ============================================================
   MODALES
   ============================================================ */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.65);
    backdrop-filter: blur(4px);
    z-index: 100;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    animation: fadeIn .2s ease;
}
.modal-overlay.active { display: flex; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal-box {
    background: var(--white);
    border-radius: var(--radius-xl);
    padding: 2.5rem 2rem;
    width: 100%;
    max-width: 420px;
    position: relative;
    animation: slideUp .3s cubic-bezier(.34,1.56,.64,1);
    box-shadow: var(--shadow-lg);
}
@keyframes slideUp {
    from { opacity: 0; transform: translateY(30px) scale(.96); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-close {
    position: absolute;
    top: 1rem; right: 1rem;
    width: 32px; height: 32px;
    border-radius: 50%;
    border: none;
    background: var(--gray-100);
    font-size: 1.2rem;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    color: var(--gray-600);
    transition: var(--transition);
}
.modal-close:hover { background: var(--gray-200); }

.modal-box h3 {
    font-family: 'Playfair Display', serif;
    font-size: 1.5rem;
    color: var(--navy);
    margin-bottom: .35rem;
}
.modal-box > p {
    color: var(--gray-400);
    font-size: .88rem;
    margin-bottom: 1.5rem;
}

/* ============================================================
   FORMULARIOS
   ============================================================ */
.form-group {
    display: flex;
    flex-direction: column;
    gap: .4rem;
    margin-bottom: 1.1rem;
}
.form-group label {
    font-size: .82rem;
    font-weight: 500;
    color: var(--gray-600);
    letter-spacing: .03em;
    text-transform: uppercase;
}
.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: .75rem 1rem;
    border: 1.5px solid var(--gray-200);
    border-radius: var(--radius-md);
    font-family: 'DM Sans', sans-serif;
    font-size: .95rem;
    color: var(--gray-800);
    background: var(--white);
    transition: var(--transition);
    outline: none;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: var(--gold);
    box-shadow: 0 0 0 3px rgba(201,162,39,.12);
}
.form-group input.error,
.form-group select.error {
    border-color: var(--danger);
}
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}
@media (max-width: 520px) { .form-row { grid-template-columns: 1fr; } }

/* Botones submit */
.btn-submit {
    width: 100%;
    padding: .9rem;
    border: none;
    border-radius: var(--radius-md);
    font-family: 'DM Sans', sans-serif;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    display: flex; align-items: center; justify-content: center; gap: .5rem;
}
.btn-padres-submit { background: var(--gold); color: var(--navy-dark); }
.btn-padres-submit:hover { background: var(--gold-light); transform: translateY(-2px); }
.btn-admin-submit { background: var(--navy); color: var(--white); }
.btn-admin-submit:hover { background: var(--navy-light); transform: translateY(-2px); }

/* ============================================================
   LAYOUT PANEL (admin y padres)
   ============================================================ */
.panel-layout {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--gray-100);
}

/* Navbar */
.navbar {
    background: var(--navy);
    padding: 0 2rem;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 50;
    box-shadow: 0 2px 20px rgba(0,0,0,.25);
}
.navbar-brand {
    display: flex; align-items: center; gap: .75rem;
    color: var(--white);
    text-decoration: none;
}
.navbar-brand .brand-dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    background: var(--gold);
    animation: blink 2s ease-in-out infinite;
}
@keyframes blink { 0%,100%{opacity:1;} 50%{opacity:.3;} }
.navbar-brand span {
    font-family: 'Playfair Display', serif;
    font-size: 1.1rem;
    font-weight: 700;
}
.navbar-brand small {
    display: block;
    font-size: .72rem;
    color: var(--gold);
    letter-spacing: .06em;
    text-transform: uppercase;
    font-family: 'DM Sans', sans-serif;
}

.navbar-user {
    display: flex; align-items: center; gap: 1rem;
    color: rgba(255,255,255,.7);
    font-size: .88rem;
}
.navbar-user strong { color: var(--white); }
.btn-logout {
    background: rgba(255,255,255,.08);
    border: 1px solid rgba(255,255,255,.15);
    color: var(--white);
    padding: .4rem .9rem;
    border-radius: var(--radius-sm);
    font-size: .82rem;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    font-family: 'DM Sans', sans-serif;
}
.btn-logout:hover { background: rgba(255,255,255,.15); }

/* Contenido principal */
.panel-content {
    flex: 1;
    padding: 2rem;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
}
.panel-content h1 {
    font-family: 'Playfair Display', serif;
    font-size: 1.8rem;
    color: var(--navy);
    margin-bottom: .35rem;
}
.panel-content .page-desc {
    color: var(--gray-400);
    font-size: .9rem;
    margin-bottom: 2rem;
}

/* Tabs de navegación */
.tab-nav {
    display: flex;
    gap: .5rem;
    margin-bottom: 2rem;
    border-bottom: 2px solid var(--gray-200);
    padding-bottom: 0;
    overflow-x: auto;
}
.tab-btn {
    padding: .65rem 1.2rem;
    border: none;
    background: none;
    font-family: 'DM Sans', sans-serif;
    font-size: .9rem;
    color: var(--gray-400);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: var(--transition);
    white-space: nowrap;
    font-weight: 500;
}
.tab-btn.active {
    color: var(--navy);
    border-bottom-color: var(--gold);
}
.tab-btn:hover:not(.active) { color: var(--gray-800); }

.tab-content { display: none; }
.tab-content.active { display: block; animation: fadeIn .3s ease; }

/* Tarjetas de contenido */
.card {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 1.75rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--gray-200);
    margin-bottom: 1.5rem;
}
.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--gray-200);
}
.card-header h2 {
    font-family: 'Playfair Display', serif;
    font-size: 1.2rem;
    color: var(--navy);
}

/* Botones de acción */
.btn {
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    padding: .65rem 1.25rem;
    border: none;
    border-radius: var(--radius-md);
    font-family: 'DM Sans', sans-serif;
    font-size: .88rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
}
.btn-primary { background: var(--navy); color: var(--white); }
.btn-primary:hover { background: var(--navy-light); transform: translateY(-1px); }
.btn-gold { background: var(--gold); color: var(--navy-dark); }
.btn-gold:hover { background: var(--gold-light); transform: translateY(-1px); }
.btn-danger { background: var(--danger); color: var(--white); }
.btn-danger:hover { filter: brightness(1.1); }
.btn-outline {
    background: transparent;
    border: 1.5px solid var(--gray-200);
    color: var(--gray-600);
}
.btn-outline:hover { border-color: var(--navy); color: var(--navy); }
.btn-sm { padding: .4rem .8rem; font-size: .8rem; }

/* ============================================================
   HORARIOS / SCHEDULE GRID
   ============================================================ */
.schedule-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
}

.slot-card {
    border: 2px solid var(--gray-200);
    border-radius: var(--radius-md);
    padding: 1.1rem;
    transition: var(--transition);
    cursor: pointer;
    position: relative;
    background: var(--white);
}
.slot-card:hover:not(.slot-full):not(.slot-selected) {
    border-color: var(--gold);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}
.slot-card.slot-full {
    opacity: .5;
    cursor: not-allowed;
    background: var(--gray-100);
}
.slot-card.slot-selected {
    border-color: var(--success);
    background: var(--success-bg);
}

.slot-time {
    font-family: 'Playfair Display', serif;
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--navy);
    margin-bottom: .25rem;
}
.slot-availability {
    font-size: .78rem;
    font-weight: 500;
    display: flex; align-items: center; gap: .3rem;
}
.slot-availability.available { color: var(--success); }
.slot-availability.one-left  { color: var(--warn); }
.slot-availability.full      { color: var(--danger); }

.slot-badge {
    position: absolute;
    top: .5rem; right: .5rem;
    width: 10px; height: 10px;
    border-radius: 50%;
}
.badge-available { background: var(--success); }
.badge-one-left  { background: var(--warn); }
.badge-full      { background: var(--danger); }

/* ============================================================
   TABLA DE REGISTROS (Admin)
   ============================================================ */
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: .88rem;
}
.data-table th {
    background: var(--navy);
    color: var(--white);
    padding: .75rem 1rem;
    text-align: left;
    font-weight: 500;
    letter-spacing: .03em;
    font-size: .8rem;
    text-transform: uppercase;
}
.data-table th:first-child { border-radius: var(--radius-sm) 0 0 var(--radius-sm); }
.data-table th:last-child  { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.data-table td {
    padding: .8rem 1rem;
    border-bottom: 1px solid var(--gray-200);
    color: var(--gray-800);
}
.data-table tr:hover td { background: var(--gray-100); }
.data-table tr:last-child td { border-bottom: none; }

.table-wrap { overflow-x: auto; border-radius: var(--radius-md); }

/* Tags / Pills */
.pill {
    display: inline-block;
    padding: .2rem .65rem;
    border-radius: 99px;
    font-size: .75rem;
    font-weight: 500;
}
.pill-available { background: var(--success-bg); color: var(--success); }
.pill-full      { background: var(--danger-bg);  color: var(--danger); }
.pill-admin     { background: rgba(15,32,68,.08); color: var(--navy); }
.pill-gold      { background: var(--gold-pale);   color: #7a5c00; }

/* ============================================================
   ALERTAS
   ============================================================ */
.alert {
    padding: .85rem 1rem;
    border-radius: var(--radius-md);
    font-size: .88rem;
    margin-bottom: 1rem;
    display: flex; align-items: center; gap: .6rem;
}
.alert-error   { background: var(--danger-bg);  color: var(--danger); border-left: 3px solid var(--danger); }
.alert-success { background: var(--success-bg); color: var(--success); border-left: 3px solid var(--success); }
.alert-warn    { background: var(--warn-bg);    color: var(--warn);   border-left: 3px solid var(--warn); }
.alert-info    { background: rgba(15,32,68,.06); color: var(--navy);  border-left: 3px solid var(--navy); }

/* ============================================================
   SPINNER / LOADING
   ============================================================ */
.spinner {
    display: inline-block;
    width: 20px; height: 20px;
    border: 2px solid var(--gray-200);
    border-top-color: var(--navy);
    border-radius: 50%;
    animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ============================================================
   REGISTRO CONFIRMADO (Padres)
   ============================================================ */
.confirmation-box {
    text-align: center;
    padding: 3rem 2rem;
}
.confirmation-icon {
    width: 80px; height: 80px;
    border-radius: 50%;
    background: var(--success-bg);
    display: flex; align-items: center; justify-content: center;
    margin: 0 auto 1.5rem;
}
.confirmation-box h2 {
    font-family: 'Playfair Display', serif;
    font-size: 1.6rem;
    color: var(--navy);
    margin-bottom: .5rem;
}
.confirmation-box p { color: var(--gray-600); margin-bottom: 1rem; }
.confirmation-detail {
    background: var(--gray-100);
    border-radius: var(--radius-md);
    padding: 1.25rem;
    text-align: left;
    margin-top: 1.5rem;
}
.confirmation-detail dl { display: grid; grid-template-columns: auto 1fr; gap: .5rem 1rem; }
.confirmation-detail dt { font-weight: 500; color: var(--gray-600); font-size: .85rem; }
.confirmation-detail dd { color: var(--gray-800); font-size: .85rem; }

/* ============================================================
   STATS / MÉTRICAS (Admin dashboard)
   ============================================================ */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}
.stat-card {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    display: flex; flex-direction: column; gap: .5rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--gray-200);
}
.stat-number {
    font-family: 'Playfair Display', serif;
    font-size: 2.2rem;
    font-weight: 700;
    color: var(--navy);
    line-height: 1;
}
.stat-label {
    font-size: .82rem;
    color: var(--gray-400);
    text-transform: uppercase;
    letter-spacing: .04em;
}
.stat-bar {
    height: 4px;
    background: var(--gray-200);
    border-radius: 2px;
    overflow: hidden;
    margin-top: .25rem;
}
.stat-bar-fill {
    height: 100%;
    background: var(--gold);
    border-radius: 2px;
    transition: width .8s ease;
}

/* ============================================================
   SELECCIÓN DE GRADO/SECCIÓN (Padres)
   ============================================================ */
.filter-row {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    align-items: flex-end;
    padding: 1rem;
    background: var(--gray-100);
    border-radius: var(--radius-md);
    margin-bottom: 1.5rem;
}
.filter-row .form-group { margin-bottom: 0; flex: 1; min-width: 140px; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 768px) {
    .panel-content { padding: 1rem; }
    .navbar { padding: 0 1rem; }
    .schedule-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
    .card { padding: 1.25rem; }
    .stats-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 480px) {
    .stats-grid { grid-template-columns: 1fr; }
    .navbar-user .user-name { display: none; }
}

/* ============================================================
   UTILIDADES
   ============================================================ */
.text-center { text-align: center; }
.text-right  { text-align: right; }
.mt-1 { margin-top: .5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: .5rem; }
.mb-2 { margin-bottom: 1rem; }
.flex { display: flex; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.gap-1 { gap: .5rem; }
.gap-2 { gap: 1rem; }
.hidden { display: none !important; }
.text-sm { font-size: .85rem; }
.text-muted { color: var(--gray-400); }
