/* ============================================================
   HLZ All Stars - Tema Claro Equilibrado (Tipografía Natural)
   Rojo Carmesí HLZ + Fondo Luminoso + 100% Optimizado Móvil
   ============================================================ */

:root {
    /* Paleta Oficial HLZ */
    --color-primary: #e31b23;          /* Rojo Carmesí HLZ */
    --color-primary-dark: #b9151b;     /* Rojo Intenso */
    --color-primary-light: #ff4d55;
    --color-primary-soft: #fef2f2;     /* Fondo suave con tinte rojo */
    --color-accent: #0f172a;           /* Azul noche / Negro elegante */

    /* Fondos y Superficies Claras */
    --color-bg: #f8fafc;              /* Gris muy claro */
    --color-card: #ffffff;             /* Blanco puro */
    --color-card-subtle: #f1f5f9;
    --color-text: #0f172a;            /* Texto oscuro nítido */
    --color-muted: #64748b;           /* Gris neutro */
    --color-border: #e2e8f0;          /* Líneas suaves */

    /* Estados */
    --color-success: #16a34a;
    --color-success-bg: #dcfce7;
    --color-warning: #b45309;
    --color-warning-bg: #fef3c7;
    --color-error: #dc2626;
    --color-error-bg: #fee2e2;

    /* UI Tokens */
    --radius: 12px;
    --radius-sm: 8px;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05);
    --shadow: 0 4px 14px rgba(15, 23, 42, 0.06);
    --shadow-lg: 0 10px 25px rgba(15, 23, 42, 0.08);
}

* { 
    box-sizing: border-box; 
}

html, body {
    margin: 0;
    padding: 0;
    background: var(--color-bg);
    color: var(--color-text);
    font-family: 'Segoe UI', Roboto, -apple-system, BlinkMacSystemFont, Helvetica, Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
}

a { 
    color: var(--color-primary); 
    text-decoration: none; 
    transition: color 0.15s ease;
}

a:hover { 
    color: var(--color-primary-dark);
    text-decoration: underline; 
}

img { 
    max-width: 100%; 
    display: block; 
}

/* Previene el zoom automático de inputs en iOS/Android */
input[type="text"], 
input[type="email"], 
input[type="password"], 
input[type="date"], 
input[type="time"], 
input[type="number"], 
input[type="file"], 
select, 
textarea {
    font-size: 16px !important;
}

/* ---------- Cabecera Deportiva HLZ ---------- */
.app-header {
    background: #ffffff;
    color: var(--color-text);
    position: sticky;
    top: 0;
    z-index: 50;
    border-bottom: 3px solid var(--color-primary);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.app-header .header-inner {
    max-width: 1140px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.85rem 1.25rem;
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-weight: 700;
    font-size: 1.15rem;
    color: #0f172a;
}

.brand:hover { 
    text-decoration: none; 
}

.brand .logo-dot {
    width: 12px; 
    height: 12px; 
    border-radius: 50%;
    background: var(--color-primary);
}

.nav-toggle {
    display: none;
    background: none;
    border: none;
    color: #0f172a;
    font-size: 1.7rem;
    cursor: pointer;
    line-height: 1;
    padding: 0.4rem;
}

.main-nav {
    display: flex;
    align-items: center;
    gap: 1.4rem;
}

.main-nav a {
    color: #334155;
    font-weight: 600;
    font-size: 0.92rem;
    padding: 0.4rem 0.2rem;
    border-bottom: 2px solid transparent;
    transition: all 0.2s ease;
}

.main-nav a.active, 
.main-nav a:hover {
    color: var(--color-primary);
    border-bottom-color: var(--color-primary);
    text-decoration: none;
}

.main-nav .user-pill {
    background: #f1f5f9;
    color: #0f172a;
    border: 1px solid var(--color-border);
    padding: 0.35rem 0.85rem;
    border-radius: 999px;
    font-size: 0.85rem;
    font-weight: 600;
}

/* ---------- Contenedor Principal ---------- */
.container {
    max-width: 1140px;
    margin: 0 auto;
    padding: 1.75rem 1.25rem 3.5rem;
}

.page-title {
    font-size: 1.55rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    margin: 0 0 1.3rem;
    color: #0f172a;
    border-left: 4px solid var(--color-primary);
    padding-left: 0.75rem;
}

.grid { 
    display: grid; 
    gap: 1.25rem; 
}

.grid-2 { 
    grid-template-columns: 1fr 1fr; 
}

@media (max-width: 860px) {
    .grid-2 { 
        grid-template-columns: 1fr; 
    }
}

/* ---------- Tarjetas y Paneles ---------- */
.card {
    background: var(--color-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    padding: 1.4rem;
    border: 1px solid var(--color-border);
    transition: box-shadow 0.2s ease;
}

.card:hover {
    box-shadow: var(--shadow);
}

.card h2, .card h3 {
    margin-top: 0;
    color: #0f172a;
    font-size: 1.15rem;
    font-weight: 700;
}

.stat-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
    margin-bottom: 1.4rem;
}

.stat-card {
    background: #ffffff;
    border-radius: var(--radius);
    padding: 1.1rem 1.25rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--color-border);
    border-top: 4px solid var(--color-primary);
}

.stat-card .label { 
    color: var(--color-muted); 
    font-size: 0.82rem; 
    font-weight: 600;
}

.stat-card .value { 
    font-size: 1.65rem; 
    font-weight: 700; 
    color: #0f172a; 
    margin-top: 0.25rem;
}

/* ---------- Formularios ---------- */
form .form-row { 
    margin-bottom: 1.1rem; 
}

form label {
    display: block;
    font-weight: 600;
    font-size: 0.88rem;
    margin-bottom: 0.4rem;
    color: #334155;
}

input[type="text"], 
input[type="email"], 
input[type="password"], 
input[type="date"], 
input[type="time"], 
input[type="number"], 
input[type="file"], 
select, 
textarea {
    width: 100%;
    padding: 0.7rem 0.85rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: #fff;
    color: var(--color-text);
    font-family: inherit;
    transition: all 0.15s ease;
}

input:focus, 
select:focus, 
textarea:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(227, 27, 35, 0.15);
}

.form-inline {
    display: flex;
    gap: 0.8rem;
    flex-wrap: wrap;
    align-items: flex-end;
}

.form-inline .form-row { 
    flex: 1 1 160px; 
    margin-bottom: 0; 
}

/* ---------- Botones HLZ ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--color-primary);
    color: #fff;
    border: none;
    padding: 0.65rem 1.3rem;
    border-radius: var(--radius-sm);
    font-size: 0.92rem;
    font-weight: 600;
    cursor: pointer;
    min-height: 44px; /* Touch target móvil */
    transition: all 0.15s ease;
    text-decoration: none;
}

.btn:hover { 
    background: var(--color-primary-dark); 
    color: #fff;
    text-decoration: none; 
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(227, 27, 35, 0.25);
}

.btn-accent { 
    background: #0f172a; 
    color: #ffffff; 
}

.btn-accent:hover { 
    background: #1e293b; 
    color: #ffffff; 
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.2);
}

.btn-danger { 
    background: var(--color-error-bg); 
    color: var(--color-error); 
    border: 1px solid #fecaca;
}

.btn-danger:hover { 
    background: #fee2e2; 
    color: var(--color-primary-dark); 
}

.btn-sm { 
    padding: 0.38rem 0.8rem; 
    font-size: 0.82rem; 
    min-height: 36px; 
}

.btn-outline { 
    background: transparent; 
    border: 1.5px solid var(--color-border); 
    color: #334155; 
}

.btn-outline:hover { 
    background: #f8fafc; 
    border-color: #0f172a;
    color: #0f172a; 
}

.btn-block { 
    display: flex; 
    width: 100%; 
    text-align: center; 
}

/* ---------- Tablas & Tarjetas Móviles ---------- */
.table-wrap { 
    overflow-x: auto; 
    -webkit-overflow-scrolling: touch; 
}

table { 
    width: 100%; 
    border-collapse: collapse; 
    font-size: 0.92rem; 
}

thead th {
    text-align: left;
    background: #f8fafc;
    color: #475569;
    padding: 0.75rem 0.85rem;
    font-size: 0.82rem;
    font-weight: 600;
    border-bottom: 2px solid var(--color-border);
    white-space: nowrap;
}

tbody td {
    padding: 0.75rem 0.85rem;
    border-bottom: 1px solid var(--color-border);
    vertical-align: middle;
}

tbody tr:hover { 
    background: #f8fafc; 
}

tbody tr:last-child td { 
    border-bottom: none; 
}

@media (max-width: 720px) {
    .table-wrap table, 
    .table-wrap thead, 
    .table-wrap tbody, 
    .table-wrap th, 
    .table-wrap td, 
    .table-wrap tr {
        display: block;
    }
    
    .table-wrap thead { 
        display: none; 
    }

    .table-wrap tr {
        background: #fff;
        border: 1px solid var(--color-border);
        border-left: 4px solid var(--color-primary);
        border-radius: var(--radius);
        margin-bottom: 0.85rem;
        padding: 0.85rem;
        box-shadow: var(--shadow-sm);
    }

    .table-wrap td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 0.55rem 0;
        border-bottom: 1px dashed var(--color-border);
        font-size: 0.88rem;
        text-align: right;
        min-height: 38px;
    }

    .table-wrap td:last-child {
        border-bottom: none;
        padding-top: 0.65rem;
        justify-content: flex-end;
    }

    .table-wrap td[data-label]::before {
        content: attr(data-label);
        font-weight: 600;
        color: var(--color-muted);
        font-size: 0.8rem;
        text-align: left;
        margin-right: 0.5rem;
    }
}

.empty-state {
    text-align: center;
    color: var(--color-muted);
    padding: 2.5rem 1rem;
    font-style: italic;
}

/* ---------- Alertas & Badges ---------- */
.alert {
    padding: 0.85rem 1.1rem;
    border-radius: var(--radius-sm);
    margin-bottom: 1.25rem;
    font-size: 0.92rem;
    font-weight: 500;
}

.alert-success { 
    background: var(--color-success-bg); 
    color: #14532d; 
    border: 1px solid #bbf7d0;
}

.alert-error { 
    background: var(--color-error-bg); 
    color: #7f1d1d; 
    border: 1px solid #fecaca;
}

.badge {
    display: inline-block;
    padding: 0.25rem 0.65rem;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 600;
}

.badge-admin { 
    background: #fee2e2; 
    color: var(--color-primary); 
    border: 1px solid #fecaca;
}

.badge-user { 
    background: #f1f5f9; 
    color: #334155; 
    border: 1px solid #e2e8f0;
}

/* ---------- Login HLZ ---------- */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f8fafc;
    padding: 1.25rem;
}

.login-card {
    background: #ffffff;
    width: 100%;
    max-width: 400px;
    border-radius: 16px;
    padding: 2.5rem 2rem;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--color-border);
    border-top: 5px solid var(--color-primary);
}

.login-card .brand-logo {
    text-align: center;
    margin-bottom: 0.3rem;
    font-size: 1.55rem;
    font-weight: 700;
    color: #0f172a;
}

.login-card .subtitle {
    text-align: center;
    color: var(--color-muted);
    margin-bottom: 1.75rem;
    font-size: 0.9rem;
}

.login-hint {
    margin-top: 1.4rem;
    font-size: 0.8rem;
    color: var(--color-muted);
    text-align: center;
    background: #f8fafc;
    padding: 0.65rem;
    border-radius: 8px;
    border: 1px solid var(--color-border);
}

/* ---------- Horario Cuadrícula (Desktop) ---------- */
.schedule-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.schedule-grid {
    display: grid;
    grid-template-columns: 80px repeat(7, minmax(130px, 1fr));
    grid-auto-rows: 54px;
    min-width: 760px;
    border: 1px solid var(--color-border);
    position: relative;
    background: #fff;
}

.sch-cell {
    border: 1px solid #f1f5f9;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    font-size: 0.78rem;
    padding: 0.3rem;
    box-sizing: border-box;
}

.sch-head {
    grid-row: 1;
    background: #0f172a;
    color: #ffffff;
    font-weight: 600;
    font-size: 0.82rem;
}

.sch-corner { 
    grid-column: 1; 
    background: #000000;
    color: var(--color-primary);
}

.sch-time {
    grid-column: 1;
    background: #f8fafc;
    color: #334155;
    font-weight: 600;
    line-height: 1.3;
}

.sch-bg { 
    background: #f8fafc; 
}

.sch-block {
    border: 1px solid rgba(0, 0, 0, 0.12);
    border-radius: 6px;
    box-sizing: border-box;
    padding: 0.4rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.sch-block-title {
    font-weight: 700;
    font-size: 0.78rem;
    line-height: 1.2;
    color: #0f172a;
}

.sch-block-notes {
    font-size: 0.7rem;
    color: #334155;
    margin-top: 0.2rem;
}

.color-swatch {
    display: inline-block;
    width: 22px;
    height: 22px;
    border-radius: 6px;
    border: 1px solid var(--color-border);
    vertical-align: middle;
}

/* ---------- Horario Móvil (Tarjetas por Día) ---------- */
.schedule-mobile-view { 
    display: none; 
}

.schedule-grid-mobile {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.day-card-mobile {
    background: #fff;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 0.9rem;
    box-shadow: var(--shadow-sm);
}

.day-card-title {
    font-weight: 700;
    color: #0f172a;
    border-bottom: 2.5px solid var(--color-primary);
    padding-bottom: 0.35rem;
    margin-bottom: 0.75rem;
    font-size: 1.05rem;
}

.schedule-item-mobile {
    border-left: 5px solid var(--color-primary);
    padding: 0.65rem 0.85rem;
    background: #f8fafc;
    border-radius: 0 8px 8px 0;
    margin-bottom: 0.65rem;
    border-top: 1px solid #f1f5f9;
    border-right: 1px solid #f1f5f9;
    border-bottom: 1px solid #f1f5f9;
}

@media (max-width: 768px) {
    .schedule-wrap { 
        display: none; 
    }
    .schedule-mobile-view { 
        display: block; 
    }
}

/* ---------- Utilidades Generales ---------- */
.text-muted { color: var(--color-muted); }
.text-right { text-align: right; }
.mt-1 { margin-top: 1rem; }
.mb-1 { margin-bottom: 1rem; }
.flex { display: flex; }
.flex-between { 
    display: flex; 
    align-items: center; 
    justify-content: space-between; 
    flex-wrap: wrap; 
    gap: 0.6rem; 
}
.flex-gap { 
    display: flex; 
    gap: 0.6rem; 
    flex-wrap: wrap; 
}

/* ---------- Adaptación Móvil Específica ---------- */
@media (max-width: 720px) {
    .nav-toggle { 
        display: block; 
    }
    .main-nav {
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: #ffffff;
        flex-direction: column;
        align-items: stretch;
        padding: 0.75rem 1.25rem 1.25rem;
        gap: 0.3rem;
        display: none;
        border-bottom: 3px solid var(--color-primary);
        box-shadow: 0 10px 20px rgba(0,0,0,0.08);
    }
    .main-nav.open { 
        display: flex; 
    }
    .main-nav a { 
        padding: 0.75rem 0; 
        border-bottom: 1px solid var(--color-border); 
        color: #0f172a;
    }
    .main-nav .user-pill { 
        order: -1; 
        margin-bottom: 0.5rem; 
        text-align: center; 
    }
    .form-inline { 
        flex-direction: column; 
        align-items: stretch; 
    }
    .form-inline .form-row { 
        flex: 1 1 auto; 
    }
    .page-title { 
        font-size: 1.3rem; 
    }
    .container { 
        padding: 1.1rem 0.85rem 2.5rem; 
    }
    .stat-cards {
        grid-template-columns: 1fr 1fr;
        gap: 0.65rem;
    }
    .stat-card { 
        padding: 0.85rem; 
    }
    .stat-card .value { 
        font-size: 1.3rem; 
    }
    .flex-between {
        flex-direction: column;
        align-items: stretch;
        gap: 0.85rem;
    }
    .flex-between .btn,
    .export-dropdown-wrap .btn {
        width: 100%;
    }
}