/* Admin Panel · Dpto. IEI */

:root {
    --primary: #0a2540;
    --primary-2: #1e3a8a;
    --accent: #0ea5e9;
    --accent-2: #06b6d4;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --bg: #f1f5f9;
    --card: #ffffff;
    --text: #0f172a;
    --muted: #64748b;
    --border: #e2e8f0;
    --shadow-sm: 0 1px 2px rgba(10,37,64,.04);
    --shadow: 0 4px 20px rgba(10,37,64,.08);
    --radius: 14px;
    --radius-sm: 10px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { font-family: 'Inter', sans-serif; font-size: 14.5px; background: var(--bg); color: var(--text); }
a { color: inherit; text-decoration: none; }
input, select, textarea, button { font-family: inherit; font-size: 0.95rem; }

h1, h2, h3, h4 { font-family: 'Space Grotesk', 'Inter', sans-serif; color: var(--primary); }
h3 { font-size: 1.1rem; font-weight: 600; }
h4 { font-size: 1rem; font-weight: 600; }

/* ============ LOGIN ============ */
.login-page {
    min-height: 100vh;
    background: linear-gradient(135deg, #0a2540 0%, #1e3a8a 50%, #0ea5e9 100%);
    display: flex; align-items: center; justify-content: center;
    padding: 20px;
    position: relative;
    overflow: hidden;
}
.login-page::before {
    content: '';
    position: absolute; inset: 0;
    background:
        radial-gradient(circle at 20% 30%, rgba(0,212,255,.3), transparent 40%),
        radial-gradient(circle at 80% 70%, rgba(245,158,11,.2), transparent 40%);
}
.login-wrap { width: 100%; max-width: 420px; position: relative; z-index: 1; }
.login-card {
    background: rgba(255,255,255,.98);
    padding: 42px 38px;
    border-radius: 20px;
    box-shadow: 0 30px 80px rgba(0,0,0,.25);
    backdrop-filter: blur(20px);
}
.login-brand { text-align: center; margin-bottom: 28px; }
.login-logo { width: 72px; height: auto; margin: 0 auto 16px; display: block; }
.login-brand h1 { font-size: 1.4rem; margin-bottom: 4px; }
.login-brand p { color: var(--muted); font-size: 0.85rem; }

.login-form .form-field { margin-bottom: 16px; }
.login-form label {
    display: block;
    font-weight: 600;
    font-size: 0.82rem;
    color: var(--primary);
    margin-bottom: 6px;
}
.login-form label i { color: var(--accent); margin-right: 4px; }
.login-form input {
    width: 100%;
    padding: 12px 14px;
    border: 2px solid var(--border);
    border-radius: 10px;
    transition: all .2s;
    background: #fff;
}
.login-form input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 4px rgba(14,165,233,.12);
}
.btn-block { width: 100%; margin-top: 6px; justify-content: center; }

.login-foot { text-align: center; margin-top: 22px; font-size: 0.88rem; }
.login-foot a { color: var(--muted); }
.login-foot a:hover { color: var(--accent); }

/* ============ BUTTONS ============ */
.btn {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 10px 18px;
    font-weight: 600;
    font-size: 0.9rem;
    border-radius: 10px;
    border: none;
    cursor: pointer;
    transition: all .2s;
    text-decoration: none;
    line-height: 1;
}
.btn-primary {
    background: linear-gradient(135deg, #0ea5e9, #06b6d4);
    color: #fff;
    box-shadow: 0 6px 18px rgba(14,165,233,.3);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 10px 24px rgba(14,165,233,.4); }
.btn-ghost { background: #fff; color: var(--primary); border: 2px solid var(--border); }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }
.btn-sm { padding: 7px 12px; font-size: 0.82rem; }
.btn-danger { background: var(--danger); color: #fff; }

/* ============ ALERTS ============ */
.alert {
    display: flex; align-items: center; gap: 10px;
    padding: 12px 16px;
    border-radius: 10px;
    margin-bottom: 18px;
    font-size: 0.92rem;
    font-weight: 500;
}
.alert-ok, .alert-success { background: #dcfce7; color: #166534; border-left: 4px solid var(--success); }
.alert-error, .alert-danger { background: #fee2e2; color: #991b1b; border-left: 4px solid var(--danger); }

/* ============ ADMIN LAYOUT ============ */
.admin-body { display: flex; min-height: 100vh; }

/* Sidebar */
.sidebar {
    width: 260px;
    background: var(--primary);
    color: #cbd5e1;
    display: flex; flex-direction: column;
    position: fixed; top: 0; left: 0; bottom: 0;
    z-index: 100;
    transition: transform .3s;
}
.sidebar-brand {
    display: flex; align-items: center; gap: 12px;
    padding: 20px 22px;
    border-bottom: 1px solid rgba(255,255,255,.08);
}
.sidebar-brand img { width: 40px; height: auto; }
.sidebar-brand strong { color: #fff; font-family: 'Space Grotesk'; font-size: 1.1rem; display: block; }
.sidebar-brand small { font-size: 0.7rem; opacity: .7; text-transform: uppercase; letter-spacing: 1px; }

.sidebar-nav { flex: 1; padding: 16px 12px; overflow-y: auto; }
.nav-sec {
    display: block;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: rgba(255,255,255,.4);
    padding: 14px 12px 6px;
    font-weight: 600;
}
.nav-link {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 12px;
    border-radius: 8px;
    color: rgba(255,255,255,.8);
    font-weight: 500;
    margin-bottom: 2px;
    transition: all .2s;
}
.nav-link:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav-link.active {
    background: linear-gradient(135deg, #0ea5e9, #06b6d4);
    color: #fff;
    box-shadow: 0 6px 14px rgba(14,165,233,.3);
}
.nav-link i { width: 18px; text-align: center; }

.sidebar-foot { padding: 16px; border-top: 1px solid rgba(255,255,255,.08); display: flex; flex-direction: column; gap: 6px; }
.btn-foot {
    padding: 10px 14px;
    background: rgba(255,255,255,.06);
    border-radius: 8px;
    color: #fff;
    font-size: 0.85rem;
    font-weight: 500;
    display: flex; align-items: center; gap: 8px;
    transition: all .2s;
}
.btn-foot:hover { background: rgba(255,255,255,.12); }
.btn-foot.danger:hover { background: var(--danger); }

/* Main */
.main-content {
    flex: 1;
    margin-left: 260px;
    min-width: 0;
}
.topbar {
    display: flex; align-items: center; justify-content: space-between;
    gap: 16px;
    padding: 14px 28px;
    background: #fff;
    border-bottom: 1px solid var(--border);
    position: sticky; top: 0;
    z-index: 50;
}
.page-title { font-size: 1.2rem; font-weight: 600; }
.burger { display: none; background: none; border: none; font-size: 1.2rem; cursor: pointer; color: var(--primary); }
.user-info { display: flex; align-items: center; gap: 10px; }
.user-avatar {
    width: 38px; height: 38px; border-radius: 50%;
    background: linear-gradient(135deg, #0ea5e9, #06b6d4);
    color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700;
}
.user-text strong { display: block; font-size: 0.88rem; color: var(--primary); }
.user-text small { display: block; font-size: 0.72rem; color: var(--muted); text-transform: uppercase; }

.content-wrap { padding: 28px; }

/* ============ PANELS / CARDS ============ */
.panel {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow-sm);
    margin-bottom: 20px;
}
.panel-head {
    display: flex; justify-content: space-between; align-items: center;
    gap: 12px;
    margin-bottom: 18px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
}
.panel-head h3 { font-size: 1.05rem; }
.panel-head h3 i { color: var(--accent); margin-right: 6px; }
.head-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* Stats */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}
.stat-card {
    background: #fff;
    border-radius: var(--radius);
    padding: 20px;
    display: flex; align-items: center; gap: 16px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    position: relative;
    overflow: hidden;
    transition: transform .2s;
}
.stat-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.stat-icon {
    width: 52px; height: 52px;
    border-radius: 14px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.3rem;
    color: #fff;
    flex-shrink: 0;
}
.stat-card.blue   .stat-icon { background: linear-gradient(135deg, #0ea5e9, #06b6d4); }
.stat-card.green  .stat-icon { background: linear-gradient(135deg, #10b981, #059669); }
.stat-card.orange .stat-icon { background: linear-gradient(135deg, #f59e0b, #ea580c); }
.stat-card.purple .stat-icon { background: linear-gradient(135deg, #8b5cf6, #6d28d9); }
.stat-card.red    .stat-icon { background: linear-gradient(135deg, #ef4444, #b91c1c); }
.stat-card.teal   .stat-icon { background: linear-gradient(135deg, #14b8a6, #0d9488); }
.stat-card.pink   .stat-icon { background: linear-gradient(135deg, #ec4899, #be185d); }
.stat-card.dark   .stat-icon { background: linear-gradient(135deg, #0f172a, #334155); }
.stat-num { font-family: 'Space Grotesk'; font-size: 1.8rem; font-weight: 700; color: var(--primary); line-height: 1; }
.stat-lbl { font-size: 0.82rem; color: var(--muted); margin-top: 4px; }

.row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.col { min-width: 0; }

.mini-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin: 10px 0; }
.ms { padding: 14px 8px; background: var(--bg); border-radius: 10px; text-align: center; }
.ms-num { display: block; font-size: 1.5rem; font-weight: 700; color: var(--primary); font-family: 'Space Grotesk'; }
.ms-lbl { display: block; font-size: 0.78rem; color: var(--muted); margin-top: 2px; }

.recent-list { list-style: none; }
.recent-list li { padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 0.9rem; }
.recent-list li:last-child { border-bottom: 0; }
.recent-list small { color: var(--muted); }

/* ============ TABLES ============ */
.table { width: 100%; border-collapse: collapse; }
.table th {
    text-align: left;
    padding: 12px 14px;
    background: var(--bg);
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--muted);
    border-bottom: 2px solid var(--border);
}
.table td {
    padding: 14px;
    border-bottom: 1px solid var(--border);
    font-size: 0.9rem;
    vertical-align: middle;
}
.table tbody tr { transition: background .15s; }
.table tbody tr:hover { background: rgba(14,165,233,.03); }
.table tbody tr.me { background: rgba(14,165,233,.05); }
.table small { color: var(--muted); font-size: 0.78rem; }
.table .empty { text-align: center; color: var(--muted); padding: 40px; }

.tag {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 100px;
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}
.tag-asistio { background: #dcfce7; color: #166534; }
.tag-tardanza { background: #fef3c7; color: #92400e; }
.tag-falta { background: #fee2e2; color: #991b1b; }
.tag-licencia { background: #e0e7ff; color: #3730a3; }
.tag-warm { background: #fef3c7; color: #92400e; }
.tag-cat { background: linear-gradient(135deg, #0ea5e9, #06b6d4); color: #fff; }

.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; }
.dot.ok { background: var(--success); box-shadow: 0 0 0 3px rgba(16,185,129,.2); }
.dot.off { background: var(--muted); }

.actions { display: flex; gap: 4px; flex-wrap: nowrap; white-space: nowrap; }
.btn-act {
    width: 34px; height: 34px;
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--bg);
    border-radius: 8px;
    color: var(--text);
    transition: all .2s;
    font-size: 0.85rem;
}
.btn-act:hover { background: var(--primary); color: #fff; }
.btn-act.edit:hover { background: var(--accent); }
.btn-act.danger:hover { background: var(--danger); }

/* Filters */
.filters {
    display: flex;
    gap: 8px;
    margin-bottom: 18px;
    flex-wrap: wrap;
    align-items: center;
}
.filters input, .filters select {
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 0.88rem;
    background: #fff;
}
.filters input:focus, .filters select:focus { outline: 2px solid var(--accent); border-color: transparent; }

/* Search input with icon */
.search-input {
    position: relative;
    display: inline-flex;
    align-items: center;
}
.search-input > i {
    position: absolute;
    left: 12px;
    color: var(--muted);
    pointer-events: none;
    font-size: 0.88rem;
}
.search-input input {
    padding-left: 34px !important;
    min-width: 220px;
}
.search-input input:focus + i,
.search-input:focus-within > i { color: var(--accent); }

/* ============ COMBOBOX BUSCABLE ============ */
.combo-search {
    position: relative;
    width: 100%;
}
.combo-icon {
    position: absolute;
    left: 14px; top: 50%;
    transform: translateY(-50%);
    color: var(--muted);
    pointer-events: none;
    font-size: 0.95rem;
    z-index: 2;
    transition: color 0.15s;
}
.combo-search.open .combo-icon,
.combo-search:focus-within .combo-icon { color: var(--accent); }
.combo-input {
    width: 100%;
    padding: 11px 40px 11px 40px !important;
    border: 2px solid var(--border);
    border-radius: 10px;
    background: #fff;
    font-size: 0.95rem;
    transition: all 0.15s;
    cursor: text;
}
.combo-input:focus,
.combo-search.open .combo-input {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(14,165,233,.12);
}
.combo-toggle {
    position: absolute;
    right: 6px; top: 50%;
    transform: translateY(-50%);
    width: 32px; height: 32px;
    background: transparent;
    border: none;
    color: var(--muted);
    cursor: pointer;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.18s;
    z-index: 3;
    font-size: 0.85rem;
}
.combo-toggle:hover { background: var(--bg); color: var(--accent); }
.combo-search.open .combo-toggle { color: var(--accent); }
.combo-search.open .combo-toggle i { transform: rotate(180deg); }
.combo-toggle i { transition: transform 0.2s; }

.combo-list {
    position: absolute;
    top: calc(100% + 6px);
    left: 0; right: 0;
    max-height: 300px;
    overflow-y: auto;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: 0 12px 32px rgba(10,37,64,0.15);
    list-style: none;
    padding: 6px 0;
    margin: 0;
    z-index: 50;
}
.combo-list .combo-group {
    padding: 9px 14px 5px;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    font-weight: 700;
    color: var(--muted);
    background: var(--bg);
    border-top: 1px solid var(--border);
    position: sticky;
    top: 0;
}
.combo-list .combo-group:first-child { border-top: 0; }
.combo-list .combo-opt {
    padding: 10px 14px;
    cursor: pointer;
    font-size: 0.92rem;
    transition: background 0.12s, color 0.12s;
    outline: none;
    user-select: none;
}
.combo-list .combo-opt:hover,
.combo-list .combo-opt:focus {
    background: rgba(14,165,233,0.1);
    color: var(--primary);
    font-weight: 500;
}
.combo-list .combo-empty {
    padding: 16px;
    text-align: center;
    color: var(--muted);
    font-size: 0.88rem;
    font-style: italic;
}

/* ============ CMS FORM ============ */
.cms-form { max-width: 880px; }
.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 20px;
}
.form-field { display: flex; flex-direction: column; }
.form-field.full { grid-column: 1 / -1; }
.form-field label {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--primary);
    margin-bottom: 6px;
}
.form-field input, .form-field select, .form-field textarea {
    padding: 10px 14px;
    border: 2px solid var(--border);
    border-radius: 10px;
    background: #fff;
    transition: all .15s;
}
.form-field input:focus, .form-field select:focus, .form-field textarea:focus {
    outline: none; border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(14,165,233,.12);
}
.form-field.check, .form-field label.check {
    flex-direction: row; align-items: center; gap: 8px;
    font-weight: 500; cursor: pointer;
}
.form-field label.check input { width: auto; }
.hint { font-size: 0.78rem; color: var(--muted); margin-top: 4px; }
.form-actions { display: flex; gap: 10px; padding-top: 16px; border-top: 1px solid var(--border); }

.radio-pills { display: flex; gap: 8px; flex-wrap: wrap; }
.radio-pills label {
    display: flex; align-items: center; gap: 6px;
    padding: 8px 14px;
    border: 2px solid var(--border);
    border-radius: 100px;
    cursor: pointer;
    background: #fff;
    font-weight: 500;
    font-size: 0.88rem;
    transition: all .2s;
}
.radio-pills input { display: none; }
.radio-pills label:has(input:checked) { background: var(--primary); color: #fff; border-color: var(--primary); }
.radio-pills label:hover { border-color: var(--accent); }

.img-prev { max-width: 200px; max-height: 120px; border-radius: 8px; margin-bottom: 8px; display: block; }
.video-prev { aspect-ratio: 16/9; max-width: 500px; border-radius: 10px; overflow: hidden; }
.video-prev iframe { width: 100%; height: 100%; border: 0; }

/* ============ GALLERY ADMIN ============ */
.gallery-admin, .videos-admin {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 16px;
}
.g-card, .v-card {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    position: relative;
    transition: all .2s;
}
.g-card:hover, .v-card:hover { box-shadow: var(--shadow); transform: translateY(-2px); }
.g-card.featured, .v-card.principal { border-color: var(--warning); box-shadow: 0 0 0 2px rgba(245,158,11,.2); }
.g-thumb, .v-thumb {
    aspect-ratio: 4/3;
    background: var(--bg);
    position: relative;
    overflow: hidden;
}
.g-thumb img, .v-thumb img { width: 100%; height: 100%; object-fit: cover; }
.v-thumb i {
    position: absolute;
    inset: 0;
    margin: auto;
    width: 60px; height: 60px;
    background: rgba(0,0,0,.75);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    color: #fff;
    font-size: 1.4rem;
}
.g-badge {
    position: absolute; top: 10px; left: 10px;
    background: var(--warning); color: #fff;
    padding: 4px 10px;
    border-radius: 100px;
    font-size: 0.72rem;
    font-weight: 600;
    z-index: 2;
}
.g-body { padding: 14px; }
.g-body h4 { font-size: 0.98rem; margin-bottom: 4px; }
.g-body p { font-size: 0.82rem; color: var(--muted); margin-bottom: 6px; }
.g-body small { display: block; color: var(--muted); font-size: 0.75rem; }
.g-body code { background: var(--bg); padding: 2px 6px; border-radius: 4px; font-size: 0.78rem; }
.g-actions {
    padding: 10px 14px;
    border-top: 1px solid var(--border);
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

/* ============ RESPONSIVE ============ */
@media (max-width: 900px) {
    .row { grid-template-columns: 1fr; }
    .form-grid { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        box-shadow: 10px 0 30px rgba(0,0,0,.2);
    }
    .sidebar.open { transform: translateX(0); }
    .main-content { margin-left: 0; }
    .burger { display: block; }
    .content-wrap { padding: 18px; }
    .stats-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 480px) {
    .stats-grid { grid-template-columns: 1fr; }
    .user-text { display: none; }
    .panel { padding: 18px; }
}
