/* assets/css/style.css */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=Outfit:wght@400;500;600;700;800&display=swap');

/* =========================================
   CSS CUSTOM PROPERTIES & DESIGN TOKENS
   ========================================= */
:root {
    /* Tenant dynamic variables (overwritten via inline styles by database tenant configuration) */
    --tenant-primary: #ec4899;
    --tenant-secondary: #1e40af;
    --tenant-primary-rgb: 236, 72, 153;

    /* Premium Clean Light Mode */
    --bg-dark: #f8fafc;
    --bg-card: #ffffff;
    --text-main: #0f172a;
    --text-muted: #475569;
    --border-color: #e2e8f0;

    --success: #0f766e;
    --warning: #b45309;
    --danger: #be123c;
    --info: #0369a1;

    /* Font Families */
    --font-heading: 'Outfit', sans-serif;
    --font-body: 'Inter', sans-serif;

    /* Layout */
    --sidebar-width: 240px;
    --border-radius: 8px;
    --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.05), 0 1px 2px -1px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
}

/* =========================================
   RESET & BASE
   ========================================= */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    font-family: var(--font-body);
    font-size: 13px;
    line-height: 1.4;
    min-height: 100vh;
    width: 100%;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    font-family: var(--font-heading);
    font-weight: 600;
    letter-spacing: -0.01em;
    color: var(--text-main);
}

a {
    color: var(--tenant-primary);
    text-decoration: none;
    transition: var(--transition);
}

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

/* =========================================
   GLASS CARD COMPONENT
   ========================================= */
.glass-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 1rem;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}

.glass-card:hover {
    border-color: rgba(var(--tenant-primary-rgb), 0.3);
    box-shadow: var(--shadow-md);
}

/* =========================================
   BUTTON SYSTEM
   ========================================= */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.3rem;
    padding: 0.4rem 0.8rem;
    border-radius: 6px;
    font-family: var(--font-heading);
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    border: none;
    text-align: center;
    font-size: 0.8rem;
    white-space: nowrap;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    background: linear-gradient(135deg, var(--tenant-primary), var(--tenant-secondary));
    color: #ffffff;
}

.btn-primary:hover {
    transform: translateY(-0.5px);
    box-shadow: 0 2px 8px rgba(var(--tenant-primary-rgb), 0.15);
}

.btn-secondary {
    background: #f1f5f9;
    color: var(--text-main);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: #e2e8f0;
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-danger:hover {
    background: #a30a30;
}

/* =========================================
   FORM ELEMENTS
   ========================================= */
.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.35rem;
    font-weight: 500;
    color: var(--text-muted);
    font-size: 0.85rem;
}

.form-control {
    width: 100%;
    padding: 0.4rem 0.6rem;
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-main);
    font-family: var(--font-body);
    font-size: 0.85rem;
    transition: var(--transition);
}

.form-control:focus {
    outline: none;
    border-color: var(--tenant-primary);
    box-shadow: 0 0 0 2px rgba(var(--tenant-primary-rgb), 0.1);
}

/* =========================================
   SIDEBAR
   ========================================= */
.dashboard-container {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: var(--sidebar-width);
    background: linear-gradient(180deg, var(--tenant-secondary) 0%, #0f172a 100%);
    border-right: none;
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    z-index: 200;
    transition: width 0.25s ease, transform 0.25s ease;
    box-shadow: 4px 0 15px rgba(0,0,0,0.05);
}

.sidebar-brand {
    padding: 1rem 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-logo {
    max-height: 32px;
    max-width: 100px;
    object-fit: contain;
}

.sidebar-menu {
    list-style: none;
    padding: 0.75rem 0.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    flex-grow: 1;
    overflow-y: auto;
}

.sidebar-menu::-webkit-scrollbar {
    width: 5px;
}

.sidebar-menu::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar-menu::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 10px;
}

.sidebar-menu::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

.sidebar-heading {
    color: rgba(255, 255, 255, 0.4);
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin: 1.25rem 0.75rem 0.25rem 0.75rem;
}

.sidebar-item a {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.6rem 0.75rem;
    border-radius: 8px;
    color: rgba(255, 255, 255, 0.7);
    font-weight: 500;
    font-size: 0.85rem;
    white-space: nowrap;
    transition: all 0.2s ease;
}

.sidebar-item a:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.1);
    transform: translateX(4px);
}

.sidebar-item.active a {
    background: var(--tenant-primary);
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(var(--tenant-primary-rgb), 0.4);
}

.sidebar-footer {
    padding: 1.25rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    background: #f8fafc;
}

/* =========================================
   MAIN CONTENT
   ========================================= */
.main-content {
    margin-left: var(--sidebar-width);
    flex-grow: 1;
    padding: 1.5rem;
    min-height: 100vh;
    transition: margin-left 0.25s ease;
}

/* =========================================
   TOP NAV
   ========================================= */
.top-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 1.5rem;
    margin: -1.5rem -1.5rem 1.5rem -1.5rem;
    gap: 1rem;
    flex-wrap: wrap;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    position: sticky;
    top: 0;
    z-index: 999;
}

/* =========================================
   METRIC CARDS
   ========================================= */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.metric-card {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.metric-icon {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    background: rgba(var(--tenant-primary-rgb), 0.06);
    color: var(--tenant-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
}

.metric-val {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-main);
}

.metric-label {
    color: var(--text-muted);
    font-size: 0.8rem;
}

/* =========================================
   DATA TABLES
   ========================================= */
.table-container {
    overflow-x: auto;
    margin-top: 0.75rem;
}

table.custom-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    min-width: 550px;
}

table.custom-table th {
    padding: 0.75rem;
    color: var(--text-muted);
    border-bottom: 2px solid var(--border-color);
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    white-space: nowrap;
}

table.custom-table td {
    padding: 0.75rem;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-main);
}

table.custom-table tr:hover {
    background: #f8fafc;
}

/* =========================================
   BADGES
   ========================================= */
.badge {
    display: inline-block;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-success {
    background: rgba(15, 118, 110, 0.1);
    color: var(--success);
}

.badge-warning {
    background: rgba(180, 83, 9, 0.1);
    color: var(--warning);
}

.badge-danger {
    background: rgba(190, 18, 62, 0.1);
    color: var(--danger);
}

.badge-info {
    background: rgba(3, 105, 161, 0.1);
    color: var(--info);
}

.badge-primary {
    background: rgba(29, 78, 216, 0.1);
    color: var(--tenant-primary);
}

.badge-secondary {
    background: rgba(100, 116, 139, 0.1);
    color: var(--text-muted);
}

/* =========================================
   LOGIN PAGE
   ========================================= */
.login-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 1.5rem;
}

.login-box {
    width: 100%;
    max-width: 400px;
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
}

/* =========================================
   EXAM RUNNER
   ========================================= */
.exam-runner {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 1.25rem;
    height: calc(100vh - 80px);
    overflow: hidden;
}

.exam-main-panel {
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    padding-right: 0.5rem;
}

.exam-sidebar-panel {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    height: 100%;
    overflow-y: auto;
}

.question-nav-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 0.5rem;
}

.q-btn {
    height: 34px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    border: 1px solid var(--border-color);
    background: #ffffff;
    color: var(--text-muted);
}

.q-btn:hover {
    border-color: var(--tenant-primary);
}

.q-btn.active {
    outline: 2px solid var(--tenant-primary);
}

.q-btn.answered {
    background: var(--success);
    color: white;
    border-color: var(--success);
}

.q-btn.flagged {
    background: var(--warning);
    color: white;
    border-color: var(--warning);
}

.q-btn.unvisited {
    background: #f1f5f9;
}

/* =========================================
   QUESTION OPTIONS
   ========================================= */
.option-label {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    background: #f8fafc;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    cursor: pointer;
    transition: var(--transition);
    margin-bottom: 0.5rem;
    color: var(--text-main);
}

.option-label:hover {
    background: rgba(var(--tenant-primary-rgb), 0.04);
    border-color: rgba(var(--tenant-primary-rgb), 0.2);
}

.option-label.selected {
    background: rgba(var(--tenant-primary-rgb), 0.06);
    border-color: var(--tenant-primary);
    font-weight: 600;
}

/* =========================================
   TIMER
   ========================================= */
.timer-container {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-main);
}

.timer-bar {
    width: 100%;
    height: 5px;
    background: #e2e8f0;
    border-radius: 3px;
    overflow: hidden;
    margin-top: 0.35rem;
}

.timer-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--success), var(--warning), var(--danger));
    width: 100%;
    transition: width 1s linear;
}

/* =========================================
   COLLAPSED SIDEBAR
   ========================================= */
body.collapsed-sidebar .sidebar {
    width: 60px;
}

body.collapsed-sidebar .main-content {
    margin-left: 60px;
}

body.collapsed-sidebar .sidebar-brand span,
body.collapsed-sidebar .sidebar-brand img,
body.collapsed-sidebar .sidebar-item span,
body.collapsed-sidebar .sidebar-heading,
body.collapsed-sidebar .sidebar-footer {
    display: none !important;
}

body.collapsed-sidebar .sidebar-brand {
    justify-content: center;
    padding: 1rem 0.25rem;
}

body.collapsed-sidebar .sidebar-item a {
    justify-content: center;
    padding: 0.6rem 0;
}

body.collapsed-sidebar .sidebar-menu {
    padding: 1rem 0.25rem;
}

/* =========================================
   PROFILE DROPDOWN
   ========================================= */
.profile-container {
    position: relative;
    display: inline-block;
}

.profile-trigger {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    padding: 0.35rem 0.75rem;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    transition: var(--transition);
}

.profile-trigger:hover {
    border-color: rgba(var(--tenant-primary-rgb), 0.3);
}

.profile-dropdown {
    display: none;
    position: absolute;
    right: 0;
    top: 100%;
    margin-top: 0.5rem;
    width: 200px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    z-index: 1000;
    padding: 0.5rem 0;
}

.profile-dropdown.show {
    display: block;
}

.profile-dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    color: var(--text-main);
    font-size: 0.85rem;
    transition: var(--transition);
}

.profile-dropdown-item:hover {
    background: rgba(var(--tenant-primary-rgb), 0.05);
    color: var(--tenant-primary);
}

/* =========================================
   MOBILE SIDEBAR OVERLAY
   ========================================= */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.35);
    z-index: 150;
    backdrop-filter: blur(2px);
}

.sidebar-overlay.show {
    display: block;
}

#mobile-menu-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    padding: 0.3rem;
    border-radius: 6px;
}

#mobile-menu-toggle:hover {
    background: var(--bg-dark);
    color: var(--text-main);
}

/* =========================================
   RESPONSIVE BREAKPOINTS
   ========================================= */

/* Tablet */
@media (max-width: 1024px) {
    .exam-runner {
        grid-template-columns: 1fr;
        height: auto;
        overflow: visible;
    }
}

/* Mobile */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        box-shadow: none;
    }

    .sidebar.mobile-open {
        transform: translateX(0);
        box-shadow: var(--shadow-lg);
    }

    .main-content {
        margin-left: 0 !important;
        padding: 1rem;
    }

    #mobile-menu-toggle {
        display: inline-flex;
    }

    .top-nav h1 {
        font-size: 1.2rem;
    }

    .metrics-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }

    .glass-card {
        padding: 1rem;
    }

    table.custom-table th,
    table.custom-table td {
        padding: 0.6rem;
        font-size: 0.8rem;
    }
}

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

    .login-box {
        max-width: 100%;
    }
}

/* =========================================
   LANDING PAGE (MARKETING)
   ========================================= */
.landing-page {
    background: #f8fafc;
    overflow-x: hidden;
}

/* Hero Section */
.hero-section {
    position: relative;
    overflow: hidden;
    background: linear-gradient(180deg, #ffffff 0%, #f1f5f9 100%);
    border-bottom: 1px solid var(--border-color);
}

.hero-blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    z-index: 1;
    opacity: 0.15;
}

.blob-1 {
    width: 400px;
    height: 400px;
    background: var(--tenant-primary);
    top: -100px;
    left: -100px;
}

.blob-2 {
    width: 300px;
    height: 300px;
    background: var(--tenant-secondary);
    bottom: -50px;
    right: -50px;
}

/* Features Grid */
.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
}

.feature-card {
    padding: 2rem;
    text-align: center;
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.feature-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
    border-color: rgba(var(--tenant-primary-rgb), 0.3);
}

.feature-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 60px;
    height: 60px;
    border-radius: 12px;
    background: rgba(var(--tenant-primary-rgb), 0.1);
    color: var(--tenant-primary);
    margin-bottom: 1.5rem;
}
/* =========================================
   ENHANCED RESPONSIVE DESIGN (ADDED VIA UPDATE)
   ========================================= */

.landing-nav-container {
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    max-width: 1200px; 
    margin: 0 auto;
}
.landing-nav-links {
    display: flex; 
    gap: 1.5rem; 
    align-items: center;
}

@media (max-width: 768px) {
    /* Landing Page Nav */
    .landing-nav-container {
        flex-direction: column;
        gap: 1rem;
    }
    .landing-nav-links {
        flex-wrap: wrap;
        justify-content: center;
        gap: 0.75rem;
    }
    .landing-logo h1 {
        font-size: 1.25rem !important;
    }
    .hero-content {
        padding: 3rem 1rem !important;
    }
    .hero-content h1 {
        font-size: 2.5rem !important;
    }
    .hero-content p {
        font-size: 1rem !important;
    }
    
    /* Table Responsive Overflow */
    .table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    table.custom-table {
        min-width: 600px;
    }
    
    /* Admin/Student General Spacing */
    .dashboard-container .main-content {
        padding: 1rem;
        width: 100%;
        overflow-x: hidden;
    }
    
    .top-nav {
        margin: -1rem -1rem 1.5rem -1rem !important;
        padding: 0.75rem 1rem !important;
    }
}

@media (max-width: 480px) {
    .landing-nav-links a {
        font-size: 0.85rem;
        padding: 0.4rem 1rem !important;
    }
    .hero-content h1 {
        font-size: 2rem !important;
    }
    .metric-val {
        font-size: 1.25rem !important;
    }
    .glass-card {
        padding: 0.75rem !important;
    }
    
    /* Forms */
    form {
        display: flex;
        flex-direction: column;
        width: 100%;
    }
    .form-group {
        width: 100%;
    }
    .btn {
        width: 100%;
        justify-content: center;
    }
}

/* =========================================
   SCROLLBAR STYLING (GHOST/TRANSPARENT)
   ========================================= */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: rgba(156, 163, 175, 0.4);
    border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(156, 163, 175, 0.7);
}
body {
    overflow-x: hidden;
}
html {
    overflow-x: hidden;
}

/* =========================================
   MOBILE HAMBURGER MENU 
   ========================================= */
.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    color: var(--text-main);
    cursor: pointer;
    padding: 0.5rem;
}
.mobile-nav-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1050;
    opacity: 0;
    transition: opacity 0.3s ease;
}
.mobile-nav-overlay.active {
    display: block;
    opacity: 1;
}
.mobile-sidebar {
    position: fixed;
    top: 0;
    left: -100%;
    width: 70%;
    max-width: 320px;
    height: 100vh;
    background: var(--bg-card);
    z-index: 1060;
    box-shadow: 4px 0 20px rgba(0,0,0,0.1);
    transition: left 0.3s ease;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}
.mobile-sidebar.active {
    left: 0;
}
.mobile-sidebar-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.mobile-sidebar-content {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    flex-grow: 1;
}
.mobile-sidebar-footer {
    padding: 1.5rem;
    border-top: 1px solid var(--border-color);
    background: var(--bg-main);
}
.mobile-social-links {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
}
.mobile-social-links a {
    color: var(--tenant-primary);
    background: rgba(var(--tenant-primary-rgb), 0.1);
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s;
}
.mobile-social-links a:hover {
    background: var(--tenant-primary);
    color: #fff;
}

@media (max-width: 768px) {
    .landing-nav-links {
        display: none !important;
    }
    .mobile-menu-btn {
        display: flex;
    }
}
