/* 
   ========================================================================
   ANTIGRAVITY V2 - MODERN CBT DESIGN SYSTEM
   ========================================================================
   Author: ZYA CBT Redesign Initiative
   Framework: Bootstrap 5
   ========================================================================
*/

:root {
    --ag-primary: #2563eb;
    --ag-primary-hover: #1d4ed8;
    --ag-primary-light: #eff6ff;
    
    --ag-secondary: #0f172a;
    --ag-secondary-light: #1e293b;
    
    --ag-success: #22c55e;
    --ag-success-light: #f0fdf4;
    
    --ag-warning: #f59e0b;
    --ag-warning-light: #fffbeb;
    
    --ag-danger: #ef4444;
    --ag-danger-light: #fef2f2;
    
    --ag-bg-body: #edf1f6;
    --ag-bg-card: #f9fafb;
    --ag-text-main: #334155;
    --ag-text-muted: #64748b;
    --ag-border: #e2e8f0;
    
    --ag-sidebar-bg: #0f172a;
    --ag-sidebar-text: #cbd5e1;
    --ag-sidebar-active-bg: #1e293b;
    --ag-sidebar-active-text: #ffffff;
    --ag-sidebar-hover-bg: rgba(255, 255, 255, 0.05);

    --ag-shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --ag-shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --ag-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    
    --ag-radius-sm: 0.375rem;
    --ag-radius-md: 0.5rem;
    --ag-radius-lg: 0.75rem;
    --ag-radius-xl: 1rem;
    
    --ag-transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Dark Mode Variables */
html.ag-dark body {
    --ag-bg-body: #0f172a;
    --ag-bg-card: #1e293b;
    --ag-text-main: #f8fafc;
    --ag-text-muted: #94a3b8;
    --ag-border: #334155;
    --ag-sidebar-bg: #0b1120;
}

/* Global Dark Mode Overrides for Legacy AdminLTE Elements */
html.ag-dark body .content-wrapper,
html.ag-dark body .right-side {
    background-color: var(--ag-bg-body) !important;
}
html.ag-dark body .box,
html.ag-dark body .info-box,
html.ag-dark body .bg-white,
html.ag-dark body .bg-light,
html.ag-dark body .modern-card {
    background-color: var(--ag-bg-card) !important;
    color: var(--ag-text-main) !important;
    border-color: var(--ag-border) !important;
}
html.ag-dark body .bg-light {
    background-color: rgba(0,0,0,0.2) !important;
}
html.ag-dark body .text-primary {
    color: #60a5fa !important;
}
html.ag-dark body .box-header,
html.ag-dark body .box-footer {
    border-color: var(--ag-border) !important;
    color: var(--ag-text-main) !important;
}
html.ag-dark body .table-bordered,
html.ag-dark body .table-bordered>thead>tr>th, 
html.ag-dark body .table-bordered>tbody>tr>th, 
html.ag-dark body .table-bordered>tfoot>tr>th, 
html.ag-dark body .table-bordered>thead>tr>td, 
html.ag-dark body .table-bordered>tbody>tr>td, 
html.ag-dark body .table-bordered>tfoot>tr>td {
    border-color: var(--ag-border) !important;
}
html.ag-dark body .table-hover>tbody>tr:hover {
    background-color: rgba(255, 255, 255, 0.05) !important;
}
html.ag-dark body .table-striped>tbody>tr:nth-of-type(odd) {
    background-color: rgba(255, 255, 255, 0.02) !important;
}
html.ag-dark body .form-control {
    background-color: #0b1120 !important;
    color: var(--ag-text-main) !important;
    border-color: var(--ag-border) !important;
}
html.ag-dark body .modal-content {
    background-color: var(--ag-bg-card) !important;
    color: var(--ag-text-main) !important;
    border-color: var(--ag-border) !important;
}
html.ag-dark body .modal-header,
html.ag-dark body .modal-footer {
    border-color: var(--ag-border) !important;
}

body {
    background-color: var(--ag-bg-body);
    color: var(--ag-text-main);
    font-family: 'Inter', 'Outfit', system-ui, -apple-system, sans-serif;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

/* =========================================
   LAYOUT WRAPPER (SIDEBAR + CONTENT)
   ========================================= */
.ag-wrapper {
    display: flex;
    min-height: 100vh;
    width: 100%;
}

/* SIDEBAR */
.ag-sidebar {
    width: 260px;
    background-color: var(--ag-sidebar-bg);
    color: var(--ag-sidebar-text);
    flex-shrink: 0;
    transition: var(--ag-transition);
    z-index: 1000;
    display: flex;
    flex-direction: column;
}
.ag-sidebar-logo {
    height: 70px;
    display: flex;
    align-items: center;
    padding: 0 24px;
    font-size: 1.25rem;
    font-weight: 700;
    color: white;
    text-decoration: none;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}
.ag-sidebar-logo:hover {
    color: white;
}
.ag-sidebar-menu-container {
    padding: 20px 15px;
    overflow-y: auto;
    flex-grow: 1;
}

/* LEGACY MENU SUPPORT (From Users_model.php) */
.sidebar-menu {
    list-style: none;
    padding: 0;
    margin: 0;
}
.sidebar-menu > li.header {
    color: #64748b;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 10px 15px;
    margin-top: 10px;
}
.sidebar-menu > li > a {
    display: flex;
    align-items: center;
    color: var(--ag-sidebar-text);
    padding: 12px 15px;
    border-radius: var(--ag-radius-md);
    text-decoration: none;
    transition: var(--ag-transition);
    font-weight: 500;
    margin-bottom: 4px;
}
.sidebar-menu > li > a > i:first-child {
    width: 24px;
    font-size: 1.1rem;
    text-align: center;
    margin-right: 10px;
}
.sidebar-menu > li:hover > a {
    background-color: var(--ag-sidebar-hover-bg);
    color: var(--ag-sidebar-active-text);
}
.sidebar-menu > li.active > a {
    background-color: var(--ag-primary);
    color: white;
    box-shadow: var(--ag-shadow-md);
}

/* Treeview Support */
.sidebar-menu .treeview-menu {
    list-style: none;
    padding: 0;
    margin: 0;
    display: none;
    padding-left: 34px;
    padding-top: 5px;
    padding-bottom: 5px;
}
.sidebar-menu .treeview.active > a > .fa-angle-left {
    transform: rotate(-90deg);
}
.sidebar-menu .treeview-menu > li > a {
    color: var(--ag-sidebar-text);
    padding: 8px 10px;
    font-size: 0.9rem;
    text-decoration: none;
    transition: var(--ag-transition);
    border-radius: var(--ag-radius-md);
}
.sidebar-menu .treeview-menu > li > a:hover {
    color: white;
    background-color: transparent;
    padding-left: 15px;
}
.sidebar-menu .treeview-menu > li.active > a {
    color: white;
    font-weight: 600;
}
.sidebar-menu .treeview-menu > li > a > i {
    font-size: 0.5rem;
    margin-right: 8px;
    vertical-align: middle;
}
.fa-angle-left {
    margin-left: auto;
    transition: transform 0.3s ease;
}
.treeview.active > a > .fa-angle-left {
    transform: rotate(-90deg);
}

/* MAIN CONTENT AREA */
.ag-main {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    transition: var(--ag-transition);
}

/* TOPBAR */
.ag-topbar {
    height: 70px;
    background-color: var(--ag-bg-card);
    border-bottom: 1px solid var(--ag-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 999;
}
.ag-topbar-left, .ag-topbar-right {
    display: flex;
    align-items: center;
    gap: 15px;
}
.ag-btn-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--ag-text-muted);
    background: transparent;
    border: none;
    transition: var(--ag-transition);
    cursor: pointer;
}
.ag-btn-icon:hover {
    background-color: rgba(0,0,0,0.05);
    color: var(--ag-primary);
}
html.ag-dark body .ag-btn-icon:hover {
    background-color: rgba(255,255,255,0.05);
}

/* Search Box */
.ag-search {
    position: relative;
    display: none;
}
@media (min-width: 768px) {
    .ag-search { display: block; }
}
.ag-search input {
    background-color: var(--ag-bg-body);
    border: 1px solid transparent;
    padding: 8px 16px 8px 40px;
    border-radius: 20px;
    color: var(--ag-text-main);
    transition: var(--ag-transition);
    width: 250px;
}
.ag-search input:focus {
    outline: none;
    border-color: var(--ag-primary);
    background-color: var(--ag-bg-card);
    box-shadow: 0 0 0 3px var(--ag-primary-light);
}
html.ag-dark body .ag-search input:focus {
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.3);
}
.ag-search i {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--ag-text-muted);
}

/* CONTENT CONTAINER */
.ag-content-wrapper {
    padding: 24px;
    flex-grow: 1;
}

/* TYPOGRAPHY */
h1, h2, h3, h4, h5, h6 {
    color: var(--ag-text-main);
    font-weight: 600;
}
.ag-page-title {
    font-size: 1.5rem;
    margin-bottom: 0.25rem;
}
.ag-breadcrumb {
    color: var(--ag-text-muted);
    font-size: 0.875rem;
    margin-bottom: 24px;
}
.ag-breadcrumb a {
    color: var(--ag-text-muted);
    text-decoration: none;
}
.ag-breadcrumb a:hover {
    color: var(--ag-primary);
}

/* CARDS */
.ag-card {
    background-color: var(--ag-bg-card);
    border: 1px solid var(--ag-border);
    border-radius: var(--ag-radius-lg);
    box-shadow: var(--ag-shadow-sm);
    margin-bottom: 24px;
}
.ag-card-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--ag-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.ag-card-title {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
}
.ag-card-body {
    padding: 20px;
}

/* TABLES */
.ag-table {
    width: 100%;
    margin-bottom: 0;
    color: var(--ag-text-main);
}
.ag-table th {
    background-color: var(--ag-bg-body);
    color: var(--ag-text-muted);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--ag-border);
    padding: 12px 16px;
}
.ag-table td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--ag-border);
    vertical-align: middle;
}
.ag-table tbody tr:hover {
    background-color: rgba(0,0,0,0.01);
}
html.ag-dark body .ag-table tbody tr:hover {
    background-color: rgba(255,255,255,0.02);
}

/* BUTTONS */
.btn-ag-primary {
    background-color: var(--ag-primary);
    color: white;
    border: none;
    border-radius: var(--ag-radius-md);
    padding: 8px 16px;
    font-weight: 500;
    transition: var(--ag-transition);
}
.btn-ag-primary:hover {
    background-color: var(--ag-primary-hover);
    color: white;
    box-shadow: 0 4px 6px -1px rgba(37, 99, 235, 0.2);
}

/* MOBILE TOGGLE */
@media (max-width: 991.98px) {
    .ag-sidebar {
        position: fixed;
        left: -260px;
        height: 100vh;
    }
    .ag-sidebar.show {
        left: 0;
        box-shadow: var(--ag-shadow-lg);
    }
}

/* Fix transparent images (grafik) in dark mode */
body.dark-mode img, body.ag-dark img {
    background-color: rgba(255, 255, 255, 0.9);
    border-radius: 4px;
}

/* Antigravity V2 Dark Mode Overrides for Bootstrap 5 & Tables */
html.ag-dark body,
html.ag-dark body .content-wrapper,
html.ag-dark body .right-side,
html.ag-dark body .main-footer {
    background-color: var(--ag-bg-body) !important;
    color: var(--ag-text-main) !important;
}

html.ag-dark body .card,
html.ag-dark body .box,
html.ag-dark body .info-box,
html.ag-dark body .modern-card {
    background-color: var(--ag-bg-card) !important;
    color: var(--ag-text-main) !important;
    border-color: var(--ag-border) !important;
}

html.ag-dark body .card-header,
html.ag-dark body .card-body,
html.ag-dark body .card-footer,
html.ag-dark body .box-header,
html.ag-dark body .box-body,
html.ag-dark body .box-footer,
html.ag-dark body .bg-white {
    background-color: transparent !important;
    color: var(--ag-text-main) !important;
    border-color: var(--ag-border) !important;
}

html.ag-dark body .list-group-item {
    background-color: transparent !important;
    color: var(--ag-text-main) !important;
    border-color: var(--ag-border) !important;
}
html.ag-dark body .list-group-item .text-muted {
    color: var(--ag-text-muted) !important;
}

/* Tables, rows, and cells robust overrides */
html.ag-dark body .table,
html.ag-dark body .table-responsive,
html.ag-dark body .table>thead>tr>th,
html.ag-dark body .table>tbody>tr>th,
html.ag-dark body .table>tfoot>tr>th,
html.ag-dark body .table>thead>tr>td,
html.ag-dark body .table>tbody>tr>td,
html.ag-dark body .table>tfoot>tr>td,
html.ag-dark body .card .table,
html.ag-dark body .box .table {
    background-color: transparent !important;
    color: var(--ag-text-main) !important;
    border-color: var(--ag-border) !important;
}

/* Striped table row colors */
html.ag-dark body .table-striped>tbody>tr:nth-of-type(odd),
html.ag-dark body .table-striped>tbody>tr:nth-of-type(odd)>td,
html.ag-dark body .table-striped>tbody>tr:nth-of-type(odd)>th,
html.ag-dark body table.dataTable tbody tr.odd,
html.ag-dark body table.dataTable tbody tr.odd>td,
html.ag-dark body table.dataTable tbody tr.odd>th,
html.ag-dark body .odd,
html.ag-dark body .odd>td,
html.ag-dark body .odd>th {
    background-color: rgba(255, 255, 255, 0.03) !important;
}

html.ag-dark body .table-striped>tbody>tr:nth-of-type(even),
html.ag-dark body .table-striped>tbody>tr:nth-of-type(even)>td,
html.ag-dark body .table-striped>tbody>tr:nth-of-type(even)>th,
html.ag-dark body table.dataTable tbody tr.even,
html.ag-dark body table.dataTable tbody tr.even>td,
html.ag-dark body table.dataTable tbody tr.even>th,
html.ag-dark body .even,
html.ag-dark body .even>td,
html.ag-dark body .even>th {
    background-color: transparent !important;
}

html.ag-dark body .table-hover>tbody>tr:hover,
html.ag-dark body .table-hover>tbody>tr:hover>td,
html.ag-dark body .table-hover>tbody>tr:hover>th {
    background-color: rgba(255, 255, 255, 0.08) !important;
}

/* Form controls & pre/code formatting */
html.ag-dark body pre {
    background-color: #0b1120 !important;
    color: var(--ag-text-main) !important;
    border-color: var(--ag-border) !important;
}

/* DataTables pagination & search inputs in Dark Mode */
html.ag-dark body .dataTables_wrapper,
html.ag-dark body .dataTables_wrapper label,
html.ag-dark body .dataTables_wrapper .dataTables_info,
html.ag-dark body .dataTables_wrapper .dataTables_paginate {
    color: var(--ag-text-main) !important;
}
html.ag-dark body .dataTables_wrapper select,
html.ag-dark body .dataTables_wrapper input {
    background-color: #0b1120 !important;
    color: var(--ag-text-main) !important;
    border: 1px solid var(--ag-border) !important;
    border-radius: var(--ag-radius-sm) !important;
}
html.ag-dark body .page-link {
    background-color: var(--ag-bg-card) !important;
    color: var(--ag-text-main) !important;
    border-color: var(--ag-border) !important;
}
html.ag-dark body .page-item.active .page-link {
    background-color: #3b82f6 !important;
    border-color: #3b82f6 !important;
    color: #fff !important;
}
html.ag-dark body .page-item.disabled .page-link {
    background-color: rgba(255, 255, 255, 0.02) !important;
    color: var(--ag-text-muted) !important;
    border-color: var(--ag-border) !important;
}


