/**
 * QuizOpos Theme Base Styles
 * Basado en variables CSS para personalización dinámica.
 */

/* 1. Reset & Base */
body {
    font-family: var(--qo-font-base);
    background-color: var(--qo-background);
    color: var(--qo-text);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6, .h1, .h2, .h3, .h4, .h5, .h6 {
    font-family: var(--qo-font-heading);
    font-weight: 600;
    color: var(--qo-primary);
}

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

a:hover {
    color: var(--qo-secondary);
}

/* 2. Botones */
.btn {
    font-family: var(--qo-font-heading);
    font-weight: 500;
    border-radius: var(--qo-border-radius);
    padding: 0.6rem 1.5rem;
    transition: all 0.3s ease;
}

.btn-primary {
    background-color: var(--qo-primary);
    border-color: var(--qo-primary);
}

.btn-primary:hover, .btn-primary:focus {
    background-color: var(--qo-secondary);
    border-color: var(--qo-secondary);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(2, 37, 93, 0.2);
}

.btn-success { background-color: var(--qo-success); border-color: var(--qo-success); }
.btn-warning { background-color: var(--qo-warning); border-color: var(--qo-warning); color: #fff; }
.btn-danger { background-color: var(--qo-error); border-color: var(--qo-error); }
.btn-info { background-color: var(--qo-info); border-color: var(--qo-info); color: #fff; }

/* 3. Sidebar */
.sidebar {
    width: var(--qo-sidebar-width);
    background-color: var(--qo-primary);
    color: #ffffff;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar .nav-link {
    color: rgba(255, 255, 255, 0.7);
    font-family: var(--qo-font-heading);
}

.sidebar .nav-link:hover, .sidebar .nav-link.active {
    color: #ffffff;
    background-color: rgba(255, 255, 255, 0.1);
}

/* 4. Header / Navbar */
.navbar {
    background-color: var(--qo-background) !important;
    border-bottom: 1px solid var(--qo-border);
    height: 70px;
}

/* 5. Tarjetas (Cards) */
.card {
    border: 1px solid var(--qo-border);
    border-radius: var(--qo-border-radius);
    box-shadow: var(--qo-card-shadow);
    background-color: var(--qo-background);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card-header {
    background-color: transparent;
    border-bottom: 1px solid var(--qo-border);
    padding: 1.25rem;
}

/* 6. Tablas */
.table {
    color: var(--qo-text);
}

.table thead th {
    background-color: #f8f9fa;
    color: var(--qo-muted);
    font-family: var(--qo-font-heading);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 2px solid var(--qo-border);
}

/* 7. Formularios */
.form-control, .form-select {
    border-radius: var(--qo-border-radius);
    border: 1px solid var(--qo-border);
    padding: 0.6rem 1rem;
}

.form-control:focus {
    border-color: var(--qo-primary);
    box-shadow: 0 0 0 0.25rem rgba(2, 37, 93, 0.1);
}

/* 8. Badges */
.badge {
    border-radius: 6px;
    padding: 0.4em 0.8em;
    font-weight: 500;
}

.bg-primary { background-color: var(--qo-primary) !important; }
.bg-secondary { background-color: var(--qo-secondary) !important; }

/* 9. Alertas */
.alert {
    border-radius: var(--qo-border-radius);
    border: none;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}

/* 10. Modales */
.modal-content {
    border-radius: var(--qo-border-radius);
    border: none;
    box-shadow: 0 20px 50px rgba(0,0,0,0.15);
}

/* 11. Utilidades */
.text-primary { color: var(--qo-primary) !important; }
.text-secondary { color: var(--qo-secondary) !important; }
.text-muted { color: var(--qo-muted) !important; }

.rounded-4 { border-radius: var(--qo-border-radius) !important; }

/* Animación de entrada */
.fade-in {
    animation: fadeIn 0.4s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/**
 * 12. MODO OSCURO (Preparación Arquitectónica)
 * Estas variables se activarán cuando se añada [data-theme="dark"] al <html>
 */
[data-theme="dark"] {
    --qo-background: #0f172a;
    --qo-text: #f8fafc;
    --qo-border: #1e293b;
    --qo-muted: #94a3b8;
    
    /* Colores ajustados para contraste en modo oscuro */
    --qo-primary: #38bdf8;
    --qo-secondary: #22d3ee;
    
    .card, .navbar, .modal-content {
        background-color: #1e293b !important;
        border-color: #334155;
    }

    .table thead th {
        background-color: #0f172a;
        border-bottom-color: #334155;
    }

    .form-control, .form-select {
        background-color: #0f172a;
        border-color: #334155;
        color: #f8fafc;
    }

    .sidebar {
        background-color: #020617;
    }
}

/* ============================================================
   COMPONENTES QO - Biblioteca de Componentes del Theme
   ============================================================ */

/* --- .qo-badge --- */
.badge-qo {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.75rem;
    font-weight: 600;
    font-family: var(--qo-font-heading);
    padding: 0.35em 0.75em;
    border-radius: 20px;
    white-space: nowrap;
}

.badge-qo-borrador  { background: rgba(108,117,125,0.12); color: #495057; border: 1px solid rgba(108,117,125,0.2); }
.badge-qo-revisada  { background: rgba(13,202,240,0.12);  color: #0a7887; border: 1px solid rgba(13,202,240,0.2); }
.badge-qo-publicada { background: rgba(2,94,55,0.1);      color: #025e37; border: 1px solid rgba(2,94,55,0.2); }
.badge-qo-archivada { background: rgba(33,37,41,0.1);     color: #343a40; border: 1px solid rgba(33,37,41,0.2); }
.badge-qo-activo    { background: rgba(2,94,55,0.1);      color: #025e37; border: 1px solid rgba(2,94,55,0.2); }
.badge-qo-inactivo  { background: rgba(220,53,69,0.1);    color: #dc3545; border: 1px solid rgba(220,53,69,0.2); }
.badge-qo-error     { background: rgba(220,53,69,0.1);    color: #dc3545; border: 1px solid rgba(220,53,69,0.2); }
.badge-qo-aviso     { background: rgba(224,148,2,0.12);   color: #8a5700; border: 1px solid rgba(224,148,2,0.25); }
.badge-qo-correcta  { background: rgba(2,94,55,0.1);      color: #025e37; border: 1px solid rgba(2,94,55,0.2); }
.badge-qo-duplicada { background: rgba(224,148,2,0.12);   color: #8a5700; border: 1px solid rgba(224,148,2,0.25); }
.badge-qo-omitida   { background: rgba(108,117,125,0.12); color: #495057; border: 1px solid rgba(108,117,125,0.2); }

/* --- .qo-card --- */
.qo-card {
    background: var(--qo-background);
    border: 1px solid var(--qo-border);
    border-radius: var(--qo-border-radius);
    box-shadow: var(--qo-card-shadow);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.qo-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 30px rgba(0,0,0,0.1);
}

/* --- .qo-stat-card --- */
.qo-stat-card .stat-card-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

/* --- .qo-page-header --- */
.qo-page-header,
.page-header-qo {
    padding: 1.5rem 0 1rem;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--qo-border);
}
.page-header-qo .page-title {
    font-family: var(--qo-font-heading);
    font-weight: 700;
    color: var(--qo-primary);
    margin-bottom: 0.25rem;
}
.page-header-qo .page-subtitle {
    color: var(--qo-muted);
    font-size: 0.95rem;
    margin-bottom: 0;
}

/* --- .qo-empty-state --- */
.qo-empty-state,
.empty-state {
    text-align: center;
    padding: 3rem 2rem;
}
.empty-state-icon-wrapper {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: rgba(2, 37, 93, 0.06);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.5rem;
    font-size: 2rem;
    color: var(--qo-primary);
}
.empty-state-title {
    font-family: var(--qo-font-heading);
    font-weight: 600;
    color: var(--qo-primary);
    font-size: 1.15rem;
    margin-bottom: 0.5rem;
}
.empty-state-text {
    color: var(--qo-muted);
    font-size: 0.9rem;
    max-width: 360px;
    margin: 0 auto 1rem;
}

/* --- .qo-action-toolbar --- */
.qo-action-toolbar,
.action-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background: var(--qo-background);
    border: 1px solid var(--qo-border);
    border-radius: var(--qo-border-radius);
}

/* --- .qo-filter-bar --- */
.qo-filter-bar .form-label,
.filter-bar-card .form-label {
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--qo-primary);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 0.4rem;
}

/* --- .qo-form-section / .qo-section-title --- */
.qo-section-title {
    margin-bottom: 1rem;
}
.qo-form-section {
    padding-top: 1.25rem;
    border-top: 1px solid var(--qo-border);
    margin-top: 1.25rem;
}

/* --- .qo-table --- */
.qo-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}
.qo-table thead th {
    background: #f8f9fa;
    color: var(--qo-muted);
    font-family: var(--qo-font-heading);
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    padding: 0.85rem 1rem;
    border-bottom: 2px solid var(--qo-border);
    white-space: nowrap;
}
.qo-table tbody tr {
    transition: background 0.15s ease;
}
.qo-table tbody tr:hover {
    background: rgba(2, 37, 93, 0.025);
}
.qo-table tbody td {
    padding: 0.85rem 1rem;
    border-bottom: 1px solid var(--qo-border);
    vertical-align: middle;
}

/* --- .qo-loading --- */
.qo-loading {
    min-height: 80px;
}
.qo-loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(255,255,255,0.85);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

/* Quick Access Items (dashboard) */
.quick-access-item {
    background: #f8fafc;
    border: 1px solid var(--qo-border);
    transition: all 0.2s ease;
}
.quick-access-item:hover {
    background: var(--qo-background);
    border-color: var(--qo-primary);
    box-shadow: 0 4px 15px rgba(2,37,93,0.08);
    transform: translateX(4px);
}

/* Stat card accent bar */
.stat-card-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
