:root {
    --primary: #0f172a;
    --secondary: #f05033;
    --error: #ef4444;
    --success: #22c55e;
    --warning: #64748b;
    --bg: #f8fafc;
}

* {
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg);
    margin: 0;
    padding: 0;
    scroll-behavior: smooth;
    color: #1e293b;
}

/* Full-width / Fluid Dashboard */
.page-container {
    width: calc(100% - 30px);
    max-width: 100%;
    margin: 15px auto;
    padding: 10px 15px;
    box-sizing: border-box;
    transition: max-width 0.25s ease, width 0.25s ease;
}

.page-container.fixed-width {
    width: 1250px;
    max-width: 95%;
}

.table-responsive-wrapper {
    overflow-x: auto;
    width: 100%;
    -webkit-overflow-scrolling: touch;
}

/* Base App Container for Candidates */
#app-container {
    width: 100%;
    max-width: 950px;
    background: white;
    margin: 25px auto;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    position: relative;
}

.header {
    text-align: center;
    border-bottom: 1px solid #eee;
    padding-bottom: 20px;
    margin-bottom: 20px;
}

.company-logo {
    height: 50px;
    max-width: 100%;
    object-fit: contain;
}

.status-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding: 15px 20px;
    background: #fff;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    position: sticky;
    top: 10px;
    z-index: 100;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.timer-display {
    font-size: 24px;
    font-weight: bold;
    color: var(--error);
    background: #fee2e2;
    padding: 6px 16px;
    border-radius: 8px;
}

.question-item {
    margin-bottom: 30px;
    padding: 20px;
    border: 1px solid #f0f0f0;
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.02);
}

.context-box {
    background: #fffbeb;
    padding: 15px;
    border-left: 4px solid #f59e0b;
    margin-bottom: 15px;
    font-size: 15px;
    line-height: 1.5;
    white-space: pre-line;
}

/* Options Grid */
.options-grid {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    width: 100%;
}

.option-label {
    display: flex;
    align-items: center;
    width: 100%;
    padding: 12px 15px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    cursor: pointer;
    margin-top: 8px;
    text-align: left;
    transition: all 0.2s;
    background: #fff;
}

.option-label:hover {
    background: #f1f5f9;
    border-color: #94a3b8;
}

.option-label input[type="radio"] {
    margin-right: 12px;
    flex-shrink: 0;
}

/* KaTeX adjustments */
.katex-display {
    margin: 0 !important;
    text-align: left !important;
}

/* Game Board */
#game-board {
    position: relative;
    width: 100%;
    min-width: 700px;
    height: 750px;
    border: 3px solid #333;
    background: #fff;
    overflow: hidden;
    display: none;
    margin: 0 auto;
    border-radius: 8px;
}

.number {
    position: absolute;
    font-weight: 900;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #000;
    user-select: none;
    cursor: pointer;
    transition: transform 0.1s;
}

.special-underline {
    text-decoration: underline;
    text-decoration-thickness: 0.15em;
}

.clicked {
    color: #cbd5e1 !important;
    pointer-events: none;
}

/* Review Mode */
.review-q-box {
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    background: #f8fafc;
    position: relative;
}

.opt-correct {
    background: #dcfce7 !important;
    border-color: var(--success) !important;
    font-weight: bold;
}

.opt-wrong {
    background: #fee2e2 !important;
    border-color: var(--error) !important;
}

.badge {
    position: absolute;
    right: 20px;
    top: 20px;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: bold;
    color: white;
}

.badge-success {
    background: var(--success);
}

.badge-error {
    background: var(--error);
}

.badge-empty {
    background: var(--warning);
}

.review-game-container {
    width: 100%;
    border: 2px solid #ddd;
    background: #fff;
    margin-top: 15px;
    border-radius: 8px;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: flex-start;
}

.review-board-wrap {
    position: relative;
    width: 900px;
    height: 750px;
    background: white;
    pointer-events: none;
    transform-origin: top center;
}

.num-wrong-highlight {
    border: 2px solid #e53e3e !important;
    background-color: #fff5f5 !important;
    color: #e53e3e !important;
    border-radius: 50%;
    font-weight: bold;
}

.num-target-highlight {
    border: 2px solid #38a169 !important;
    background-color: #f0fff4 !important;
    color: #38a169 !important;
    border-radius: 50%;
    font-weight: bold;
}

/* Buttons */
.btn {
    padding: 12px 30px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: bold;
    font-size: 15px;
    transition: opacity 0.2s, transform 0.1s;
}

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

.btn:hover {
    opacity: 0.92;
    transform: translateY(-1px);
}

.btn:active {
    transform: translateY(0);
}

#back-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    border: none;
    cursor: pointer;
    display: none;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.hidden {
    display: none !important;
}

.result-screen {
    text-align: center;
    padding: 30px 10px;
}

.phase-summary-item {
    font-size: 16px;
    color: #334155;
    margin-bottom: 12px;
    padding: 10px 15px;
    background: white;
    border-radius: 6px;
    border-left: 4px solid var(--secondary);
}

/* Table Styles for Results */
.result-table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.result-table th,
.result-table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid #e2e8f0;
}

.result-table th {
    background-color: var(--primary);
    color: white;
    font-weight: 600;
}

.result-table tr:last-child td {
    border-bottom: none;
}

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

/* Start Page Content Style */
.instruction-box {
    text-align: left;
    background: #f1f5f9;
    padding: 22px;
    border-radius: 8px;
    margin: 20px 0;
    line-height: 1.6;
}

.instruction-box ul {
    padding-left: 20px;
}

.instruction-box li {
    margin-bottom: 10px;
}

.warning-text {
    color: var(--error);
    font-weight: bold;
}

/* Switch for Admin */
.switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 24px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .3s;
    border-radius: 24px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .3s;
    border-radius: 50%;
}

input:checked+.slider {
    background-color: #22c55e;
}

input:checked+.slider:before {
    transform: translateX(26px);
}

/* Responsive Media Queries */
@media (max-width: 768px) {
    #app-container {
        margin: 10px 5px;
        padding: 16px;
    }

    .status-bar {
        padding: 10px 14px;
        font-size: 14px;
    }

    .timer-display {
        font-size: 20px;
        padding: 4px 10px;
    }

    .result-table th,
    .result-table td {
        padding: 8px 10px;
        font-size: 13px;
    }

    .question-item {
        padding: 14px;
    }
}

/* ==============================================================================
   ADMIN DASHBOARD TABS & QUESTION BANK MANAGER
   ============================================================================== */
.btn-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 5px 12px;
    font-size: 13px;
    font-weight: 500;
    border-radius: 4px;
    border: none;
    cursor: pointer;
    min-width: 48px;
    height: 28px;
    text-decoration: none;
    box-sizing: border-box;
    transition: opacity 0.15s ease, transform 0.1s ease;
    vertical-align: middle;
}

.btn-action:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

.btn-action:active {
    transform: translateY(0);
}

.btn-action-view {
    background: var(--secondary);
    color: #fff;
}

.btn-action-edit {
    background: #0284c7;
    color: #fff;
}

.btn-action-delete {
    background: #dc3545;
    color: #fff;
}

.btn-action-save {
    background: #16a34a;
    color: #fff;
    font-weight: 600;
}

.btn-action-cancel {
    background: #64748b;
    color: #fff;
}

.inline-edit-input {
    padding: 5px 8px;
    font-size: 13px;
    border: 1px solid #0284c7;
    border-radius: 4px;
    outline: none;
    background: #fff;
    box-sizing: border-box;
    font-family: inherit;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.inline-edit-input:focus {
    border-color: #0284c7;
    box-shadow: 0 0 0 2px rgba(2, 132, 199, 0.25);
}

.inplace-editor-card {
    background: #f8fafc;
    border: 2px solid #0284c7;
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 4px 15px rgba(2, 132, 199, 0.1);
}

.admin-tab-btn {
    padding: 10px 20px;
    border: none;
    background: #e2e8f0;
    color: #475569;
    font-weight: 600;
    font-size: 14px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.admin-tab-btn:hover {
    background: #cbd5e1;
}

.admin-tab-btn.active {
    background: var(--primary);
    color: white;
}

.subtab-btn {
    padding: 8px 16px;
    border: 1px solid #cbd5e1;
    background: white;
    color: #334155;
    font-weight: 600;
    font-size: 13px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.subtab-btn:hover {
    background: #f1f5f9;
}

.subtab-btn.active {
    background: var(--secondary);
    color: white;
    border-color: var(--secondary);
}

/* Question Cards */
.q-card {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 18px;
    margin-bottom: 18px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
    transition: box-shadow 0.2s;
}

.q-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.q-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.q-num-badge {
    background: #e0e7ff;
    color: #3730a3;
    font-weight: bold;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 13px;
}

/* Modal System */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.6);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    padding: 20px;
    backdrop-filter: blur(2px);
}

.modal-content {
    background: white;
    border-radius: 12px;
    max-width: 680px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    padding: 25px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
    position: relative;
    box-sizing: border-box;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #e2e8f0;
    padding-bottom: 15px;
    margin-bottom: 20px;
}

.modal-close-btn {
    background: transparent;
    border: none;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    color: #64748b;
}

.modal-close-btn:hover {
    color: var(--error);
}

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 6px;
    color: #334155;
}

.form-control {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    font-size: 14px;
    box-sizing: border-box;
    font-family: inherit;
}

.form-control:focus {
    outline: none;
    border-color: var(--secondary);
    box-shadow: 0 0 0 3px rgba(240, 80, 51, 0.15);
}

.img-preview-box {
    margin-top: 10px;
    padding: 10px;
    border: 1px dashed #cbd5e1;
    border-radius: 8px;
    text-align: center;
    background: #f8fafc;
    min-height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.img-preview-box img {
    max-height: 120px;
    max-width: 100%;
    border-radius: 4px;
}

/* ==============================================================================
   SORTING HEADERS & HIRING STATUS COMBOBOX BADGES
   ============================================================================== */
.sortable-th {
    cursor: pointer;
    user-select: none;
    transition: background-color 0.15s ease, color 0.15s ease;
    white-space: nowrap;
}

.sortable-th:hover {
    background-color: #1e293b !important;
    color: #38bdf8 !important;
}

.sort-icon {
    font-size: 11px;
    margin-left: 3px;
    opacity: 0.6;
}

.sortable-th.active-sort {
    color: #38bdf8 !important;
}

.sortable-th.active-sort .sort-icon {
    opacity: 1;
}

/* Badges trạng thái tuyển dụng */
.badge-status {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 11.5px;
    font-weight: 600;
    border: 1px solid transparent;
    white-space: nowrap;
    text-align: center;
}

.status-pending {
    background: #f1f5f9;
    color: #475569;
    border-color: #cbd5e1;
}

.status-intern {
    background: #fef3c7;
    color: #b45309;
    border-color: #fcd34d;
}

.status-official {
    background: #dcfce7;
    color: #15803d;
    border-color: #86efac;
}

.status-rejected {
    background: #fee2e2;
    color: #b91c1c;
    border-color: #fca5a5;
}

.status-failed-probation {
    background: #ffedd5;
    color: #c2410c;
    border-color: #fdba74;
}

.status-other {
    background: #f3e8ff;
    color: #7e22ce;
    border-color: #d8b4fe;
}

.inline-edit-select {
    padding: 4px 6px;
    font-size: 12px;
    border: 1px solid #0284c7;
    border-radius: 4px;
    outline: none;
    background: #fff;
    box-sizing: border-box;
    font-family: inherit;
    font-weight: 500;
}

.inline-edit-select:focus {
    box-shadow: 0 0 0 2px rgba(2, 132, 199, 0.25);
}

/* Exam Pass Banner Widget */
.pass-widget-card {
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    color: white;
    border-radius: 10px;
    padding: 16px 20px;
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
    box-shadow: 0 4px 15px rgba(15, 23, 42, 0.15);
}

.pass-code-display {
    font-family: 'Courier New', Courier, monospace;
    font-size: 26px;
    font-weight: bold;
    letter-spacing: 3px;
    color: #38bdf8;
    background: rgba(255, 255, 255, 0.1);
    padding: 4px 12px;
    border-radius: 6px;
    border: 1px dashed rgba(56, 189, 248, 0.4);
    transition: all 0.2s ease;
}

.pass-code-display:hover {
    background: rgba(56, 189, 248, 0.18);
    border-color: #38bdf8;
}

.btn-copy-pass {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(56, 189, 248, 0.15);
    color: #38bdf8;
    border: 1px solid rgba(56, 189, 248, 0.4);
    padding: 6px 14px;
    height: 38px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.5px;
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
    box-sizing: border-box;
}

.btn-copy-pass:hover {
    background: rgba(56, 189, 248, 0.3);
    color: #ffffff;
    border-color: #38bdf8;
    box-shadow: 0 0 10px rgba(56, 189, 248, 0.35);
}

.btn-copy-pass:active {
    transform: scale(0.97);
}

.btn-copy-pass.copied {
    background: #16a34a !important;
    border-color: #16a34a !important;
    color: #ffffff !important;
    box-shadow: 0 0 12px rgba(22, 163, 74, 0.4) !important;
}

