@font-face {
    font-family: 'Montserrat';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url('../fonts/montserrat-400.woff2') format('woff2');
}
@font-face {
    font-family: 'Montserrat';
    font-style: normal;
    font-weight: 500;
    font-display: swap;
    src: url('../fonts/montserrat-500.woff2') format('woff2');
}
@font-face {
    font-family: 'Montserrat';
    font-style: normal;
    font-weight: 600;
    font-display: swap;
    src: url('../fonts/montserrat-600.woff2') format('woff2');
}
@font-face {
    font-family: 'Montserrat';
    font-style: normal;
    font-weight: 700;
    font-display: swap;
    src: url('../fonts/montserrat-700.woff2') format('woff2');
}

:root {
    --bg-color: #0d1117;
    --surface-color: rgba(22, 27, 34, 0.7);
    --surface-solid: #161b22;
    --border-color: #30363d;
    --text-primary: #e6edf3;
    --text-secondary: #8b949e;
    --primary-color: #ff9900; /* AWS Orange */
    --primary-hover: #e88b00;
    --secondary-color: #232f3e; /* AWS Navy */
    --success-color: #2ea043;
    --danger-color: #f85149;
    --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
    --glass-blur: blur(12px);
    --border-radius: 12px;
}

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

body {
    /* Updated font as requested */
    font-family: 'Montserrat', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    line-height: 1.6;
    height: 100vh;
    overflow: hidden;
}

.app-container {
    display: flex;
    height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 280px;
    background: var(--surface-color);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    z-index: 10;
    transition: width 0.3s ease;
}

.sidebar.collapsed {
    width: 70px;
}

.sidebar-header {
    padding: 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.sidebar-title h2 {
    color: var(--primary-color);
    font-weight: 700;
    letter-spacing: -0.5px;
    font-size: 1.4rem;
    transition: opacity 0.2s;
}

.sidebar-title p {
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin-top: 4px;
    transition: opacity 0.2s;
}

.sidebar.collapsed .sidebar-title {
    display: none;
}

.btn-icon {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
    transition: color 0.2s;
    padding: 4px;
}

.btn-icon:hover {
    color: var(--primary-color);
}

.sidebar.collapsed .sidebar-header {
    padding: 24px 0;
    justify-content: center;
}

.nav-links {
    list-style: none;
    padding: 16px 0;
    overflow-y: auto;
    flex: 1;
}

.nav-item {
    padding: 12px 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    color: var(--text-secondary);
    transition: all 0.2s ease;
    border-left: 3px solid transparent;
    white-space: nowrap;
}

.sidebar.collapsed .nav-item {
    padding: 12px;
    justify-content: center;
}

.sidebar.collapsed .nav-text {
    display: none;
}

.nav-item:hover {
    background: rgba(255, 153, 0, 0.05);
    color: var(--text-primary);
}

.nav-item.active {
    background: rgba(255, 153, 0, 0.1);
    color: var(--primary-color);
    border-left-color: var(--primary-color);
    font-weight: 500;
}

.nav-item .icon {
    margin-right: 12px;
    font-size: 1.2rem;
}

.sidebar.collapsed .nav-item .icon {
    margin-right: 0;
}

/* Main Content */
.main-content {
    flex: 1;
    position: relative;
    overflow-y: auto;
    scroll-behavior: smooth;
}

.view {
    display: none;
    padding: 40px;
    /* Utilise width properly - increased from 1000px to 1400px to fill large screens but not stretch infinitely */
    max-width: 1400px;
    margin: 0 auto;
    animation: fadeIn 0.3s ease;
}

.view.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.view-header {
    margin-bottom: 32px;
}

.view-header h1 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 8px;
}

.view-header p {
    color: var(--text-secondary);
}

/* Login View */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 70vh;
}

.login-card {
    background: var(--surface-solid);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 48px 40px;
    width: 100%;
    max-width: 450px;
    box-shadow: var(--glass-shadow);
    text-align: center;
}

.form-group {
    text-align: left;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--text-secondary);
}

/* Scoreboard */
.scoreboard-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 24px;
    margin-bottom: 40px;
}

.stat-card {
    background: var(--surface-solid);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 24px;
    text-align: center;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    transition: transform 0.2s;
}

.stat-card:hover {
    transform: translateY(-5px);
    border-color: var(--primary-color);
}

.stat-card h3 {
    color: var(--text-secondary);
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 12px;
}

.stat-value {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--primary-color);
}

.history-section h2 {
    margin-bottom: 20px;
}

.history-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--surface-solid);
    border-radius: var(--border-radius);
    overflow: hidden;
    border: 1px solid var(--border-color);
}

.history-table th, .history-table td {
    padding: 16px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.history-table th {
    background: rgba(255, 255, 255, 0.02);
    color: var(--text-secondary);
    font-weight: 600;
}

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

.status-badge {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
}

.status-badge.pass { background: rgba(46, 160, 67, 0.2); color: var(--success-color); }
.status-badge.fail { background: rgba(248, 81, 73, 0.2); color: var(--danger-color); }

/* Pre-Test Instruction View */
.instruction-card {
    background: var(--surface-solid);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 40px;
    box-shadow: var(--glass-shadow);
}

.candidate-form {
    margin-bottom: 40px;
    padding-bottom: 30px;
    border-bottom: 1px solid var(--border-color);
}

.candidate-label {
    display: block;
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 12px;
}

.candidate-input {
    width: 100%;
    max-width: 400px;
    padding: 14px 16px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 1rem;
    transition: all 0.2s;
}

.candidate-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(255, 153, 0, 0.2);
}

.instructions-content h2 {
    color: var(--primary-color);
    font-size: 1.2rem;
    margin-bottom: 16px;
    margin-top: 24px;
}

.instructions-content h2:first-child {
    margin-top: 0;
}

.instructions-content ul {
    list-style-position: inside;
    margin-bottom: 24px;
}

.instructions-content li {
    margin-bottom: 10px;
    color: var(--text-secondary);
}

.instructions-content strong {
    color: var(--text-primary);
}

/* Test View */
.test-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 24px;
}

.timer {
    display: flex;
    align-items: center;
    background: var(--surface-solid);
    padding: 8px 16px;
    border-radius: 20px;
    border: 1px solid var(--border-color);
    font-weight: 600;
    font-family: monospace;
    font-size: 1.2rem;
    color: var(--primary-color);
}

.timer .icon { margin-right: 8px; font-size: 1rem; }

.progress-bar-container {
    height: 6px;
    background: var(--surface-solid);
    border-radius: 3px;
    margin-bottom: 30px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: var(--primary-color);
    width: 0%;
    transition: width 0.3s ease;
}

.test-layout {
    display: flex;
    gap: 32px;
    align-items: flex-start;
}

.test-main-panel {
    flex: 1;
    min-width: 0; /* Prevents flex items from overflowing */
}

.test-side-panel {
    width: 340px;
    flex-shrink: 0;
    position: sticky;
    top: 20px;
}

.question-container {
    background: var(--surface-solid);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 40px; /* Increased padding */
    margin-bottom: 32px;
    box-shadow: var(--glass-shadow);
}

.question-text {
    font-size: 1.3rem; /* Slightly larger text */
    font-weight: 500;
    margin-bottom: 32px;
    line-height: 1.6;
}

.options-list {
    display: flex;
    flex-direction: column;
    gap: 16px; /* Increased gap */
}

.option-item {
    display: flex;
    align-items: flex-start;
    padding: 20px; /* Increased padding */
    border: 1px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    background: rgba(255, 255, 255, 0.02);
}

.option-item:hover {
    border-color: rgba(255, 153, 0, 0.5);
    background: rgba(255, 153, 0, 0.05);
}

.option-item.selected {
    border-color: var(--primary-color);
    background: rgba(255, 153, 0, 0.1);
}

.option-item input {
    margin-top: 4px;
    margin-right: 16px;
    accent-color: var(--primary-color);
    width: 20px;
    height: 20px;
    cursor: pointer;
}

.option-content {
    flex: 1;
    font-size: 1.05rem;
}

.option-letter {
    font-weight: 600;
    margin-right: 8px;
    color: var(--primary-color);
}

.test-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 40px;
}

.btn {
    padding: 14px 28px;
    border: none;
    border-radius: 8px;
    font-family: inherit;
    font-size: 1.05rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

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

.btn-primary {
    background: var(--primary-color);
    color: #fff;
}

.btn-primary:hover:not(:disabled) {
    background: var(--primary-hover);
    transform: translateY(-2px);
}

.btn-secondary {
    background: var(--surface-solid);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

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

.btn-success {
    background: var(--success-color);
    color: #fff;
}

.btn-success:hover:not(:disabled) {
    background: #238636;
    transform: translateY(-2px);
}

/* Question Navigator */
.question-navigator {
    background: var(--surface-solid);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 24px;
}

.question-navigator h3 {
    margin-bottom: 16px;
    font-size: 1.1rem;
    color: var(--text-secondary);
}

.grid {
    display: grid;
    /* Updated as requested: 10 columns grid for 65 questions */
    grid-template-columns: repeat(10, 1fr);
    gap: 10px;
}

.nav-grid-item {
    width: 100%;
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid transparent;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 500;
    transition: all 0.2s;
}

.nav-grid-item:hover {
    background: rgba(255, 255, 255, 0.1);
}

.nav-grid-item.answered {
    background: rgba(255, 153, 0, 0.2);
    color: var(--primary-color);
    border-color: rgba(255, 153, 0, 0.3);
}

.nav-grid-item.current {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(255, 153, 0, 0.3);
    font-weight: 700;
}

/* Review Result */
.score-card {
    background: var(--surface-solid);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 40px;
    text-align: center;
    margin-bottom: 40px;
}

.score-card h2 {
    font-size: 3.5rem;
    margin-bottom: 10px;
}

.status-pass { color: var(--success-color); font-size: 1.5rem; font-weight: 700; }
.status-fail { color: var(--danger-color); font-size: 1.5rem; font-weight: 700; }

.review-item {
    background: var(--surface-solid);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 32px;
    margin-bottom: 24px;
}

.review-item.correct { border-left: 5px solid var(--success-color); }
.review-item.incorrect { border-left: 5px solid var(--danger-color); }
.review-item.unanswered { border-left: 5px solid var(--text-secondary); }

.explanation {
    margin-top: 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.explanation-section {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 20px;
    border-left: 4px solid var(--primary-color);
}

.explanation-section.elimination {
    border-left-color: var(--danger-color);
}

.explanation-section.incorrect-options {
    border-left-color: #8b949e;
    background: rgba(139, 148, 158, 0.05);
}

.explanation-section h4 {
    margin-bottom: 12px;
    color: var(--primary-color);
    font-size: 1.1rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.explanation-section.elimination h4 {
    color: var(--danger-color);
}

.explanation-section p {
    white-space: pre-wrap; 
    font-size: 0.95rem; 
    line-height: 1.6;
    color: var(--text-primary);
}
