.hidden-problem {
    display: none !important;
}

:root {
    --bs-body-bg: #f8f9fa;
}
#liveBox {
    transition: background-color 0.3s ease;
    border-color: rgba(var(--bs-primary-rgb), 0.3) !important;
}
body {
    background-color: var(--bs-body-bg);
    background-image: radial-gradient(#e9ecef 1px, transparent 1px);
    background-size: 20px 20px;
    min-height: 100vh;
    /* Change flex direction to column */
    display: flex;
    flex-direction: column; 
    /* Remove justify-content: center so it starts from the top */
    align-items: stretch; 
    font-family: 'Noto Sans Thai', 'Inter', sans-serif;
    padding: 0; /* Remove padding here so navbar touches edges */
}

/* Add padding to your main container instead */
.container.py-4 {
    flex-grow: 1; /* Pushes footer down if content is short */
}

.grader-card {
    border: none;
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
    overflow: hidden;
    max-width: 900px;
    width: 100%;
}

.card-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}
.brand-logo {
    width: 200px;
    height: auto;
    opacity: 0.95;
    filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.12));
}

.brand-subtitle {
    font-size: 0.85rem;
    letter-spacing: 0.04em;
    color: #6c757d;
}

.problem-list {
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid #e9ecef;
}

.problem-item {
    transition: all 0.2s ease;
    border-bottom: 1px solid #e9ecef;
}

.problem-item:last-child {
    border-bottom: none;
}

.problem-item:hover {
    background-color: #f8fbff;
    padding-left: 1.5rem !important;
}


.code-snippet {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.8rem;
    color: #d63384;
    word-break: break-all;
}


.tech-spec-box {
    background-color: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 1rem;
    margin-top: 1.5rem;
}


.form-control[type="file"] {
    padding: 12px;
    border: 2px dashed #dee2e6;
    cursor: pointer;
}

.terminal-input {
    background: #000 !important;
    color: #00ff00 !important;
    font-family: 'JetBrains Mono', monospace;
    border: 1px solid #333 !important;
}

.terminal-output {
    background: #000;
    color: #fff;
    font-family: 'JetBrains Mono', monospace;
    border: 1px solid #333;
    height: 150px;
    overflow-y: auto;
    white-space: pre-wrap;
    padding: 10px;
    font-size: 0.85rem;
}


.table-custom th {
    font-weight: 600;
    color: #495057;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background-color: #f8f9fa;
    border-bottom: 2px solid #e9ecef;
}
.table-custom td {
    vertical-align: middle;
    font-size: 0.95rem;
    padding: 1rem 0.75rem;
}
.data-mono {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.9rem;
}
.status-badge {
    font-size: 0.8rem;
    padding: 0.35em 0.65em;
    border-radius: 6px;
    font-weight: 600;
}
#error-container {
    display: none;
}


/* =========================
   DARK MODE OVERRIDES
   ========================= */

[data-bs-theme="dark"] {
    --bs-body-bg: #0f1115;
    --bs-body-color: #e6e6e6;
}

/* background */
[data-bs-theme="dark"] body {
    background-color: var(--bs-body-bg);
    background-image: radial-gradient(#1c2230 1px, transparent 1px);
}

/* main card */
[data-bs-theme="dark"] .grader-card {
    background: #151922;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}

/* header */
[data-bs-theme="dark"] .card-header {
    background: #151922;
    border-bottom: 1px solid #2a2f3a;
}

/* subtitle */
[data-bs-theme="dark"] .brand-subtitle {
    color: #9aa4b2;
}

/* problem list */
[data-bs-theme="dark"] .problem-list {
    border: 1px solid #2a2f3a;
}

[data-bs-theme="dark"] .problem-item {
    border-bottom: 1px solid #2a2f3a;
}

[data-bs-theme="dark"] .problem-item:hover {
    background-color: #1c2230;
}

/* text fixes */
[data-bs-theme="dark"] .text-dark {
    color: #e6e6e6 !important;
}

[data-bs-theme="dark"] .text-muted {
    color: #9aa4b2 !important;
}

/* tech box */
[data-bs-theme="dark"] .tech-spec-box {
    background-color: #151922;
    border: 1px solid #2a2f3a;
}

/* file input */
[data-bs-theme="dark"] .form-control[type="file"] {
    background: #151922;
    border-color: #2a2f3a;
    color: #e6e6e6;
}

/* tables */
[data-bs-theme="dark"] .table-custom th {
    background-color: #151922;
    color: #cbd5e1;
    border-bottom: 2px solid #2a2f3a;
}

[data-bs-theme="dark"] .table-custom td {
    color: #e6e6e6;
}

/* terminal (already dark but unify) */
[data-bs-theme="dark"] .terminal-input,
[data-bs-theme="dark"] .terminal-output {
    background: #000;
    border-color: #2a2f3a;
}

/* code highlight */
[data-bs-theme="dark"] .code-snippet {
    color: #ff7ac6;
}

[data-bs-theme="dark"] .card-footer {
    background: #151922 !important;
    border-top: 1px solid #2a2f3a !important;
}

[data-bs-theme="dark"] .btn-outline-secondary {
    border-color: #2a2f3a;
    color: #cbd5e1;
}

[data-bs-theme="dark"] .btn-outline-secondary:hover {
    background: #1c2230;
    color: #fff;
}

[data-bs-theme="dark"] .btn-outline-primary {
    border-color: #3b82f6;
    color: #93c5fd;
}

[data-bs-theme="dark"] .btn-outline-primary:hover {
    background: #1e293b;
}

.logo-wrap {
    background: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 14px;
    border-radius: 10px;
    margin-bottom: 12px;
}
[data-bs-theme="dark"] .logo-wrap {
    background: #ffffff; /* keep pure white even in dark mode */
}

body {
    opacity: 1;
    transition: opacity 0.15s ease;
}

body.page-leave {
    opacity: 0;
}




/* Modern Navbar Styling */
.navbar {
    backdrop-filter: blur(10px);
    background-color: rgba(33, 37, 41, 0.95) !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.navbar-brand {
    font-size: 1.25rem;
    letter-spacing: -0.5px;
}

.nav-link {
    font-weight: 500;
    transition: color 0.2s ease-in-out;
    padding: 0.5rem 1rem !important;
}

.nav-link:hover {
    color: #0d6efd !important; /* KVIS Primary Blue */
}

/* Grader Card adjustment for the new Navbar */
.grader-card {
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    border: none;
}
/* Make the popover container wide enough for the PDF */
.popover {
    max-width: 450px !important; 
    border: 1px solid #dee2e6;
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
}

/* Optional: hide the hover effect on mobile to prevent weird behavior */
@media (max-width: 768px) {
    .popover { display: none !important; }
}
.score-badge {
    min-width: 80px;
    text-align: right;
    font-variant-numeric: tabular-nums;
    display: inline-block;
}