/* ATPL Education - Modern UI */
:root {
    /* Light Theme */
    --bg-primary: #f8fafc;
    --bg-secondary: #ffffff;
    --bg-tertiary: #f1f5f9;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    --border-color: #e2e8f0;
    --accent: #3b82f6;
    --accent-hover: #2563eb;
    --success: #22c55e;
    --danger: #ef4444;
    --warning: #f59e0b;
    --shadow: 0 1px 3px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 40px rgba(0,0,0,0.1);
}

[data-theme="dark"] {
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-tertiary: #334155;
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --border-color: #334155;
    --shadow: 0 1px 3px rgba(0,0,0,0.3);
    --shadow-lg: 0 10px 40px rgba(0,0,0,0.4);
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

/* Header / Navbar */
.navbar {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    padding: 0 24px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow);
}

.navbar-brand {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
    font-size: 20px;
    color: var(--accent);
    text-decoration: none;
}

.navbar-brand img {
    height: 32px;
}

.navbar-nav {
    display: flex;
    align-items: center;
    gap: 8px;
}

.nav-link {
    padding: 8px 16px;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
}

.nav-link:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.nav-link.active {
    background: var(--accent);
    color: white;
}

.navbar-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Theme Toggle */
.theme-toggle {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 1px solid var(--border-color);
    background: var(--bg-secondary);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    transition: all 0.2s;
}

.theme-toggle:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

/* User Menu */
.user-menu {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s;
}

.user-menu:hover {
    background: var(--bg-tertiary);
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--accent);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
}

.user-info {
    text-align: right;
}

.user-name {
    font-weight: 600;
    font-size: 14px;
}

.user-role {
    font-size: 12px;
    color: var(--text-muted);
}

/* Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 24px;
}

.container-fluid {
    padding: 24px;
}

/* Cards */
.card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    box-shadow: var(--shadow);
    overflow: hidden;
}

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

.card-title {
    font-size: 18px;
    font-weight: 600;
}

.card-body {
    padding: 24px;
}

/* Question Display */
.question-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}

.question-id {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: var(--bg-tertiary);
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
}

.question-id.verified {
    background: #dbeafe;
    color: #1d4ed8;
}

[data-theme="dark"] .question-id.verified {
    background: #1e3a5f;
    color: #60a5fa;
}

.question-timer {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: var(--accent);
    color: white;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
}

.question-icons {
    display: flex;
    gap: 8px;
}

.question-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s;
}

.question-icon:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.question-text {
    font-size: 18px;
    line-height: 1.7;
    margin-bottom: 24px;
}

.question-annex {
    text-align: center;
    margin-bottom: 24px;
}

.question-annex img {
    max-width: 100%;
    max-height: 350px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
}

/* Answer Options */
.answer-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.answer-option {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 20px;
    background: var(--bg-tertiary);
    border: 2px solid transparent;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.answer-option:hover {
    border-color: var(--accent);
    background: var(--bg-secondary);
}

.answer-option.selected {
    border-color: var(--accent);
    background: #eff6ff;
}

[data-theme="dark"] .answer-option.selected {
    background: #1e3a5f;
}

.answer-option.correct {
    border-color: var(--success);
    background: #f0fdf4;
}

[data-theme="dark"] .answer-option.correct {
    background: #14532d;
}

.answer-option.wrong {
    border-color: var(--danger);
    background: #fef2f2;
}

[data-theme="dark"] .answer-option.wrong {
    background: #7f1d1d;
}

.answer-code {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 16px;
    flex-shrink: 0;
}

.answer-option.selected .answer-code {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
}

.answer-option.correct .answer-code {
    background: var(--success);
    color: white;
    border-color: var(--success);
}

.answer-option.wrong .answer-code {
    background: var(--danger);
    color: white;
    border-color: var(--danger);
}

.answer-text {
    flex: 1;
    font-size: 15px;
}

/* Navigation */
.question-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 32px;
    padding-top: 24px;
    border-top: 1px solid var(--border-color);
}

.nav-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s;
}

.nav-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.nav-btn.primary {
    background: var(--accent);
    border-color: var(--accent);
    color: white;
}

.nav-btn.primary:hover {
    background: var(--accent-hover);
}

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

.question-progress {
    font-size: 14px;
    color: var(--text-secondary);
    font-weight: 500;
}

/* Progress Tabs */
.progress-tabs {
    display: flex;
    border-top: 1px solid var(--border-color);
    margin-top: 24px;
}

.progress-tab {
    flex: 1;
    padding: 16px;
    text-align: center;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
}

.progress-tab:hover {
    color: var(--text-primary);
}

.progress-tab.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

/* Question Numbers */
.question-numbers {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 16px 24px;
    justify-content: center;
}

.q-num {
    width: 36px;
    height: 36px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    color: var(--text-primary);
}

.q-num:hover {
    border-color: var(--accent);
}

.q-num.current {
    background: var(--accent);
    border-color: var(--accent);
    color: white;
}

.q-num.answered {
    background: var(--success);
    border-color: var(--success);
    color: white;
}

.q-num.wrong-answer {
    background: var(--danger);
    border-color: var(--danger);
    color: white;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border: none;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    background: var(--accent);
    color: white;
}

.btn:hover {
    background: var(--accent-hover);
}

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

.btn-primary:hover {
    background: var(--accent-hover);
}

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

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

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

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

.btn-lg {
    padding: 16px 32px;
    font-size: 16px;
}

/* Forms */
.form-group {
    margin-bottom: 20px;
}

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

.form-control {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 15px;
    transition: border-color 0.2s;
}

.form-control:focus {
    outline: none;
    border-color: var(--accent);
}

.form-control::placeholder {
    color: var(--text-muted);
}

select.form-control {
    cursor: pointer;
}

/* General Form Elements (without .form-control class) */
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="search"],
input[type="tel"],
input[type="url"],
select,
textarea {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    font-size: 15px;
    font-family: inherit;
    transition: border-color 0.2s;
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
input[type="number"]:focus,
input[type="search"]:focus,
input[type="tel"]:focus,
input[type="url"]:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--accent);
}

select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2364748b' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

[data-theme="dark"] select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2394a3b8' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
}

/* Grid */
.grid {
    display: grid;
    gap: 24px;
}

.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

@media (max-width: 768px) {
    .grid-2, .grid-3, .grid-4 {
        grid-template-columns: 1fr;
    }
}

/* Stats Cards */
.stat-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 24px;
    text-align: center;
}

.stat-value {
    font-size: 36px;
    font-weight: 700;
    color: var(--accent);
}

.stat-label {
    font-size: 14px;
    color: var(--text-muted);
    margin-top: 8px;
}

.stat-card.success .stat-value { color: var(--success); }
.stat-card.danger .stat-value { color: var(--danger); }
.stat-card.warning .stat-value { color: var(--warning); }

/* Category Grid */
.category-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.category-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 24px;
    text-decoration: none;
    color: inherit;
    transition: all 0.2s;
}

.category-card:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.category-name {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 8px;
}

.category-count {
    font-size: 14px;
    color: var(--text-muted);
}

/* Alerts */
.alert {
    padding: 16px 20px;
    border-radius: 12px;
    margin-bottom: 20px;
    font-size: 14px;
}

.alert-success {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    color: #166534;
}

.alert-danger {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #991b1b;
}

.alert-warning {
    background: #fffbeb;
    border: 1px solid #fde68a;
    color: #92400e;
}

[data-theme="dark"] .alert-success {
    background: #14532d;
    border-color: #166534;
    color: #bbf7d0;
}

[data-theme="dark"] .alert-danger {
    background: #7f1d1d;
    border-color: #991b1b;
    color: #fecaca;
}

[data-theme="dark"] .alert-warning {
    background: #78350f;
    border-color: #92400e;
    color: #fde68a;
}

/* Badge */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.badge-primary { background: #dbeafe; color: #1d4ed8; }
.badge-success { background: #dcfce7; color: #166534; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-danger { background: #fee2e2; color: #991b1b; }

[data-theme="dark"] .badge-primary { background: #1e3a5f; color: #60a5fa; }
[data-theme="dark"] .badge-success { background: #14532d; color: #4ade80; }
[data-theme="dark"] .badge-warning { background: #78350f; color: #fbbf24; }
[data-theme="dark"] .badge-danger { background: #7f1d1d; color: #f87171; }

/* Result Page */
.result-box {
    text-align: center;
    padding: 48px;
}

.result-score {
    font-size: 72px;
    font-weight: 700;
    margin: 24px 0;
}

.result-score.pass { color: var(--success); }
.result-score.fail { color: var(--danger); }

.result-message {
    font-size: 24px;
    margin-bottom: 32px;
}

.result-stats {
    display: flex;
    justify-content: center;
    gap: 48px;
    margin: 32px 0;
}

.result-stat {
    text-align: center;
}

.result-stat-value {
    font-size: 32px;
    font-weight: 700;
}

.result-stat-label {
    font-size: 14px;
    color: var(--text-muted);
    margin-top: 4px;
}

/* Footer */
.footer {
    text-align: center;
    padding: 24px;
    color: var(--text-muted);
    font-size: 13px;
    border-top: 1px solid var(--border-color);
    margin-top: 48px;
}

.footer a {
    color: var(--accent);
    text-decoration: none;
}

/* Responsive */
@media (max-width: 768px) {
    .navbar {
        padding: 0 16px;
    }

    .navbar-nav {
        display: none;
    }

    .container {
        padding: 16px;
    }

    .question-header {
        flex-wrap: wrap;
        gap: 12px;
    }

    .question-nav {
        flex-wrap: wrap;
        gap: 12px;
    }

    .result-stats {
        flex-wrap: wrap;
        gap: 24px;
    }
}

/* Exam Setup */
.exam-setup {
    max-width: 600px;
    margin: 0 auto;
}

/* Sidebar Layout (Admin) */
.layout-sidebar {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 260px;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    padding: 24px 0;
    flex-shrink: 0;
}

.sidebar-brand {
    padding: 0 24px 24px;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 16px;
}

.sidebar-brand h1 {
    font-size: 20px;
    color: var(--accent);
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 24px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 14px;
    transition: all 0.2s;
}

.sidebar-nav a:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.sidebar-nav a.active {
    background: rgba(59, 130, 246, 0.1);
    color: var(--accent);
    border-left: 3px solid var(--accent);
}

.main-content {
    flex: 1;
    padding: 32px;
    overflow-y: auto;
}

/* Tables */
.table-container {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    overflow: hidden;
}

table {
    width: 100%;
    border-collapse: collapse;
}

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

th {
    background: var(--bg-tertiary);
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

td {
    font-size: 14px;
}

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

tr:hover td {
    background: var(--bg-tertiary);
}

/* User Dropdown Menu */
.user-menu-container {
    position: relative;
}

.user-menu {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s;
}

.user-menu:hover {
    background: var(--bg-tertiary);
}

.dropdown-arrow {
    font-size: 10px;
    color: var(--text-muted);
    transition: transform 0.2s;
}

.user-menu-container.open .dropdown-arrow {
    transform: rotate(180deg);
}

.user-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 8px;
    min-width: 200px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s;
    z-index: 1000;
}

.user-menu-container.open .user-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    color: var(--text-primary);
    text-decoration: none;
    font-size: 14px;
    transition: background 0.2s;
}

.dropdown-item:first-child {
    border-radius: 12px 12px 0 0;
}

.dropdown-item:last-child {
    border-radius: 0 0 12px 12px;
}

.dropdown-item:hover {
    background: var(--bg-tertiary);
}

.dropdown-item-danger {
    color: var(--danger);
}

.dropdown-item-danger:hover {
    background: #fef2f2;
}

[data-theme="dark"] .dropdown-item-danger:hover {
    background: #7f1d1d;
}

.dropdown-divider {
    margin: 4px 0;
    border: none;
    border-top: 1px solid var(--border-color);
}

/* Footer Links */
.footer-links {
    margin-top: 8px;
}

.footer-links a {
    color: var(--text-muted);
    text-decoration: none;
    transition: color 0.2s;
}

.footer-links a:hover {
    color: var(--accent);
}

.footer-divider {
    margin: 0 8px;
    color: var(--border-color);
}

/* App Download Section */
.app-download-section {
    margin: 48px 0;
    background: linear-gradient(135deg, #1e3a8a 0%, var(--accent) 50%, #0ea5e9 100%);
    border-radius: 24px;
    overflow: hidden;
    padding: 48px;
}

.app-download-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 40px;
}

.app-download-text {
    flex: 1;
}

.app-download-text h2 {
    color: #fff;
    font-size: 32px;
    margin-bottom: 12px;
}

.app-download-text p {
    color: rgba(255,255,255,0.85);
    font-size: 16px;
    margin-bottom: 24px;
    line-height: 1.6;
}

.app-badges {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.app-badge {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 14px 28px;
    background: rgba(255,255,255,0.15);
    border: 1px solid rgba(255,255,255,0.3);
    border-radius: 12px;
    color: #fff;
    text-decoration: none;
    font-weight: 600;
    font-size: 15px;
    transition: all 0.2s;
    backdrop-filter: blur(10px);
}

.app-badge:hover {
    background: rgba(255,255,255,0.25);
    transform: translateY(-2px);
}

.app-badge-apple {
    background: rgba(0,0,0,0.3);
    border-color: rgba(255,255,255,0.2);
}

.app-badge-apple:hover {
    background: rgba(0,0,0,0.4);
}

.app-download-mockup {
    flex-shrink: 0;
}

.phone-mockup {
    width: 180px;
    height: 360px;
    background: #111;
    border-radius: 32px;
    padding: 12px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    position: relative;
}

.phone-screen {
    width: 100%;
    height: 100%;
    background: linear-gradient(180deg, #0f172a 0%, #1e293b 100%);
    border-radius: 22px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
}

.phone-app-icon {
    width: 64px;
    height: 64px;
    background: var(--accent);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    color: #fff;
}

.phone-app-name {
    color: #fff;
    font-weight: 700;
    font-size: 18px;
}

@media (max-width: 768px) {
    .app-download-section {
        padding: 32px 24px;
    }
    .app-download-content {
        flex-direction: column;
        text-align: center;
    }
    .app-download-text h2 {
        font-size: 24px;
    }
    .app-badges {
        justify-content: center;
    }
    .phone-mockup {
        width: 140px;
        height: 280px;
    }
}
