/* ============================================
   JAMB Quiz App - Updated Styles with AdSterra Integration
   ============================================ */

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

:root {
    --primary-color: #1a472a;
    --secondary-color: #667eea;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    --text-dark: #1f2937;
    --text-light: #6b7280;
    --bg-light: #f9fafb;
    --border-color: #e5e7eb;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: var(--text-dark);
    background: var(--bg-light);
    padding-top: 70px; /* Space for fixed social bar */
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* ============================================
   AD CONTAINER STYLES
   ============================================ */
.ad-container {
    margin: 20px auto;
    padding: 15px;
    text-align: center;
    background: #f9f9f9;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
}

.adsterra-social-bar{
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 5px 0;
    min-height: 60px;
    background: #ffffff;
    border-bottom: 1px solid rgba(0,0,0,0.08);
}

/* ============================================
   SCREEN MANAGEMENT
   ============================================ */
.screen {
    display: none;
    animation: fadeIn 0.3s ease-in;
}

.screen.active {
    display: block;
}

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

/* ============================================
   HEADER STYLES
   ============================================ */
.app-header {
    text-align: center;
    padding: 30px 0;
    background: linear-gradient(135deg, var(--primary-color) 0%, #2d5a3d 100%);
    color: white;
    border-radius: 12px;
    margin-bottom: 30px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.logo h1 {
    font-size: 2.5em;
    margin-bottom: 5px;
}

.logo p {
    font-size: 1.1em;
    opacity: 0.9;
}

.screen-header {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 2px solid var(--border-color);
}

.screen-header h2 {
    flex: 1;
    color: var(--primary-color);
}

.btn-back {
    padding: 10px 20px;
    background: var(--text-light);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
    transition: all 0.3s;
}

.btn-back:hover {
    background: var(--text-dark);
    transform: translateX(-2px);
}

/* ============================================
   MODE SELECTION
   ============================================ */
.mode-selection {
    margin-bottom: 40px;
}

.mode-selection h2 {
    text-align: center;
    color: var(--primary-color);
    margin-bottom: 30px;
    font-size: 1.8em;
}

.mode-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.mode-card {
    background: white;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    text-align: center;
    transition: all 0.3s;
    border: 2px solid transparent;
}

.mode-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    border-color: var(--primary-color);
}

.mode-card.single-subject-card:hover {
    border-color: var(--secondary-color);
}

.mode-icon {
    font-size: 3em;
    margin-bottom: 15px;
}

.mode-card h3 {
    color: var(--text-dark);
    margin-bottom: 10px;
    font-size: 1.5em;
}

.mode-card p {
    color: var(--text-light);
    margin-bottom: 8px;
}

.mode-detail {
    font-size: 0.9em;
    color: var(--text-light);
    margin-bottom: 20px;
}

/* ============================================
   BUTTONS
   ============================================ */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    transition: all 0.3s;
    text-decoration: none;
    display: inline-block;
}

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

.btn-primary:hover {
    background: #153c22;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

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

.btn-secondary:hover {
    background: #5568d3;
    transform: translateY(-2px);
}

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

.btn-success:hover {
    background: #059669;
}

.btn-large {
    width: 100%;
    padding: 16px;
    font-size: 18px;
    margin-top: 20px;
}

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

.btn-whatsapp {
    background: #25D366;
    color: white;
    padding: 12px 24px;
    border-radius: 8px;
    font-weight: 600;
}

.btn-whatsapp:hover {
    background: #20BA5A;
}

/* ============================================
   SUBJECT SELECTION
   ============================================ */
.subject-note {
    background: #fef3c7;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    border-left: 4px solid var(--warning-color);
}

.subject-note p {
    margin: 5px 0;
}

.mode-info {
    font-weight: 600;
    color: var(--primary-color);
    margin-top: 10px;
}

.subjects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 15px;
    margin: 20px 0;
}

.subject-card {
    background: white;
    padding: 20px;
    border-radius: 10px;
    text-align: center;
    cursor: pointer;
    border: 2px solid var(--border-color);
    transition: all 0.3s;
    position: relative;
}

.subject-card:hover {
    border-color: var(--primary-color);
    transform: translateY(-3px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.subject-card.selected {
    border-color: var(--primary-color);
    background: #f0fdf4;
}

.subject-card.compulsory {
    border-color: var(--primary-color);
    background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
}

.subject-icon {
    font-size: 2.5em;
    margin-bottom: 10px;
}

.subject-card h3 {
    font-size: 1em;
    color: var(--text-dark);
    margin-bottom: 10px;
}

.subject-checkbox {
    width: 20px;
    height: 20px;
    cursor: pointer;
}

.compulsory-badge {
    background: var(--primary-color);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.75em;
    margin-top: 5px;
    display: inline-block;
}

.selection-info {
    text-align: center;
    font-size: 1.2em;
    font-weight: 600;
    color: var(--primary-color);
    margin: 20px 0;
}

/* ============================================
   STATISTICS SECTION
   ============================================ */
.stats-section {
    background: white;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    margin-top: 30px;
}

.stats-section h3 {
    text-align: center;
    color: var(--primary-color);
    margin-bottom: 20px;
    font-size: 1.5em;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.stat-card {
    background: linear-gradient(135deg, var(--primary-color) 0%, #2d5a3d 100%);
    color: white;
    padding: 25px;
    border-radius: 10px;
    text-align: center;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

.stat-value {
    font-size: 2.5em;
    font-weight: bold;
    margin-bottom: 5px;
}

.stat-label {
    font-size: 0.9em;
    opacity: 0.9;
}

/* ============================================
   QUIZ SCREEN
   ============================================ */
.quiz-header {
    background: white;
    padding: 15px 20px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 60px; /* Below social bar */
    z-index: 100;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.quiz-info {
    display: flex;
    gap: 20px;
    align-items: center;
}

.timer {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1.2em;
    font-weight: bold;
    color: var(--primary-color);
}

.progress-info {
    font-size: 1.1em;
    color: var(--text-light);
}

.subject-indicator {
    background: var(--primary-color);
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.9em;
    font-weight: 600;
}

.quiz-container {
    max-width: 900px;
    margin: 30px auto;
    background: white;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: var(--border-color);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 30px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color) 0%, var(--success-color) 100%);
    transition: width 0.3s ease;
}

.question-section {
    margin-bottom: 30px;
}

.question-number {
    color: var(--text-light);
    font-size: 0.9em;
    margin-bottom: 10px;
}

.passage-box {
    background: #f8fafc;
    border-left: 4px solid var(--secondary-color);
    padding: 20px;
    margin: 20px 0;
    border-radius: 8px;
    font-size: 0.95em;
    line-height: 1.8;
    color: var(--text-dark);
}

.question-text {
    font-size: 1.2em;
    color: var(--text-dark);
    margin-bottom: 25px;
    font-weight: 500;
    line-height: 1.6;
}

.options-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.option {
    padding: 18px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 12px;
    background: white;
}

.option:hover {
    border-color: var(--primary-color);
    background: #f0fdf4;
}

.option.selected {
    border-color: var(--primary-color);
    background: #dcfce7;
}

.option-letter {
    background: var(--primary-color);
    color: white;
    width: 35px;
    height: 35px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    flex-shrink: 0;
}

.option.selected .option-letter {
    background: var(--success-color);
}

.quiz-navigation {
    display: flex;
    justify-content: space-between;
    gap: 15px;
    margin-top: 30px;
}

.quiz-navigation .btn {
    flex: 1;
}

/* ============================================
   QUESTION NAVIGATOR
   ============================================ */
.question-navigator {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 2px solid var(--border-color);
}

.btn-toggle-nav {
    width: 100%;
    padding: 12px;
    background: var(--text-light);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
    margin-bottom: 15px;
}

.nav-grid {
    display: none;
    grid-template-columns: repeat(auto-fill, minmax(50px, 1fr));
    gap: 10px;
    margin-top: 15px;
}

.nav-grid.active {
    display: grid;
}

.nav-item {
    width: 50px;
    height: 50px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.3s;
    background: white;
}

.nav-item:hover {
    border-color: var(--primary-color);
    transform: scale(1.05);
}

.nav-item.current {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.nav-item.answered {
    background: #dcfce7;
    border-color: var(--success-color);
}

/* ============================================
   RESULTS SCREEN
   ============================================ */
.results-container {
    max-width: 800px;
    margin: 0 auto;
    background: white;
    padding: 40px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.results-header {
    text-align: center;
    margin-bottom: 30px;
}

.results-icon {
    font-size: 4em;
    margin-bottom: 15px;
}

.results-header h2 {
    color: var(--primary-color);
    font-size: 2em;
}

.score-display {
    display: flex;
    justify-content: center;
    margin: 30px 0;
}

.score-circle {
    position: relative;
    width: 200px;
    height: 200px;
}

.score-circle svg {
    transform: rotate(-90deg);
}

.score-bg {
    fill: none;
    stroke: var(--border-color);
    stroke-width: 12;
}

.score-progress {
    fill: none;
    stroke: var(--success-color);
    stroke-width: 12;
    stroke-linecap: round;
    stroke-dasharray: 565.48;
    stroke-dashoffset: 565.48;
    transition: stroke-dashoffset 1s ease;
}

.score-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
}

.score-percentage {
    font-size: 2.5em;
    font-weight: bold;
    color: var(--primary-color);
}

.score-label {
    color: var(--text-light);
    font-size: 1em;
}

.results-summary {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin: 30px 0;
}

.summary-card {
    text-align: center;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

.summary-card.correct {
    background: linear-gradient(135deg, #dcfce7 0%, #bbf7d0 100%);
}

.summary-card.wrong {
    background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
}

.summary-card.unanswered {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
}

.summary-icon {
    font-size: 2em;
    margin-bottom: 10px;
}

.summary-value {
    font-size: 2em;
    font-weight: bold;
    color: var(--text-dark);
}

.summary-label {
    color: var(--text-light);
    font-size: 0.9em;
}

.subject-breakdown {
    margin: 30px 0;
    padding: 20px;
    background: var(--bg-light);
    border-radius: 10px;
}

.subject-breakdown h3 {
    color: var(--primary-color);
    margin-bottom: 15px;
}

.subject-score {
    display: flex;
    justify-content: space-between;
    padding: 12px;
    margin-bottom: 10px;
    background: white;
    border-radius: 8px;
    border-left: 4px solid var(--primary-color);
}

.results-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-top: 30px;
}

.results-actions .btn {
    flex: 1;
    max-width: 200px;
}

/* ============================================
   REVIEW SCREEN
   ============================================ */
.review-filters {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.filter-btn {
    padding: 10px 20px;
    border: 2px solid var(--border-color);
    background: white;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
    font-weight: 600;
}

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

.filter-btn.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.review-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.review-question {
    background: white;
    padding: 25px;
    border-radius: 10px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
    border-left: 4px solid var(--border-color);
}

.review-question.correct {
    border-left-color: var(--success-color);
    background: #f0fdf4;
}

.review-question.wrong {
    border-left-color: var(--danger-color);
    background: #fef2f2;
}

.review-question.unanswered {
    border-left-color: var(--warning-color);
    background: #fffbeb;
}

.review-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.review-status {
    padding: 6px 12px;
    border-radius: 6px;
    font-weight: 600;
    font-size: 0.9em;
}

.review-status.correct {
    background: var(--success-color);
    color: white;
}

.review-status.wrong {
    background: var(--danger-color);
    color: white;
}

.review-status.unanswered {
    background: var(--warning-color);
    color: white;
}

.review-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 15px;
}

.review-option {
    padding: 12px;
    border-radius: 6px;
    border: 2px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 10px;
}

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

.review-option.user-wrong {
    background: #fee2e2;
    border-color: var(--danger-color);
}

/* ============================================
   RESPONSIVE DESIGN
   ============================================ */
@media (max-width: 768px) {
    body {
        padding-top: 60px;
    }
    
    .container {
        padding: 15px;
    }
    
    .mode-cards {
        grid-template-columns: 1fr;
    }
    
    .subjects-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
        gap: 10px;
    }
    
    .quiz-header {
        flex-direction: column;
        gap: 10px;
        top: 60px;
    }
    
    .quiz-info {
        width: 100%;
        justify-content: space-between;
    }
    
    .results-summary {
        grid-template-columns: 1fr;
    }
    
    .results-actions {
        flex-direction: column;
    }
    
    .results-actions .btn {
        max-width: 100%;
    }
    
    .review-filters {
        justify-content: center;
    }
    
    .filter-btn {
        flex: 1;
        min-width: 120px;
    }
    
    .ad-container {
        padding: 10px;
    }
}

@media (max-width: 480px) {
    .logo h1 {
        font-size: 2em;
    }
    
    .subject-card {
        padding: 15px;
    }
    
    .quiz-container {
        padding: 20px 15px;
    }
    
    .question-text {
        font-size: 1.1em;
    }
    
    .quiz-navigation {
        flex-direction: column;
    }
}

/* ============================================
   UTILITY CLASSES
   ============================================ */
.hidden {
    display: none !important;
}

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

.mt-20 {
    margin-top: 20px;
}

.mb-20 {
    margin-bottom: 20px;
}

/* ============================================
   AD CONTAINER STYLING
   ============================================ */
.ad-container {
  margin: 30px auto;
  padding: 15px;
  text-align: center;
  background: #f9f9f9;
  border-radius: 8px;
  border: 1px solid #e5e7eb;
  max-width: 100%;
  min-height: 100px;
}

.ad-container::before {
  content: 'Advertisement';
  display: block;
  font-size: 10px;
  color: #999;
  margin-bottom: 5px;
  text-transform: uppercase;
  letter-spacing: 1px;
}
/* ===== ADSTERRA SOCIAL BAR STYLING ===== */
#adsterra-social-bar {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  width: 100% !important;
  z-index: 2147483647 !important; /* highest possible */
  background: transparent !important;
  overflow: visible !important;
  min-height: 60px !important;
}

/* Ensure it shows even when content loads (not :empty) */
#adsterra-social-bar:not(:empty) {
  min-height: 60px !important;
  display: block !important;
}

/* Force inner content (iframe/div) to fill height */
#adsterra-social-bar > * {
  display: block !important;
  width: 100% !important;
  height: 100% !important;
  max-height: 60px !important;
}

/* Optional: add subtle shadow for visibility */
#adsterra-social-bar::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  right: 0;
  height: 2px;
  background: rgba(0,0,0,0.1);
  box-shadow: 0 2px 6px rgba(0,0,0,0.05);
}
/* Ensure ads are visible on mobile */
@media (max-width: 768px) {
    .ad-container {
        margin: 20px 10px;
        padding: 8px;
    }
}

/* (Removed) bottom social-bar spacing: bar is on top now */
