/* Base Variables */
:root {
    --bg-main: #0a0c10;
    --navy-primary: #141820;
    --navy-light: #1c222d;
    --blue-accent: #7ed321;
    --white: #141820;
    --text-main: #ffffff;
    --text-muted: #94a3b8;
    --border-color: #1c222d;

    /* Status Colors */
    --status-not-visited: #3a4259;
    --status-not-answered: #e74c3c;
    --status-answered: #7ed321;
    --status-marked: #f1c40f;
    --status-answered-marked: #9b59b6;

    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.2);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4), 0 2px 4px -1px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5), 0 4px 6px -2px rgba(0, 0, 0, 0.4);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', sans-serif;
    color: var(--text-main);
    background-color: var(--bg-main);
    line-height: 1.5;
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    /* Prevent body scroll, handle in layout */
}

/* Typography */
h1,
h2,
h3,
h4 {
    color: var(--text-main);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: 4px;
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
}

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

.btn-primary {
    background-color: var(--blue-accent);
    color: #000;
}

.btn-primary:hover:not(:disabled) {
    background-color: #5fa515;
}

.btn-secondary {
    background-color: var(--navy-light);
    color: var(--text-main);
    border-color: var(--border-color);
}

.btn-secondary:hover:not(:disabled) {
    background-color: var(--navy-primary);
}

.btn-success {
    background-color: var(--status-answered);
    color: #000;
}

.btn-success:hover:not(:disabled) {
    background-color: #2f855a;
}

.btn-block {
    width: 100%;
}

.btn-lg {
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
}

/* Header */
.app-header {
    background-color: var(--navy-primary);
    color: white;
    padding: 0.75rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow-md);
    z-index: 10;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.logo {
    font-size: 1.25rem;
    font-weight: 700;
    margin: 0;
    color: white;
    letter-spacing: 0.5px;
}

.subject-badge {
    background-color: rgba(255, 255, 255, 0.1);
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 500;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.candidate-info {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.candidate-name {
    font-weight: 600;
    font-size: 0.875rem;
}

.candidate-id {
    font-size: 0.75rem;
    color: #cbd5e0;
}

.profile-image img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid var(--blue-accent);
    object-fit: cover;
}

.timer-box {
    background: #e53e3e;
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    font-weight: 700;
    font-family: monospace;
    font-size: 1.25rem;
    letter-spacing: 1px;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Login Page Specifics */
.login-bg {
    background: linear-gradient(135deg, var(--navy-primary) 0%, var(--navy-light) 100%);
}

.login-container {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 2rem;
}

.login-card {
    background: var(--navy-primary);
    padding: 2.5rem;
    border-radius: 8px;
    width: 100%;
    max-width: 400px;
    box-shadow: var(--shadow-lg);
}

.login-card h2 {
    text-align: center;
    margin-bottom: 0.5rem;
}

.login-card .subtitle {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.875rem;
    margin-bottom: 2rem;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
}

.form-group input {
    width: 100%;
    padding: 0.75rem;
    background-color: var(--bg-main);
    color: var(--text-main);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-family: inherit;
    font-size: 1rem;
    transition: border-color 0.2s;
}

.form-group input:focus {
    outline: none;
    border-color: var(--blue-accent);
    box-shadow: 0 0 0 3px rgba(49, 130, 206, 0.1);
}

.system-status {
    margin-top: 2rem;
    text-align: center;
    font-size: 0.75rem;
    color: var(--status-answered);
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
}

.status-dot {
    width: 8px;
    height: 8px;
    background: var(--status-answered);
    border-radius: 50%;
    display: inline-block;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(56, 161, 105, 0.7);
    }

    70% {
        transform: scale(1);
        box-shadow: 0 0 0 6px rgba(56, 161, 105, 0);
    }

    100% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(56, 161, 105, 0);
    }
}

/* Instructions Layout */
.instructions-layout {
    display: flex;
    flex: 1;
    overflow: hidden;
}

.instructions-content {
    flex: 1;
    padding: 2rem;
    overflow-y: auto;
    background: var(--bg-main);
    border-right: 1px solid var(--border-color);
}

.instructions-content h2 {
    margin-bottom: 1.5rem;
    border-bottom: 2px solid var(--navy-light);
    padding-bottom: 0.5rem;
}

.instruction-list h3 {
    margin: 1.5rem 0 0.75rem 0;
    font-size: 1.1rem;
}

.instruction-list ol,
.instruction-list ul {
    margin-left: 1.5rem;
    margin-bottom: 1rem;
}

.instruction-list li {
    margin-bottom: 0.5rem;
}

.legend-list {
    list-style: none !important;
    margin-left: 0 !important;
    margin-top: 0.5rem;
}

.legend-list li {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
}

.legend-box {
    width: 20px;
    height: 20px;
    border-radius: 3px;
    flex-shrink: 0;
    margin-top: 2px;
}

.candidate-panel {
    width: 350px;
    background: var(--bg-main);
    display: flex;
    flex-direction: column;
}

.profile-large {
    padding: 3rem 2rem;
    text-align: center;
    background: var(--navy-primary);
    border-bottom: 1px solid var(--border-color);
}

.profile-large img {
    border-radius: 8px;
    box-shadow: var(--shadow-md);
    margin-bottom: 1rem;
}

.action-area {
    padding: 2rem;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
}

.agreement-checkbox {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
    font-size: 0.875rem;
    cursor: pointer;
}

.agreement-checkbox input {
    margin-top: 3px;
}

/* Status Classes */
.not-visited {
    background-color: var(--status-not-visited);
    color: var(--text-main);
}

.not-answered {
    background-color: var(--status-not-answered);
    color: white;
}

.answered {
    background-color: var(--status-answered);
    color: white;
}

.marked {
    background-color: var(--status-marked);
    color: white;
}

.answered-marked {
    background-color: var(--status-answered-marked);
    color: white;
    position: relative;
}

/* Little badge indicating answered but marked */
.answered-marked::after {
    content: '';
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 8px;
    height: 8px;
    background-color: var(--status-answered);
    border-radius: 50%;
    border: 1px solid white;
}

/* Hamburger menu core (desktop hidden) */
.hamburger-btn {
    display: none;
}

.timer-container {
    display: flex;
}

/* ========================================= */
/* RESPONSIVE LAYOUT SYSTEM                  */
/* ========================================= */

/* TABLET (max-width: 1024px) */
@media (max-width: 1024px) {
    .candidate-panel {
        width: 250px;
    }
}

/* MOBILE (max-width: 768px) */
@media (max-width: 768px) {

    /* Reset body behavior on mobile for natural scrolling unless specific */
    body {
        height: auto;
        overflow-y: auto;
        overflow-x: hidden;
    }

    /* Header adjustments */
    .app-header {
        flex-direction: column;
        align-items: stretch;
        /* stretch to fill width */
        padding: 1rem;
        gap: 1rem;
        position: relative;
    }

    .header-left {
        width: 100%;
        display: flex;
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .header-right {
        display: none;
        /* Hidden by default behind hamburger */
        flex-direction: column;
        width: 100%;
        background-color: var(--navy-primary);
        padding: 1rem 0 0 0;
        border-top: 1px solid rgba(255, 255, 255, 0.1);
        align-items: flex-start;
    }

    .header-right.menu-open {
        display: flex;
        animation: slideDown 0.2s ease-out forwards;
    }

    /* Hamburger Button UI */
    .hamburger-btn {
        display: block;
        position: absolute;
        top: 1rem;
        right: 1rem;
        background: none;
        border: none;
        color: white;
        font-size: 1.5rem;
        cursor: pointer;
        padding: 0.5rem;
        z-index: 20;
    }

    /* Keep Timer Visible Above Menu */
    .timer-container {
        width: 100%;
        display: flex;
        justify-content: flex-start;
    }

    .timer-box {
        font-size: 1.1rem;
        padding: 0.4rem 0.8rem;
    }

    .candidate-info {
        text-align: left;
    }

    .profile-image img {
        width: 32px;
        height: 32px;
    }

    /* Login Page */
    .login-container {
        padding: 1rem;
    }

    .login-card {
        padding: 1.5rem;
    }

    /* Instructions Page */
    .instructions-layout {
        flex-direction: column;
        overflow-y: visible;
    }

    .candidate-panel {
        width: 100%;
        order: -1;
        /* Move to top */
        border-bottom: 1px solid var(--border-color);
    }

    .profile-large {
        padding: 1.5rem;
    }
}