/* --- Google Fonts --- */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
    --next-green: #10b981;
    --next-green-hover: #059669;
    --prev-blue: #3b82f6;
    --prev-blue-hover: #2563eb;
    --bg-color: #f3f4f6;
    --white: #ffffff;
    --text-dark: #1f2937;
    --text-light: #6b7280;
    --danger: #ef4444;
    --marked: #f59e0b;
    --border: #e5e7eb;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    background-color: var(--bg-color);
    font-family: 'Inter', sans-serif;
    color: var(--text-dark);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* --- Layout --- */
.navbar {
    background: var(--white);
    padding: 0.8rem 10%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.logo { font-size: 1.3rem; font-weight: 700; }
.logo span { color: var(--next-green); }

.content-wrapper {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

/* --- Quiz Container (900px Width, Optimized Height) --- */
.quiz-container {
    background: var(--white);
    width: 100%;
    max-width: 900px; 
    min-height: 480px; 
    border-radius: 16px;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.1);
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.timer-area {
    position: absolute;
    top: 20px;
    right: 30px;
    display: flex;
    gap: 10px;
}

.timer-badge {
    background: var(--danger);
    color: white;
    padding: 4px 12px;
    border-radius: 50px;
    font-weight: 700;
    font-size: 0.85rem;
}

.pause-control {
    background: var(--text-dark);
    color: white;
    border: none;
    padding: 4px 10px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.8rem;
}

.quiz-header { padding: 2rem 3.5rem 0.5rem 3.5rem; }

.progress-info {
    display: flex;
    justify-content: space-between;
    font-size: 0.9rem;
    margin-bottom: 8px;
    font-weight: 600;
}

.progress-container {
    background: #e5e7eb;
    height: 8px;
    border-radius: 10px;
    margin-bottom: 1.5rem;
}

.progress-bar {
    height: 100%;
    background: var(--next-green);
    width: 0%;
    border-radius: 10px;
    transition: 0.4s;
}

h2 { font-size: 1.5rem; margin-bottom: 1.2rem; line-height: 1.3; }

/* --- Options --- */
ul { list-style: none; }
.option-item {
    margin: 8px 0;
    padding: 12px 25px;
    background: #f9fafb;
    border: 2px solid var(--border);
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 15px;
    cursor: pointer;
    transition: 0.2s;
}
.option-item:hover { border-color: var(--next-green); }
.option-item.selected { border-color: var(--next-green); background: #eef2ff; }
.option-item input[type="radio"] { width: 18px; height: 18px; accent-color: var(--next-green); }
.option-item label { cursor: pointer; font-size: 1.05rem; width: 100%; }

/* --- Navigation Buttons --- */
.quiz-footer {
    display: flex;
    gap: 12px;
    padding: 1rem 3.5rem 2rem 3.5rem;
}

.nav-btn {
    flex: 1;
    padding: 14px;
    border-radius: 10px;
    border: none;
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
    color: white;
}

.nav-btn.primary { background: var(--next-green); }
.nav-btn.primary:hover { background: var(--next-green-hover); }

#prev-btn { background: var(--prev-blue); }
#prev-btn:hover { background: var(--prev-blue-hover); }

.nav-btn.mark { background: #fffbeb; color: #92400e; border: 2px solid var(--marked); }
.nav-btn:disabled { opacity: 0.3; background: #e5e7eb !important; color: var(--text-light); border: none; }

/* --- Review Modal --- */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.6);
    display: none; justify-content: center; align-items: center;
    z-index: 1000;
}
.modal-box {
    background: white; padding: 30px; border-radius: 16px;
    width: 90%; max-width: 500px; text-align: center;
}
.grid-container { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; margin: 20px 0; }
.grid-item { padding: 12px; border-radius: 8px; border: 1px solid var(--border); font-weight: 600; cursor: pointer; }
.grid-item.answered { background: var(--next-green); color: white; border-color: var(--next-green); }
.grid-item.marked { background: var(--marked); color: white; border-color: var(--marked); }

.modal-actions { display: flex; gap: 10px; }
#close-review { background: var(--prev-blue); color: white; flex: 1; padding: 12px; border-radius: 8px; border: none; font-weight: 700; cursor: pointer; }
#final-submit-btn { background: var(--next-green); color: white; flex: 1; padding: 12px; border-radius: 8px; border: none; font-weight: 700; cursor: pointer; }

/* --- Results Summary --- */
.results-screen { padding: 2rem; max-height: 80vh; overflow-y: auto; text-align: left; }
.result-item { margin-bottom: 15px; padding: 12px; border-radius: 8px; border: 1px solid var(--border); }
.status-correct { color: var(--next-green); font-weight: 700; }
.status-wrong { color: var(--danger); font-weight: 700; }
.correct-label { color: var(--next-green); display: block; margin-top: 4px; font-weight: 600; }

.footer { background: var(--white); padding: 1rem; text-align: center; color: var(--text-light); border-top: 1px solid var(--border); font-size: 0.85rem; }

/* --- Review All Button (Navbar) --- */
#view-review-btn {
    background-color: transparent;
    color: var(--prev-blue);
    border: 2px solid var(--prev-blue);
    padding: 8px 20px;
    border-radius: 8px;
    font-weight: 700;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

#view-review-btn:hover {
    background-color: var(--prev-blue);
    color: white;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.2);
    transform: translateY(-1px);
}

#view-review-btn:active {
    transform: translateY(0);
}

/* --- New Top Bar Dashboard (Fixes Overlap) --- */
.quiz-top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.2rem 2.5rem;
    background-color: #fafafa;
    border-bottom: 1px solid var(--border);
}

.left-meta {
    display: flex;
    align-items: center;
    gap: 15px;
}

#question-number {
    font-weight: 600;
    color: var(--text-light);
    font-size: 0.9rem;
}

/* --- Enhanced Marked Tag Design --- */
.marked-tag {
    background: #fffbeb; /* Light Amber */
    color: #b45309; /* Deep Amber */
    border: 1px solid #fcd34d;
    padding: 4px 12px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 6px;
    box-shadow: 0 2px 4px rgba(245, 158, 11, 0.1);
    animation: tagPop 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes tagPop {
    0% { transform: scale(0.8); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

/* --- Right side Meta (Timer/Pause) --- */
.right-meta {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Remove 'position: absolute' from your old timer styles if it exists */
.timer-badge {
    background: var(--danger);
    color: white;
    padding: 5px 14px;
    border-radius: 50px;
    font-weight: 700;
    font-size: 0.85rem;
}

.pause-control {
    background: var(--text-dark);
    color: white;
    border: none;
    padding: 5px 12px;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
}

/* --- Clean Question Header Padding --- */
.quiz-header {
    padding: 1.5rem 3.5rem 0.5rem 3.5rem !important;
}

/* Ensure the Mark Button in footer looks consistent */
.nav-btn.mark {
    background: #fffbeb;
    color: #92400e;
    border: 2px solid #f59e0b;
}

.back-home-button {
      position: fixed;
      bottom: 70px;
      left: 50%;
      transform: translateX(-50%);
      background-color: #555;
      color: white;
      padding: 10px 20px;
      text-decoration: none;
      border-radius: 15px;
      font-weight: bold;
      z-index: 1000;
    }
    .back-home-button:hover {
      background-color: #333;
    }