/* ================== RESET & BASE ================== */
* { margin: 0; padding: 0; box-sizing: border-box; }
:root {
    --primary: #6c63ff;
    --secondary: #00c9a7;
    --dark-1: #2d3436;
    --dark-2: #1a1a2e;
    --text: #2d3436;
    --text-light: #636e72;
    --bg: #f5f7fb;
    --white: #ffffff;
    --border: #e1e5eb;
    --success: #00c9a7;
    --danger: #ff6b6b;
    --warning: #ffa502;
    --info: #3498db;
    --shadow: 0 4px 20px rgba(0,0,0,0.08);
    --shadow-lg: 0 10px 40px rgba(108,99,255,0.15);
    --radius: 12px;
    --gradient: linear-gradient(135deg, #6c63ff 0%, #00c9a7 100%);
    --gradient-dark: linear-gradient(135deg, #2d3436 0%, #1a1a2e 100%);
}
html { scroll-behavior: smooth; }
body {
    font-family: 'Inter', sans-serif;
    color: var(--text);
    background: var(--bg);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}
a { color: var(--primary); text-decoration: none; transition: all .2s; }
a:hover { color: var(--secondary); }
img { max-width: 100%; display: block; }
ul { list-style: none; }

/* ================== NAVIGATION ================== */
.main-nav {
    background: var(--gradient-dark);
    color: white;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
}
.nav-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 70px;
}
.logo {
    color: white;
    font-size: 1.5rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: .6rem;
}
.logo i {
    background: var(--gradient);
    padding: .5rem;
    border-radius: 10px;
    font-size: 1.2rem;
}
.nav-menu {
    display: flex;
    align-items: center;
    gap: .5rem;
}
.nav-menu a {
    color: rgba(255,255,255,0.85);
    padding: .6rem 1rem;
    border-radius: 8px;
    font-weight: 500;
    font-size: .95rem;
    display: flex;
    align-items: center;
    gap: .4rem;
    transition: all .2s;
}
.nav-menu a:hover, .nav-menu a.active {
    background: rgba(255,255,255,0.1);
    color: white;
}
.nav-menu a.active { background: var(--gradient); }
.nav-user {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-left: 1rem;
    padding-left: 1rem;
    border-left: 1px solid rgba(255,255,255,0.15);
}
.user-chip { display: flex; align-items: center; gap: .6rem; color: white; }
.avatar {
    width: 38px; height: 38px;
    border-radius: 50%;
    background: var(--gradient);
    display: flex; align-items: center; justify-content: center;
    font-weight: 700;
    color: white;
}
.nav-toggle { display: none; background: none; border: none; color: white; font-size: 1.4rem; cursor: pointer; }

/* ================== MAIN CONTENT ================== */
.main-content {
    flex: 1;
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
    width: 100%;
}

/* ================== HERO / LANDING ================== */
.hero {
    background: var(--gradient-dark);
    color: white;
    padding: 5rem 2rem;
    border-radius: var(--radius);
    margin-bottom: 3rem;
    position: relative;
    overflow: hidden;
    text-align: center;
}
.hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 20% 50%, rgba(108,99,255,0.3) 0%, transparent 50%),
                radial-gradient(circle at 80% 80%, rgba(0,201,167,0.3) 0%, transparent 50%);
}
.hero-content { position: relative; z-index: 1; max-width: 800px; margin: 0 auto; }
.hero h1 {
    font-size: 3.5rem;
    font-weight: 800;
    margin-bottom: 1rem;
    background: linear-gradient(135deg, #fff 0%, #00c9a7 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.hero p { font-size: 1.2rem; margin-bottom: 2rem; opacity: .9; }
.hero-buttons { display: flex; gap: 1rem; justify-content: center; flex-wrap: wrap; }

/* ================== BUTTONS ================== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    padding: .75rem 1.5rem;
    border-radius: 8px;
    font-weight: 600;
    font-size: .95rem;
    border: none;
    cursor: pointer;
    transition: all .25s;
    text-decoration: none;
    font-family: inherit;
}
.btn-primary { background: var(--gradient); color: white; box-shadow: 0 4px 15px rgba(108,99,255,0.3); }
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(108,99,255,0.4); color: white; }
.btn-secondary { background: white; color: var(--primary); border: 2px solid var(--primary); }
.btn-secondary:hover { background: var(--primary); color: white; }
.btn-outline { background: transparent; color: white; border: 1px solid rgba(255,255,255,0.3); }
.btn-outline:hover { background: rgba(255,255,255,0.1); color: white; }
.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { background: #e55a5a; color: white; }
.btn-success { background: var(--success); color: white; }
.btn-success:hover { background: #00b396; color: white; }
.btn-sm { padding: .4rem .9rem; font-size: .85rem; }
.btn-lg { padding: 1rem 2rem; font-size: 1.05rem; }

/* ================== CARDS ================== */
.card {
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.8rem;
    transition: all .25s;
}
.card:hover { box-shadow: var(--shadow-lg); transform: translateY(-2px); }
.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border);
}
.card-title { font-size: 1.3rem; font-weight: 700; color: var(--text); }

/* ================== STATS GRID ================== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}
.stat-card {
    background: white;
    padding: 1.5rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: all .25s;
}
.stat-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.stat-icon {
    width: 60px; height: 60px;
    border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.6rem;
    color: white;
}
.stat-icon.purple { background: linear-gradient(135deg, #6c63ff, #8b83ff); }
.stat-icon.green { background: linear-gradient(135deg, #00c9a7, #4dd9bd); }
.stat-icon.orange { background: linear-gradient(135deg, #ffa502, #ffc048); }
.stat-icon.red { background: linear-gradient(135deg, #ff6b6b, #ff9999); }
.stat-info h3 { font-size: 1.8rem; font-weight: 700; margin-bottom: .2rem; }
.stat-info p { color: var(--text-light); font-size: .9rem; }

/* ================== PAGE HEADER ================== */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    gap: 1rem;
}
.page-header h1 { font-size: 2rem; font-weight: 700; }
.page-header p { color: var(--text-light); margin-top: .3rem; }

/* ================== TABLES ================== */
.table-wrapper { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
table th, table td { padding: 1rem; text-align: left; border-bottom: 1px solid var(--border); }
table th {
    background: #f8f9fc;
    font-weight: 600;
    color: var(--text-light);
    font-size: .85rem;
    text-transform: uppercase;
    letter-spacing: .5px;
}
table tbody tr:hover { background: #f8f9fc; }
.badge {
    display: inline-block;
    padding: .3rem .7rem;
    border-radius: 20px;
    font-size: .75rem;
    font-weight: 600;
}
.bg-primary { background: rgba(108,99,255,0.15); color: var(--primary); }
.bg-success { background: rgba(0,201,167,0.15); color: var(--success); }
.bg-danger { background: rgba(255,107,107,0.15); color: var(--danger); }
.bg-warning { background: rgba(255,165,2,0.15); color: var(--warning); }
.bg-info { background: rgba(52,152,219,0.15); color: var(--info); }
.bg-secondary { background: rgba(99,110,114,0.15); color: var(--text-light); }

/* ================== FORMS ================== */
.form-group { margin-bottom: 1.2rem; }
.form-group label {
    display: block;
    margin-bottom: .4rem;
    font-weight: 500;
    font-size: .9rem;
    color: var(--text);
}
.form-control {
    width: 100%;
    padding: .75rem 1rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-family: inherit;
    font-size: .95rem;
    transition: all .2s;
    background: white;
}
.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(108,99,255,0.1);
}
textarea.form-control { resize: vertical; min-height: 100px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }

/* ================== AUTH PAGES ================== */
.auth-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--gradient-dark);
    padding: 2rem;
}
.auth-card {
    background: white;
    border-radius: 20px;
    padding: 3rem;
    width: 100%;
    max-width: 450px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}
.auth-logo {
    text-align: center;
    margin-bottom: 2rem;
}
.auth-logo i {
    font-size: 3rem;
    background: var(--gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.auth-logo h2 {
    font-size: 1.8rem;
    margin-top: .5rem;
    color: var(--text);
}
.auth-logo p { color: var(--text-light); margin-top: .3rem; }
.auth-tabs {
    display: flex;
    background: #f5f7fb;
    border-radius: 10px;
    padding: 4px;
    margin-bottom: 1.5rem;
}
.auth-tabs button {
    flex: 1;
    padding: .7rem;
    border: none;
    background: transparent;
    font-weight: 600;
    cursor: pointer;
    border-radius: 8px;
    transition: all .2s;
    font-family: inherit;
    color: var(--text-light);
}
.auth-tabs button.active {
    background: var(--gradient);
    color: white;
    box-shadow: 0 2px 8px rgba(108,99,255,0.3);
}
.auth-footer {
    text-align: center;
    margin-top: 1.5rem;
    color: var(--text-light);
    font-size: .9rem;
}

/* ================== ALERTS ================== */
.alert {
    padding: 1rem 1.2rem;
    border-radius: 8px;
    margin-bottom: 1.2rem;
    display: flex;
    align-items: center;
    gap: .7rem;
    font-size: .95rem;
}
.alert-success { background: rgba(0,201,167,0.1); color: var(--success); border-left: 4px solid var(--success); }
.alert-danger { background: rgba(255,107,107,0.1); color: var(--danger); border-left: 4px solid var(--danger); }
.alert-warning { background: rgba(255,165,2,0.1); color: var(--warning); border-left: 4px solid var(--warning); }
.alert-info { background: rgba(52,152,219,0.1); color: var(--info); border-left: 4px solid var(--info); }

/* ================== EXAM GRID ================== */
.exam-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.5rem;
}
.exam-card {
    background: white;
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: all .25s;
}
.exam-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }
.exam-card-header {
    padding: 1.5rem;
    color: white;
    background: var(--gradient);
    position: relative;
}
.exam-card-header h3 { font-size: 1.2rem; margin-bottom: .4rem; }
.exam-card-header p { opacity: .9; font-size: .9rem; }
.exam-card-body { padding: 1.5rem; }
.exam-meta {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: .8rem;
    margin-bottom: 1.2rem;
}
.exam-meta-item {
    display: flex;
    align-items: center;
    gap: .5rem;
    font-size: .85rem;
    color: var(--text-light);
}
.exam-meta-item i { color: var(--primary); }
.exam-card-actions {
    display: flex;
    gap: .5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

/* ================== EXAM TAKING ================== */
.exam-container {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 1.5rem;
}
.exam-main { background: white; border-radius: var(--radius); padding: 2rem; box-shadow: var(--shadow); }
.exam-sidebar { position: sticky; top: 90px; align-self: start; }
.timer-box {
    background: var(--gradient-dark);
    color: white;
    padding: 1.5rem;
    border-radius: var(--radius);
    text-align: center;
    margin-bottom: 1rem;
}
.timer-box .timer-label { font-size: .85rem; opacity: .8; margin-bottom: .3rem; }
.timer-box .timer-value { font-size: 2.2rem; font-weight: 700; font-family: 'Courier New', monospace; }
.timer-box.warning { background: linear-gradient(135deg, #ff6b6b, #ffa502); animation: pulse 1s infinite; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .85; } }

.question-nav {
    background: white;
    border-radius: var(--radius);
    padding: 1.2rem;
    box-shadow: var(--shadow);
}
.question-nav h4 { margin-bottom: 1rem; font-size: 1rem; }
.question-nav-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: .4rem;
}
.q-nav-btn {
    aspect-ratio: 1;
    border: 1px solid var(--border);
    background: white;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    font-size: .85rem;
    transition: all .2s;
}
.q-nav-btn:hover { border-color: var(--primary); }
.q-nav-btn.current { background: var(--primary); color: white; border-color: var(--primary); }
.q-nav-btn.answered { background: var(--success); color: white; border-color: var(--success); }
.q-nav-btn.marked { background: var(--warning); color: white; border-color: var(--warning); }

.question-block { animation: fadeIn .3s; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
.question-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border);
}
.question-text { font-size: 1.1rem; line-height: 1.7; margin-bottom: 1.5rem; }
.options-list { display: flex; flex-direction: column; gap: .8rem; }
.option-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.2rem;
    border: 2px solid var(--border);
    border-radius: 10px;
    cursor: pointer;
    transition: all .2s;
}
.option-item:hover { border-color: var(--primary); background: rgba(108,99,255,0.03); }
.option-item.selected { border-color: var(--primary); background: rgba(108,99,255,0.08); }
.option-item input { display: none; }
.option-radio {
    width: 22px; height: 22px;
    border: 2px solid var(--border);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
    transition: all .2s;
}
.option-item.selected .option-radio {
    border-color: var(--primary);
    background: var(--primary);
}
.option-item.selected .option-radio::after {
    content: '';
    width: 8px; height: 8px;
    background: white;
    border-radius: 50%;
}
.option-text { flex: 1; font-size: 1rem; }
.question-actions {
    display: flex;
    justify-content: space-between;
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
}

/* ================== RESULT ================== */
.result-hero {
    background: var(--gradient);
    color: white;
    padding: 3rem 2rem;
    border-radius: var(--radius);
    text-align: center;
    margin-bottom: 2rem;
}
.result-score {
    font-size: 4rem;
    font-weight: 800;
    margin: 1rem 0;
}
.result-status {
    display: inline-block;
    padding: .5rem 1.5rem;
    background: rgba(255,255,255,0.2);
    border-radius: 30px;
    font-weight: 600;
    margin-top: 1rem;
}
.result-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
    margin-top: 1.5rem;
}
.result-stat {
    background: rgba(255,255,255,0.15);
    padding: 1rem;
    border-radius: 10px;
}
.result-stat h4 { font-size: 1.8rem; font-weight: 700; }
.result-stat p { opacity: .9; font-size: .85rem; }

.review-item {
    background: white;
    border-radius: var(--radius);
    padding: 1.5rem;
    margin-bottom: 1rem;
    border-left: 4px solid var(--border);
}
.review-item.correct { border-left-color: var(--success); }
.review-item.wrong { border-left-color: var(--danger); }
.review-item.skipped { border-left-color: var(--warning); }
.review-q { font-weight: 600; margin-bottom: .8rem; }
.review-opt { padding: .4rem 0; font-size: .95rem; }
.review-opt.correct-answer { color: var(--success); font-weight: 600; }
.review-opt.wrong-answer { color: var(--danger); text-decoration: line-through; }

/* ================== CERTIFICATE ================== */
.certificate-preview {
    background: white;
    border: 10px double var(--primary);
    padding: 3rem;
    text-align: center;
    border-radius: 8px;
    margin: 2rem 0;
    position: relative;
}
.certificate-preview::before, .certificate-preview::after {
    content: '';
    position: absolute;
    width: 80px; height: 80px;
    background: var(--gradient);
    border-radius: 50%;
    opacity: .1;
}
.certificate-preview::before { top: 20px; left: 20px; }
.certificate-preview::after { bottom: 20px; right: 20px; }
.cert-header { margin-bottom: 2rem; }
.cert-header i { font-size: 3rem; color: var(--primary); margin-bottom: 1rem; }
.cert-header h1 {
    font-size: 2.5rem;
    background: var(--gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.cert-body h2 { font-size: 1.5rem; color: var(--text-light); margin-bottom: 1rem; }
.cert-name {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--primary);
    border-bottom: 2px solid var(--border);
    display: inline-block;
    padding: 0 2rem .5rem;
    margin: 1rem 0;
}
.cert-details { margin: 2rem 0; line-height: 2; }
.cert-footer {
    display: flex;
    justify-content: space-around;
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border);
}
.cert-sign { text-align: center; }
.cert-sign-line {
    width: 180px;
    border-top: 2px solid var(--text);
    margin: 0 auto .5rem;
}

/* ================== FOOTER ================== */
.main-footer {
    background: var(--gradient-dark);
    color: rgba(255,255,255,0.85);
    padding: 3rem 2rem 1rem;
    margin-top: auto;
}
.footer-container { max-width: 1400px; margin: 0 auto; }
.footer-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr;
    gap: 2rem;
    margin-bottom: 2rem;
}
.footer-grid h3, .footer-grid h4 { color: white; margin-bottom: 1rem; }
.footer-grid h3 i { color: var(--secondary); }
.footer-grid ul li { padding: .3rem 0; }
.footer-grid ul li i { margin-right: .5rem; color: var(--secondary); }
.footer-grid a { color: rgba(255,255,255,0.75); }
.footer-grid a:hover { color: var(--secondary); }
.social-links { display: flex; gap: .8rem; }
.social-links a {
    width: 40px; height: 40px;
    border-radius: 50%;
    background: rgba(255,255,255,0.1);
    display: flex; align-items: center; justify-content: center;
    color: white;
    transition: all .2s;
}
.social-links a:hover { background: var(--gradient); transform: translateY(-3px); }
.footer-bottom {
    text-align: center;
    padding-top: 1.5rem;
    border-top: 1px solid rgba(255,255,255,0.1);
    font-size: .9rem;
    opacity: .8;
}

/* ================== EMPTY STATE ================== */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-light);
}
.empty-state i { font-size: 4rem; margin-bottom: 1rem; opacity: .3; }
.empty-state h3 { margin-bottom: .5rem; color: var(--text); }

/* ================== RESPONSIVE ================== */
@media (max-width: 992px) {
    .exam-container { grid-template-columns: 1fr; }
    .exam-sidebar { position: static; }
    .footer-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 768px) {
    .nav-toggle { display: block; }
    .nav-menu {
        display: none;
        position: absolute;
        top: 70px; left: 0; right: 0;
        background: var(--dark-2);
        flex-direction: column;
        padding: 1rem;
        align-items: stretch;
    }
    .nav-menu.open { display: flex; }
    .nav-user { flex-direction: column; align-items: stretch; border-left: none; padding-left: 0; margin-left: 0; padding-top: 1rem; border-top: 1px solid rgba(255,255,255,0.15); }
    .hero h1 { font-size: 2.2rem; }
    .hero p { font-size: 1rem; }
    .main-content { padding: 1rem; }
    .form-row { grid-template-columns: 1fr; }
    .footer-grid { grid-template-columns: 1fr; }
    .page-header h1 { font-size: 1.5rem; }
    .certificate-preview { padding: 1.5rem; }
    .cert-name { font-size: 1.8rem; }
    .cert-header h1 { font-size: 1.8rem; }
    .auth-card { padding: 2rem 1.5rem; }
}
@media print {
    .main-nav, .main-footer, .no-print { display: none !important; }
    .main-content { padding: 0; }
    .certificate-preview { border: 10px double #000; box-shadow: none; }
}

/* Fix dropdown contrast */
.dropdown-menu {
    background: #ffffff !important;
    border: 1px solid #e2e8f0 !important;
    border-radius: 12px !important;
    padding: 6px !important;
}

.dropdown-item {
    color: #2d3748 !important;
    border-radius: 8px;
    font-size: 0.9rem;
    padding: 8px 12px !important;
    transition: all 0.2s;
}

.dropdown-item:hover {
    background: #f7fafc !important;
    color: #667eea !important;
}

.dropdown-item.text-danger {
    color: #e53e3e !important;
    font-weight: 600;
}

.dropdown-item.text-danger:hover {
    background: #fff5f5 !important;
    color: #c53030 !important;
}

.dropdown-header strong {
    color: #2d3748 !important;
}

.dropdown-divider {
    border-color: #f0f0f0 !important;
}