/* ============================================================
   ACADEMIKA PLUS — CARDS & GLASSMORPHISM SYSTEM
   Requires: variables.css loaded first
   Covers: Cards · Page Backgrounds · Sidebar · Headers
   ============================================================ */


/* ══════════════════════════════════════════════════════════
   1. PAGE BACKGROUND
   ══════════════════════════════════════════════════════════ */

body {
    background: linear-gradient(135deg, #020e07 0%, #0b1a0f 50%, #002411 100%);
    background-attachment: fixed;
    background-color: #020e07;
}

:root:not(.dark) body,
.light body {
    background: linear-gradient(135deg, #eef6f1 0%, #e5fff1 100%);
    background-attachment: fixed;
    background-color: #eef6f1;
}


/* ══════════════════════════════════════════════════════════
   2. CARD BASE — glassmorphism
   ══════════════════════════════════════════════════════════ */

.card {
    background: rgba(255, 255, 255, 0.06);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border: 1px solid rgba(255, 255, 255, 0.22);
    border-radius: var(--radius-lg);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.30);
    padding: 24px;
    transition: var(--transition-base);
    position: relative;
    overflow: hidden;
}

:root:not(.dark) .card {
    background: rgba(255, 255, 255, 0.80);
    border-color: rgba(18, 22, 41, 0.14);
    box-shadow: 0 4px 20px rgba(18, 22, 41, 0.07);
}

/* ─── Card interactiva (hover) ─── */
.card-interactive {
    cursor: pointer;
}

.card-interactive:hover {
    border-color: rgba(0, 146, 69, 0.40);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.20);
    transform: translateY(-2px);
}

:root:not(.dark) .card-interactive:hover {
    box-shadow: 0 6px 30px rgba(0, 146, 69, 0.12);
}

/* ─── Card header / footer ─── */
.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 20px;
    padding-bottom: 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

:root:not(.dark) .card-header {
    border-bottom-color: rgba(18, 22, 41, 0.08);
}

.card-title {
    font-size: 1rem;
    font-weight: 700;
    line-height: 1.3;
}

.card-subtitle {
    font-size: 0.8rem;
    opacity: 0.55;
    margin-top: 2px;
}

.card-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
    padding-top: 14px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

:root:not(.dark) .card-footer {
    border-top-color: rgba(18, 22, 41, 0.08);
}


/* ══════════════════════════════════════════════════════════
   3. VARIANTES DE CARD
   ══════════════════════════════════════════════════════════ */

/* ─── card-flat: para listas largas (sin blur, mejor rendimiento) ─── */
.card-flat {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: var(--radius-md);
    padding: 20px;
    transition: var(--transition-fast);
}

:root:not(.dark) .card-flat {
    background: rgba(255, 255, 255, 0.70);
    border-color: rgba(18, 22, 41, 0.12);
}

/* ─── card-highlight: borde acento (ej: servicio Popular) ─── */
.card-highlight {
    background: rgba(255, 255, 255, 0.06);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border: 1px solid rgba(0, 146, 69, 0.55);
    border-left: 3px solid var(--color-primary);
    border-radius: var(--radius-lg);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.30), 0 0 0 1px rgba(0, 146, 69, 0.15) inset;
    padding: 24px;
    transition: var(--transition-base);
}

:root:not(.dark) .card-highlight {
    background: rgba(255, 255, 255, 0.85);
    border-color: rgba(0, 146, 69, 0.35);
    box-shadow: 0 4px 24px rgba(0, 146, 69, 0.10);
}

/* ─── card-stat: métricas y dashboards ─── */
.card-stat {
    background: rgba(255, 255, 255, 0.06);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border: 1px solid rgba(255, 255, 255, 0.22);
    border-top: 3px solid var(--color-primary);
    border-radius: var(--radius-lg);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.25);
    padding: 24px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 8px;
    transition: var(--transition-base);
}

:root:not(.dark) .card-stat {
    background: rgba(255, 255, 255, 0.85);
    border-color: rgba(18, 22, 41, 0.12);
    box-shadow: 0 4px 20px rgba(18, 22, 41, 0.07);
}

.card-stat-icon {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    margin-bottom: 4px;
    background: rgba(0, 146, 69, 0.15);
    color: var(--color-primary);
}

.card-stat-value {
    font-size: 2rem;
    font-weight: 800;
    line-height: 1;
    letter-spacing: -0.5px;
}

.card-stat-label {
    font-size: 0.78rem;
    opacity: 0.60;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Variantes de color para card-stat */
.card-stat.stat-blue {
    border-top-color: var(--color-lblue);
}

.card-stat.stat-blue .card-stat-icon {
    background: rgba(74, 175, 233, 0.15);
    color: var(--color-lblue);
}

.card-stat.stat-warning {
    border-top-color: var(--color-warning);
}

.card-stat.stat-warning .card-stat-icon {
    background: rgba(224, 120, 0, 0.15);
    color: var(--color-warning);
}

.card-stat.stat-error {
    border-top-color: var(--color-error);
}

.card-stat.stat-error .card-stat-icon {
    background: rgba(204, 51, 0, 0.15);
    color: var(--color-error);
}

.card-stat.stat-lime {
    border-top-color: var(--color-lime);
}

.card-stat.stat-lime .card-stat-icon {
    background: rgba(126, 233, 12, 0.15);
    color: var(--color-lime);
}


/* ══════════════════════════════════════════════════════════
   4. PANEL SECTION — contenedor genérico de sección
   ══════════════════════════════════════════════════════════ */

.panel-section {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.20);
    border-radius: var(--radius-lg);
    padding: 28px 24px;
    margin-bottom: 24px;
}

:root:not(.dark) .panel-section {
    background: rgba(255, 255, 255, 0.75);
    border-color: rgba(18, 22, 41, 0.12);
}

.panel-section-title {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    opacity: 0.45;
    margin-bottom: 16px;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}

:root:not(.dark) .panel-section-title {
    border-bottom-color: rgba(18, 22, 41, 0.08);
}


/* ══════════════════════════════════════════════════════════
   5. SIDEBAR DE PANELES (glass)
   ══════════════════════════════════════════════════════════ */

.sidebar-glass {
    background: rgba(2, 18, 12, 0.88);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-right: 1px solid rgba(0, 255, 119, 0.10);
    width: 240px;
    min-height: 100vh;
    flex-shrink: 0;
}

:root:not(.dark) .sidebar-glass {
    background: rgba(229, 255, 241, 0.92);
    border-right-color: rgba(0, 146, 69, 0.14);
}

/* ─── Ítem de menú del sidebar ─── */
.sidebar-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: var(--radius-md);
    margin: 3px 8px;
    color: rgba(255, 255, 255, 0.65);
    font-size: 0.9rem;
    font-weight: 500;
    text-decoration: none;
    transition: var(--transition-fast);
    border-left: 3px solid transparent;
    cursor: pointer;
}

:root:not(.dark) .sidebar-item {
    color: #555;
}

.sidebar-item:hover {
    background: rgba(0, 146, 69, 0.15);
    color: var(--color-primary);
    border-left-color: var(--color-primary);
    padding-left: 13px;
    text-decoration: none;
}

.sidebar-item.active,
.sidebar-item[aria-current="page"] {
    background: rgba(0, 146, 69, 0.20);
    color: var(--color-primary);
    font-weight: 700;
    border-left-color: var(--color-primary);
    padding-left: 13px;
}

.sidebar-item-icon {
    flex-shrink: 0;
    width: 18px;
    text-align: center;
    font-size: 0.95rem;
}

.sidebar-item-label {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Sidebar section header */
.sidebar-section-label {
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    opacity: 0.35;
    padding: 16px 24px 6px;
}


/* ══════════════════════════════════════════════════════════
   6. HEADER DE PANELES (glass)
   ══════════════════════════════════════════════════════════ */

.panel-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(18, 22, 41, 0.85);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    height: 64px;
    display: flex;
    align-items: center;
    padding: 0 24px;
    gap: 16px;
}

:root:not(.dark) .panel-header {
    background: rgba(255, 255, 255, 0.80);
    border-bottom-color: rgba(200, 210, 230, 0.70);
}


/* ══════════════════════════════════════════════════════════
   7. HEADER PÚBLICO (web principal — glass pill)
   ══════════════════════════════════════════════════════════ */

.public-header {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-radius: var(--radius-xl);
    box-shadow: 0 4px 20px rgba(18, 22, 41, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.90);
}

.dark .public-header {
    background: rgba(2, 18, 12, 0.92);
    border-color: rgba(0, 204, 95, 0.12);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.30);
}


/* ══════════════════════════════════════════════════════════
   8. DIVISOR / SEPARADOR
   ══════════════════════════════════════════════════════════ */

.divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.08);
    border: none;
    margin: 20px 0;
}

:root:not(.dark) .divider {
    background: rgba(18, 22, 41, 0.08);
}


/* ══════════════════════════════════════════════════════════
   9. BADGE / CHIP
   ══════════════════════════════════════════════════════════ */

.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: var(--radius-full);
    font-size: 0.73rem;
    font-weight: 700;
    line-height: 1;
    letter-spacing: 0.3px;
    white-space: nowrap;
}

.badge-success {
    background: var(--color-success-bg);
    color: var(--color-success);
    border: 1px solid rgba(0, 146, 69, 0.30);
}

.badge-error {
    background: var(--color-error-bg);
    color: var(--color-error);
    border: 1px solid rgba(204, 51, 0, 0.25);
}

.badge-warning {
    background: var(--color-warning-bg);
    color: var(--color-warning);
    border: 1px solid rgba(224, 120, 0, 0.25);
}

.badge-info {
    background: var(--color-info-bg);
    color: var(--color-info);
    border: 1px solid rgba(74, 175, 233, 0.25);
}

.badge-primary {
    background: rgba(0, 146, 69, 0.18);
    color: var(--color-primary);
    border: 1px solid rgba(0, 146, 69, 0.35);
}

.badge-dark {
    background: rgba(18, 22, 41, 0.25);
    color: rgba(255, 255, 255, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.12);
}

.badge-lime {
    background: var(--color-lime-light);
    color: #336600;
    border: 1px solid rgba(126, 233, 12, 0.40);
}

.dark .badge-lime {
    background: rgba(126, 233, 12, 0.15);
    color: var(--color-lime);
}


/* ══════════════════════════════════════════════════════════
   10. TABLE GLASS
   ══════════════════════════════════════════════════════════ */

.table-glass {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.table-glass thead th {
    padding: 10px 14px;
    text-align: left;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    opacity: 0.55;
    border-bottom: 1px solid rgba(255, 255, 255, 0.18);
    white-space: nowrap;
}

:root:not(.dark) .table-glass thead th {
    border-bottom-color: rgba(18, 22, 41, 0.12);
}

.table-glass tbody td {
    padding: 12px 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.10);
    vertical-align: middle;
}

:root:not(.dark) .table-glass tbody td {
    border-bottom-color: rgba(18, 22, 41, 0.08);
}

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

.table-glass tbody tr {
    transition: var(--transition-fast);
}

.table-glass tbody tr:hover {
    background: rgba(255, 255, 255, 0.04);
}

:root:not(.dark) .table-glass tbody tr:hover {
    background: rgba(0, 146, 69, 0.04);
}