/* =========================================
   SQL EXAM - ORANGE & BLACK THEME
   ========================================= */

:root {
    /* Primary Orange Colors */
    --orange-primary: #ff6b00;
    --orange-light: #ff8c33;
    --orange-dark: #e05500;
    --orange-glow: rgba(255, 107, 0, 0.3);
    
    /* Background Colors */
    --bg-dark: #0a0a0a;
    --bg-card: #141414;
    --bg-card-hover: #1a1a1a;
    --bg-elevated: #1e1e1e;
    
    /* Text Colors */
    --text-primary: #ffffff;
    --text-secondary: #b0b0b0;
    --text-dim: #666666;
    
    /* Accent Colors */
    --accent-orange: #ff6b00;
    --accent-gold: #ffa500;
    --accent-white: #ffffff;
    
    /* Success/Error */
    --success: #22c55e;
    --error: #ef4444;
    
    /* Fonts */
    --font-main: 'Segoe UI', 'Roboto', sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
    
    /* Sizing */
    --container-max: 900px;
    --border-radius: 12px;
    --border-radius-sm: 8px;
}

/* =========================================
   RESET & BASE
   ========================================= */

*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-main);
    background: var(--bg-dark);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    line-height: 1.6;
    background-image: 
        radial-gradient(ellipse at top, rgba(255, 107, 0, 0.08) 0%, transparent 50%),
        radial-gradient(ellipse at bottom right, rgba(255, 140, 51, 0.05) 0%, transparent 50%);
    background-attachment: fixed;
}

/* =========================================
   HIDE CRT EFFECTS
   ========================================= */

.crt-overlay,
.scanline {
    display: none;
}

/* =========================================
   TERMINAL CONTAINER
   ========================================= */

.terminal-container {
    max-width: var(--container-max);
    margin: 0 auto;
    min-height: 100vh;
    padding: 20px;
    position: relative;
}

/* =========================================
   HEADER
   ========================================= */

.terminal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    background: var(--bg-card);
    border: 1px solid #2a2a2a;
    border-bottom: 2px solid var(--orange-primary);
    border-radius: var(--border-radius) var(--border-radius) 0 0;
    margin-bottom: 0;
}

.header-lights {
    display: flex;
    gap: 8px;
}

.light {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    transition: transform 0.2s ease;
}

.light:hover {
    transform: scale(1.2);
}

.light.red { 
    background: #ff5f56;
    box-shadow: 0 0 8px rgba(255, 95, 86, 0.5);
}

.light.yellow { 
    background: #ffbd2e;
    box-shadow: 0 0 8px rgba(255, 189, 46, 0.5);
}

.light.green { 
    background: #27c93f;
    box-shadow: 0 0 8px rgba(39, 201, 63, 0.5);
}

.header-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--orange-primary);
    letter-spacing: 2px;
    text-transform: uppercase;
}

.header-status {
    font-size: 0.8rem;
}

.status-online {
    color: var(--success);
    display: flex;
    align-items: center;
    gap: 6px;
}

.status-online::before {
    content: '';
    width: 8px;
    height: 8px;
    background: var(--success);
    border-radius: 50%;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* =========================================
   SCREENS
   ========================================= */

.screen {
    display: none;
    background: var(--bg-card);
    border: 1px solid #2a2a2a;
    border-top: none;
    border-radius: 0 0 var(--border-radius) var(--border-radius);
    padding: 40px;
    min-height: 70vh;
    position: relative;
}

.screen.active {
    display: block;
    animation: fadeIn 0.4s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* =========================================
   ASCII ART
   ========================================= */

.ascii-art {
    text-align: center;
    margin-bottom: 40px;
}

.ascii-art pre {
    font-family: var(--font-mono);
    font-size: 0.45rem;
    line-height: 1.15;
    color: var(--orange-primary);
    text-shadow: 0 0 20px var(--orange-glow);
    display: inline-block;
    white-space: pre;
}

@media (min-width: 768px) {
    .ascii-art pre {
        font-size: 0.6rem;
    }
}

/* =========================================
   LOGIN SCREEN
   ========================================= */

.login-container {
    max-width: 450px;
    margin: 0 auto 50px;
    position: relative;
    z-index: 1;
}

.terminal-prompt {
    margin-bottom: 30px;
    padding: 20px;
    background: var(--bg-elevated);
    border-left: 4px solid var(--orange-primary);
    border-radius: var(--border-radius-sm);
}

.prompt-symbol {
    color: var(--orange-primary);
    font-weight: 700;
    margin-right: 8px;
    font-family: var(--font-mono);
}

.typing-text {
    color: var(--text-secondary);
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.input-group label {
    font-size: 0.9rem;
    color: var(--orange-light);
    font-weight: 600;
}

.input-group input {
    background: var(--bg-dark);
    border: 2px solid #333;
    border-radius: var(--border-radius-sm);
    padding: 16px 20px;
    font-family: var(--font-main);
    font-size: 1rem;
    color: var(--text-primary);
    transition: all 0.3s ease;
}

.input-group input:focus {
    outline: none;
    border-color: var(--orange-primary);
    box-shadow: 0 0 0 3px var(--orange-glow);
}

.input-group input::placeholder {
    color: var(--text-dim);
}

.exam-info {
    display: flex;
    justify-content: center;
    gap: 24px;
    padding: 24px;
    background: var(--bg-elevated);
    border-radius: var(--border-radius-sm);
    border: 1px solid #333;
}

.info-item {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.info-icon {
    font-size: 1.3rem;
}

/* =========================================
   BUTTONS
   ========================================= */

.btn-terminal {
    position: relative;
    background: var(--orange-primary);
    border: none;
    border-radius: var(--border-radius-sm);
    padding: 16px 32px;
    font-family: var(--font-main);
    font-size: 1rem;
    font-weight: 700;
    color: #000;
    cursor: pointer;
    overflow: hidden;
    transition: all 0.3s ease;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.btn-terminal::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.5s ease;
}

.btn-terminal:hover {
    background: var(--orange-light);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px var(--orange-glow);
}

.btn-terminal:hover::before {
    left: 100%;
}

.btn-terminal:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.btn-terminal:disabled:hover {
    background: var(--orange-primary);
    box-shadow: none;
}

.btn-secondary {
    background: transparent;
    border: 2px solid #444;
    color: var(--text-primary);
}

.btn-secondary:hover {
    background: var(--bg-elevated);
    border-color: var(--orange-primary);
    color: var(--orange-primary);
}

/* =========================================
   LEADERBOARD
   ========================================= */

.leaderboard-preview {
    max-width: 450px;
    margin: 0 auto;
    position: relative;
    z-index: 1;
}

.leaderboard-preview h3,
.full-leaderboard h3 {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 16px;
    color: var(--orange-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.scores-list {
    background: var(--bg-elevated);
    border: 1px solid #333;
    border-radius: var(--border-radius-sm);
    padding: 8px;
    max-height: 220px;
    overflow-y: auto;
}

.score-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 16px;
    border-radius: var(--border-radius-sm);
    transition: background 0.2s ease;
    margin-bottom: 4px;
}

.score-item:last-child {
    margin-bottom: 0;
}

.score-item:hover {
    background: var(--bg-card-hover);
}

.score-rank {
    font-weight: 700;
    font-size: 0.9rem;
    min-width: 35px;
    color: var(--text-dim);
}

.score-rank.gold { 
    color: #ffd700;
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
}
.score-rank.silver { color: #c0c0c0; }
.score-rank.bronze { color: #cd7f32; }

.score-name {
    flex: 1;
    margin: 0 15px;
    color: var(--text-primary);
    font-weight: 500;
}

.score-points {
    font-weight: 700;
    color: var(--orange-primary);
    font-size: 1.1rem;
}

.loading-text {
    color: var(--text-dim);
    text-align: center;
    padding: 24px;
    font-size: 0.9rem;
}

.dots::after {
    content: '';
    animation: dots 1.5s infinite;
}

@keyframes dots {
    0%, 20% { content: '.'; }
    40% { content: '..'; }
    60%, 100% { content: '...'; }
}

/* =========================================
   EXAM SCREEN
   ========================================= */

.exam-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
    padding: 20px 24px;
    background: var(--bg-elevated);
    border-radius: var(--border-radius-sm);
    margin-bottom: 32px;
    border: 1px solid #333;
    border-left: 4px solid var(--orange-primary);
}

.user-info {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.user-info span:last-child {
    color: var(--orange-light);
    font-weight: 600;
}

.progress-info {
    display: flex;
    align-items: center;
    gap: 16px;
    font-size: 0.9rem;
}

.progress-bar {
    width: 160px;
    height: 10px;
    background: var(--bg-dark);
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid #333;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--orange-dark), var(--orange-primary), var(--orange-light));
    width: 0%;
    transition: width 0.5s ease;
    border-radius: 10px;
}

.score-info {
    font-size: 1rem;
    font-weight: 700;
    color: var(--accent-gold);
}

/* Question Container */
.question-container {
    margin-bottom: 32px;
}

.question-number {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--orange-primary);
    margin-bottom: 12px;
    font-family: var(--font-mono);
    letter-spacing: 1px;
}

.question-text {
    font-size: 1.15rem;
    line-height: 1.8;
    color: var(--text-primary);
    padding: 28px;
    background: var(--bg-elevated);
    border-left: 4px solid var(--orange-primary);
    border-radius: var(--border-radius-sm);
    margin-bottom: 28px;
}

/* Options */
.options-container {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.option-btn {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    padding: 20px 24px;
    background: var(--bg-elevated);
    border: 2px solid #333;
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: left;
    font-family: var(--font-main);
    font-size: 1rem;
    color: var(--text-primary);
}

.option-btn:hover:not(:disabled) {
    border-color: var(--orange-primary);
    background: var(--bg-card-hover);
    transform: translateX(8px);
}

.option-btn:disabled {
    cursor: not-allowed;
}

.option-btn.selected {
    border-color: var(--orange-light);
    background: rgba(255, 107, 0, 0.1);
}

.option-btn.correct {
    border-color: var(--success);
    background: rgba(34, 197, 94, 0.15);
    animation: correctPulse 0.5s ease;
}

.option-btn.wrong {
    border-color: var(--error);
    background: rgba(239, 68, 68, 0.15);
    animation: wrongShake 0.5s ease;
}

@keyframes correctPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.01); }
}

@keyframes wrongShake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-6px); }
    75% { transform: translateX(6px); }
}

.option-letter {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: var(--orange-primary);
    border-radius: 50%;
    font-weight: 700;
    color: #000;
    flex-shrink: 0;
    font-size: 0.9rem;
}

.option-text {
    flex: 1;
    line-height: 1.6;
    padding-top: 6px;
}

/* Exam Footer */
.exam-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.answer-status {
    font-size: 1rem;
    font-weight: 600;
    min-height: 24px;
}

.answer-status.correct-msg {
    color: var(--success);
}

.answer-status.wrong-msg {
    color: var(--error);
}

.btn-next {
    margin-left: auto;
}

/* =========================================
   RESULT SCREEN
   ========================================= */

.result-container {
    max-width: 480px;
    margin: 0 auto 50px;
    text-align: center;
}

.result-ascii pre {
    font-family: var(--font-mono);
    font-size: 0.5rem;
    line-height: 1.15;
    margin-bottom: 32px;
}

.result-stats {
    background: var(--bg-elevated);
    border: 1px solid #333;
    border-radius: var(--border-radius);
    padding: 36px;
    margin-bottom: 24px;
    border-top: 4px solid var(--orange-primary);
}

.stat-item {
    margin-bottom: 24px;
}

.stat-item:last-child {
    margin-bottom: 0;
}

.stat-label {
    display: block;
    font-size: 0.75rem;
    color: var(--text-dim);
    letter-spacing: 2px;
    margin-bottom: 10px;
    text-transform: uppercase;
}

.stat-value {
    font-size: 2.2rem;
    font-weight: 700;
    color: var(--orange-primary);
}

.stat-value.big {
    font-size: 4rem;
    text-shadow: 0 0 30px var(--orange-glow);
}

.stat-value.correct {
    color: var(--success);
}

.stat-value.wrong {
    color: var(--error);
}

.stat-row {
    display: flex;
    justify-content: center;
    gap: 60px;
    margin-bottom: 24px;
}

.save-status {
    margin-bottom: 28px;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.save-status.success {
    color: var(--success);
}

.save-status.error {
    color: var(--error);
}

.result-actions {
    display: flex;
    gap: 16px;
    justify-content: center;
    flex-wrap: wrap;
}

/* Full Leaderboard */
.full-leaderboard {
    max-width: 600px;
    margin: 0 auto;
}

.leaderboard-table {
    background: var(--bg-elevated);
    border: 1px solid #333;
    border-radius: var(--border-radius-sm);
    overflow: hidden;
    max-height: 320px;
    overflow-y: auto;
}

.leaderboard-row {
    display: grid;
    grid-template-columns: 55px 1fr 80px 100px;
    gap: 12px;
    padding: 14px 18px;
    border-bottom: 1px solid #333;
    align-items: center;
    transition: background 0.2s ease;
}

.leaderboard-row:last-child {
    border-bottom: none;
}

.leaderboard-row:hover {
    background: var(--bg-card-hover);
}

.leaderboard-row.header {
    background: rgba(255, 107, 0, 0.1);
    font-weight: 600;
    color: var(--orange-light);
    font-size: 0.8rem;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.leaderboard-row.highlight {
    background: rgba(255, 107, 0, 0.15);
    border-left: 4px solid var(--orange-primary);
}

/* =========================================
   SCROLLBAR
   ========================================= */

::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-dark);
}

::-webkit-scrollbar-thumb {
    background: #444;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--orange-primary);
}

/* =========================================
   RESPONSIVE
   ========================================= */

@media (max-width: 768px) {
    .terminal-container {
        padding: 12px;
    }
    
    .screen {
        padding: 24px;
    }
    
    .ascii-art pre {
        font-size: 0.3rem;
    }
    
    .header-title {
        font-size: 0.8rem;
    }
    
    .exam-header {
        flex-direction: column;
        text-align: center;
    }
    
    .progress-bar {
        width: 100%;
    }
    
    .exam-info {
        flex-direction: column;
        gap: 12px;
    }
    
    .stat-row {
        gap: 40px;
    }
    
    .stat-value.big {
        font-size: 3rem;
    }
    
    .leaderboard-row {
        grid-template-columns: 45px 1fr 65px;
    }
    
    .leaderboard-row > *:last-child {
        display: none;
    }
}

/* =========================================
   BLINK CURSOR
   ========================================= */

.blink {
    animation: blink 1s infinite;
    color: var(--orange-primary);
}

@keyframes blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0; }
}
