/* ExamBank Pro - Master Stylesheet 
    Version: 2.5 (Full Option)
*/

/* =========================================
   1. VARIABLES & RESET
   ========================================= */
:root {
    /* Color Palette (Theme) */
    --cerulean: #0081a7;
    --cerulean-hover: #006c8a;
    --tropical-teal: #00afb9;
    --light-yellow: #fdfcdc;
    --soft-apricot: #fed9b7;
    --vibrant-coral: #f07167;

    /* System Colors */
    --bg-body: #f8fafc;
    --text-main: #1e293b;
    --text-muted: #64748b;

    /* Glassmorphism Tokens */
    --glass-bg: rgba(255, 255, 255, 0.7);
    --glass-border: rgba(255, 255, 255, 0.4);
    --glass-blur: 12px;

    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --shadow-glow: 0 0 15px rgba(0, 129, 167, 0.25);
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Kanit', sans-serif;
    background-color: var(--bg-body);
    color: var(--text-main);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overscroll-behavior-y: none;
    /* Prevent pull-to-refresh on mobile apps */
}

/* =========================================
   2. CUSTOM SCROLLBAR (Modern & Slim)
   ========================================= */
/* Webkit (Chrome, Safari, Edge) */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 10px;
    transition: background 0.3s;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--cerulean);
}

/* Firefox */
* {
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 transparent;
}

/* Hide Scrollbar Utility */
.no-scrollbar::-webkit-scrollbar {
    display: none;
}

.no-scrollbar {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

/* =========================================
   3. UTILITIES & ANIMATIONS
   ========================================= */

/* Glass Effect */
.glass {
    background: var(--glass-bg);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    border: 1px solid var(--glass-border);
}

.glass-dark {
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: white;
}

/* Hover Lift Effect */
.hover-lift {
    transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.hover-lift:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.4s ease-out forwards;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.spin {
    animation: spin 1s linear infinite;
}

@keyframes pulse-glow {

    0%,
    100% {
        box-shadow: 0 0 5px rgba(240, 113, 103, 0.2);
    }

    50% {
        box-shadow: 0 0 20px rgba(240, 113, 103, 0.6);
    }
}

.animate-pulse-glow {
    animation: pulse-glow 2s infinite;
}

/* Preloader */
#preloader {
    position: fixed;
    inset: 0;
    background: white;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: opacity 0.5s ease;
}

.loader {
    width: 48px;
    height: 48px;
    border: 5px solid #f3f3f3;
    border-top: 5px solid var(--cerulean);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* =========================================
   4. COMPONENT STYLES
   ========================================= */

/* App-Style Cards */
.app-card {
    background: white;
    border-radius: 24px;
    /* Rounded-3xl */
    border: 1px solid #f1f5f9;
    box-shadow: var(--shadow-sm);
    transition: all 0.3s ease;
}

.app-card:hover {
    border-color: var(--tropical-teal);
    box-shadow: var(--shadow-lg);
}

/* Tables (Mobile Responsive Stack) */
@media (max-width: 768px) {
    .table-responsive-stack thead {
        display: none;
    }

    .table-responsive-stack tr {
        display: flex;
        flex-direction: column;
        background: white;
        border: 1px solid #e2e8f0;
        border-radius: 12px;
        margin-bottom: 1rem;
        padding: 1rem;
        box-shadow: var(--shadow-sm);
    }

    .table-responsive-stack td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 0.5rem 0;
        border: none;
        border-bottom: 1px solid #f1f5f9;
    }

    .table-responsive-stack td:last-child {
        border-bottom: none;
        padding-top: 1rem;
        justify-content: center;
    }

    .table-responsive-stack td::before {
        content: attr(data-label);
        font-weight: 600;
        font-size: 0.875rem;
        color: var(--text-muted);
    }
}

/* =========================================
   5. EXAM ROOM SPECIFIC
   ========================================= */

/* PDF Viewer Frame */
.pdf-frame {
    height: calc(100vh - 130px);
    /* Mobile default */
    width: 100%;
    border: none;
}

@media (min-width: 768px) {
    .pdf-frame {
        height: calc(100vh - 70px);
        /* Desktop */
    }
}

/* Question Navigator & Cards */
.question-card {
    scroll-margin-top: 100px;
    /* Offset for sticky header */
}

.question-card input[type="radio"]:checked+div {
    background-color: var(--cerulean);
    color: white;
    border-color: var(--cerulean);
    box-shadow: 0 4px 6px -1px rgba(0, 129, 167, 0.4);
}

/* Mobile Tabs */
.tab-active {
    color: var(--cerulean);
    background-color: #f0f9ff;
    border-top: 3px solid var(--cerulean);
    font-weight: 700;
}

/* =========================================
   6. PRINT STYLES (For Reports)
   ========================================= */
@media print {
    @page {
        size: A4;
        margin: 1.5cm;
    }

    body {
        background: white;
        color: black;
        font-family: 'Sarabun', sans-serif;
        /* Formal font for print */
        font-size: 12pt;
    }

    /* Hide Elements */
    .no-print,
    nav,
    aside,
    footer,
    .sidebar,
    .print\:hidden,
    button,
    .app-dock {
        display: none !important;
    }

    /* Reset Layout */
    .flex-1.md\:ml-64,
    .flex-1.md\:ml-72 {
        margin-left: 0 !important;
        padding: 0 !important;
        width: 100% !important;
    }

    /* Table Styles for Print */
    table {
        width: 100%;
        border-collapse: collapse;
        margin-top: 20px;
    }

    th,
    td {
        border: 1px solid #000;
        padding: 8px;
        text-align: left;
    }

    th {
        background-color: #f0f0f0 !important;
        -webkit-print-color-adjust: exact;
        font-weight: bold;
        text-align: center;
    }

    /* Graphs/Charts */
    canvas {
        max-width: 100% !important;
        max-height: 400px !important;
        page-break-inside: avoid;
    }

    /* Ensure colors print */
    .text-red-500 {
        color: red !important;
    }

    .text-green-500 {
        color: green !important;
    }

    .bg-gray-50 {
        background-color: #f9fafb !important;
        -webkit-print-color-adjust: exact;
    }

    /* Page Breaks */
    .page-break {
        page-break-after: always;
    }
}