/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Design System - Violet & Gold Theme */
:root {
    /* Base colors */
    --background: hsl(250, 15%, 8%);
    --surface: hsl(250, 15%, 12%);
    --surface-elevated: hsl(250, 15%, 16%);
    --foreground: hsl(45, 20%, 95%);
    --muted: hsl(250, 8%, 45%);
    
    /* Violet theme */
    --primary: hsl(270, 60%, 55%);
    --primary-light: hsl(270, 60%, 65%);
    --primary-dark: hsl(270, 60%, 45%);
    
    /* Gold accent */
    --gold: hsl(45, 85%, 65%);
    --gold-light: hsl(45, 85%, 75%);
    --gold-dark: hsl(45, 85%, 55%);
    
    /* State colors */
    --success: hsl(140, 60%, 50%);
    --error: hsl(0, 65%, 55%);
    --warning: hsl(35, 80%, 60%);
    
    /* Borders */
    --border: hsl(250, 15%, 20%);
    --border-light: hsl(250, 15%, 25%);
    
    /* Gradients */
    --gradient-primary: linear-gradient(135deg, var(--primary), var(--gold));
    --gradient-surface: linear-gradient(135deg, var(--surface), var(--surface-elevated));
    --gradient-glow: linear-gradient(135deg, 
        hsla(270, 60%, 55%, 0.1), 
        hsla(45, 85%, 65%, 0.1)
    );
    
    /* Shadows */
    --shadow-sm: 0 2px 8px hsla(270, 60%, 20%, 0.15);
    --shadow-md: 0 4px 16px hsla(270, 60%, 20%, 0.2);
    --shadow-lg: 0 8px 32px hsla(270, 60%, 20%, 0.25);
    --shadow-glow: 0 0 24px hsla(270, 60%, 55%, 0.3);
    
    /* Typography */
    --font-arabic: 'Amiri', serif;
    --font-main: 'Inter', system-ui, sans-serif;
    
    /* Spacing */
    --space-xs: 0.5rem;
    --space-sm: 1rem;
    --space-md: 1.5rem;
    --space-lg: 2rem;
    --space-xl: 3rem;
    
    /* Transitions */
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-fast: all 0.15s ease;
}

/* Base styles */
html {
    height: 100%;
    overflow-x: hidden;
}

body {
    font-family: var(--font-main);
    background: var(--background);
    color: var(--foreground);
    line-height: 1.6;
    min-height: 100vh;
    background-image: 
        radial-gradient(circle at 20% 20%, hsla(270, 60%, 25%, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, hsla(45, 85%, 35%, 0.1) 0%, transparent 50%);
}

/* Dashboard Layout */
.dashboard {
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: var(--space-lg);
}
.niveau-quiz {
  display: inline-block;
  margin-top: 0.5rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: #885dec;
  background: transparent;
 
  padding: 2px 8px;
  border-radius: 6px;
}

/* Configuration Panel */
.config-panel {
    max-width: 1200px;
    width: 100%;
    padding: var(--space-xl);
    background: var(--surface);
    border-radius: 24px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
}

.config-header {
    margin-bottom: var(--space-xl);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.config-header h2 {
    font-size: 2.5rem;
    font-weight: 700;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-align: center;
    flex: 1;
}

/* Collapsible Section */
.collapsible-section {
    margin-bottom: var(--space-xl);
    background: var(--surface-elevated);
    border: 1px solid var(--border);
    border-radius: 16px;
    overflow: hidden;
}

.collapsible-toggle {
    width: 100%;
    background: none;
    border: none;
    padding: var(--space-md);
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    color: var(--foreground);
    font-size: 1.1rem;
    font-weight: 600;
    transition: var(--transition);
}

.collapsible-toggle:hover {
    background: var(--gradient-glow);
}

.toggle-icon {
    transition: var(--transition);
    color: var(--primary);
}

.collapsible-toggle.active .toggle-icon {
    transform: rotate(180deg);
}

.collapsible-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.collapsible-content.active {
    max-height: 800px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.collapsible-content::-webkit-scrollbar {
    width: 8px;
}

.collapsible-content::-webkit-scrollbar-track {
    background: var(--surface);
    border-radius: 4px;
}

.collapsible-content::-webkit-scrollbar-thumb {
    background: var(--primary);
    border-radius: 4px;
}

.collapsible-content::-webkit-scrollbar-thumb:hover {
    background: var(--primary-light);
}

.mode-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: var(--space-sm);
    padding: var(--space-md);
}

.mode-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: var(--space-md);
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}
.mode-card.plage {
    background: rgb(49, 1, 49);
    border: 1px solid rgb(177, 13, 177);
    border-radius: 12px;
    padding: var(--space-md);
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.mode-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--gradient-glow);
    opacity: 0;
    transition: var(--transition);
}

.mode-card:hover {
    transform: translateY(-2px);
    border-color: var(--primary);
    box-shadow: var(--shadow-md);
}

.mode-card:hover::before {
    opacity: 0.3;
}

.mode-card.selected {
    border-color: var(--primary);
    background: var(--gradient-glow);
}

.mode-card > * {
    position: relative;
    z-index: 1;
}

.mode-icon {
    font-size: 2rem;
    margin-bottom: var(--space-xs);
}

.mode-card h3 {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--foreground);
    margin-bottom: 4px;
}

.mode-card p {
    font-size: 0.8rem;
    color: var(--muted);
}

/* Configuration Options */
.config-options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-lg);
    margin-bottom: var(--space-xl);
}

.config-section {
    background: var(--surface-elevated);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: var(--space-md);
}

.config-section h3 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--foreground);
    margin-bottom: var(--space-md);
    text-align: center;
}

.radio-group {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
}

.radio-option {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-xs);
    border-radius: 8px;
    cursor: pointer;
    transition: var(--transition);
}

.radio-option:hover {
    background: var(--gradient-glow);
}

.radio-option input[type="radio"] {
    display: none;
}

.radio-custom {
    width: 20px;
    height: 20px;
    border: 2px solid var(--border);
    border-radius: 50%;
    position: relative;
    transition: var(--transition);
}

.radio-custom::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0);
    width: 10px;
    height: 10px;
    background: var(--gradient-primary);
    border-radius: 50%;
    transition: var(--transition);
}

.radio-option input[type="radio"]:checked + .radio-custom {
    border-color: var(--primary);
}

.radio-option input[type="radio"]:checked + .radio-custom::after {
    transform: translate(-50%, -50%) scale(1);
}

.radio-option span:last-child {
    color: var(--foreground);
    font-weight: 500;
}

/* Start Section */
.start-section {
    text-align: center;
}

.btn-start {
    background: var(--gradient-primary);
    color: white;
    border: none;
    border-radius: 12px;
    padding: var(--space-md) var(--space-xl);
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    margin: 0 auto;
    box-shadow: var(--shadow-md);
}

.btn-start:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-start:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.btn-icon {
    font-size: 1.2rem;
}

/* Quiz Overlay */
.quiz-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--background);
    z-index: 1000;
    display: flex;
    flex-direction: column;
}

.quiz-overlay.hidden {
    display: none;
}

.quiz-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    max-height: 100vh;
}

.quiz-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-md);
    background: var(--surface-elevated);
    border-bottom: 1px solid var(--border);
}

.quiz-progress {
    text-align: center;
    color: var(--muted);
    font-weight: 600;
}

.btn-fullscreen {
    background: var(--surface-elevated);
    border: 2px solid var(--border);
    color: var(--primary);
    cursor: pointer;
    padding: var(--space-sm);
    border-radius: 12px;
    transition: var(--transition);
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}

.btn-fullscreen:hover {
    color: var(--foreground);
    background: var(--gradient-primary);
    border-color: var(--primary);
    transform: scale(1.1);
    box-shadow: var(--shadow-glow);
}

.btn-fullscreen i {
    transition: var(--transition);
}

.btn-ghost {
    background: none;
    border: none;
    color: var(--muted);
    cursor: pointer;
    padding: var(--space-xs) var(--space-sm);
    border-radius: 8px;
    transition: var(--transition);
}

.btn-ghost:hover {
    color: var(--foreground);
    background: var(--surface);
}

.quiz-content {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-md);
    overflow-y: auto;
}

.question-card {
    background: var(--surface-elevated);
    border: 1px solid var(--border);
    border-radius: 24px;
    padding: var(--space-xl) var(--space-xl) var(--space-lg);
    max-width: 1200px;
    width: 95%;
    height: 85vh;
    max-height: 85vh;
    box-shadow: var(--shadow-lg);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.question-header {
    text-align: center;
    margin-bottom: var(--space-xl);
}

.question-header h2 {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--foreground);
    margin-bottom: var(--space-xs);
}

.verse-info {
    color: var(--muted);
    font-size: 0.9rem;
}

.verse-container {
    text-align: center;
    margin-bottom: var(--space-lg);
    padding: var(--space-xl);
    background: var(--surface);
    border-radius: 20px;
    border: 1px solid var(--border);
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 200px;
}

.arabic-text {
    font-family: var(--font-arabic);
    font-size: 2.8rem;
    line-height: 1.8;
    color: var(--foreground);
    direction: rtl;
}

.highlighted-word {
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: bold;
}

.options-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-lg);
    margin-bottom: var(--space-lg);
    flex-shrink: 0;
}

.option-button {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: var(--space-lg) var(--space-md);
    cursor: pointer;
    transition: var(--transition);
    color: var(--foreground);
    font-family: var(--font-arabic);
    font-size: 1.8rem;
    text-align: center;
    min-height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1.4;
}

.option-button:hover:not(:disabled) {
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.option-button.correct {
    background: var(--success);
    border-color: var(--success);
    color: white;
}

.option-button.incorrect {
    background: var(--error);
    border-color: var(--error);
    color: white;
}

.result-container {
    text-align: center;
    margin-bottom: var(--space-md);
}

.result-container.hidden {
    display: none;
}

.result-message {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: var(--space-md);
    padding: var(--space-md);
    border-radius: 12px;
}

.result-message.correct {
    background: hsla(140, 60%, 50%, 0.1);
    color: var(--success);
    border: 1px solid var(--success);
}

.result-message.incorrect {
    background: hsla(0, 65%, 55%, 0.1);
    color: var(--error);
    border: 1px solid var(--error);
}

.btn-next {
    background: var(--gradient-primary);
    color: white;
    border: none;
    border-radius: 12px;
    padding: var(--space-sm) var(--space-lg);
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.btn-next:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.translation-container {
    text-align: center;
    padding: var(--space-md);
    background: var(--gradient-glow);
    border-radius: 16px;
    margin-top: auto;
    flex-shrink: 0;
}

.translation {
    color: var(--muted);
    font-style: italic;
    font-size: 1.1rem;
    line-height: 1.5;
}

/* Results Screen */
.results-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--background);
    z-index: 1000;
    padding: var(--space-lg);
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.results-overlay.hidden {
    display: none;
}

.results-container {
    max-width: 800px;
    width: 100%;
    margin: 0 auto;
    min-height: min-content;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.results-card {
    background: var(--surface-elevated);
    border: 1px solid var(--border);
    border-radius: 24px;
    padding: var(--space-xl);
    box-shadow: var(--shadow-lg);
    flex: 1;
    margin: var(--space-sm) 0;
}

.results-header {
    margin-bottom: var(--space-xl);
}

.results-icon {
    font-size: 4rem;
    margin-bottom: var(--space-md);
}

.results-header h2 {
    font-size: 2rem;
    font-weight: 700;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.results-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-lg);
    margin-bottom: var(--space-xl);
}

.result-stat {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: var(--space-md);
}

.result-stat .stat-number {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 4px;
}

.result-stat .stat-label {
    color: var(--muted);
    font-size: 0.9rem;
}

.individual-results {
    margin-bottom: var(--space-xl);
    text-align: left;
}

.results-actions {
    display: flex;
    gap: var(--space-md);
    justify-content: center;
}

.btn-primary, .btn-secondary {
    padding: var(--space-sm) var(--space-lg);
    border-radius: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    border: none;
}

.btn-primary {
    background: var(--gradient-primary);
    color: white;
}

.btn-secondary {
    background: var(--surface);
    color: var(--foreground);
    border: 1px solid var(--border);
}

.btn-primary:hover, .btn-secondary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-lg);
}

.modal-overlay.hidden {
    display: none;
}

.modal-content {
    background: var(--surface-elevated);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: var(--space-xl);
    max-width: 400px;
    width: 100%;
    text-align: center;
}

.modal-content h3 {
    margin-bottom: var(--space-md);
    color: var(--foreground);
}

.modal-content select {
    width: 100%;
    padding: var(--space-sm);
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
    color: var(--foreground);
    margin-bottom: var(--space-md);
}

.modal-actions {
    display: flex;
    gap: var(--space-sm);
    justify-content: center;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .dashboard {
        padding: var(--space-md);
    }

    .config-panel {
        padding: var(--space-lg);
    }

    .config-options {
        grid-template-columns: 1fr;
    }
    
    .question-card {
        max-width: 900px;
        width: 98%;
    }
    
    .arabic-text {
        font-size: 2.4rem;
    }
    
    .option-button {
        font-size: 1.6rem;
        min-height: 70px;
    }
}

@media (max-width: 768px) {
    .dashboard {
        padding: var(--space-sm);
    }

    .config-panel {
        padding: var(--space-md);
    }

    .config-header h2 {
        font-size: 1.8rem;
    }

    .collapsible-content.active {
        max-height: 60vh;
    }

    .mode-grid {
        grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    }
    
    .options-grid {
        grid-template-columns: 1fr;
    }
    
    .results-stats {
        grid-template-columns: 1fr;
    }
    
    .results-actions {
        flex-direction: column;
    }
    
    .results-overlay {
        padding: var(--space-sm);
    }
    
    .results-container {
        max-width: 100%;
    }
    
    .results-card {
        padding: var(--space-lg);
        margin: var(--space-xs) 0;
    }
    
    .quiz-header {
        flex-direction: column;
        gap: var(--space-xs);
        text-align: center;
    }
    
    .question-card {
        height: 90vh;
        width: 95%;
        padding: var(--space-md);
    }
    
    .arabic-text {
        font-size: 2rem;
    }
    
    .option-button {
        font-size: 1.4rem;
        min-height: 60px;
        padding: var(--space-md);
    }
}

@media (max-width: 480px) {
    .dashboard {
        padding: var(--space-xs);
    }

    .config-panel {
        padding: var(--space-sm);
        border-radius: 16px;
    }
    
    .question-card {
        padding: var(--space-sm);
        height: 95vh;
    }
    
    .arabic-text {
        font-size: 1.6rem;
    }
    
    .option-button {
        font-size: 1.2rem;
        min-height: 50px;
    }
    
    .modal-content {
        margin: var(--space-sm);
    }
}

        /* Floating Home Button */
.home-btn {
  position: fixed;
  left: 24px;
  bottom: 40px;
  width: 50px;
  height: 50px;
  background: rgb(104, 2, 104);
  border: none;
  border-radius: 50%;
  color: white;
  cursor: pointer;
  box-shadow: var(--shadow-glow);
  transition: var(--transition-smooth);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
}

.home-btn:hover {
  transform: scale(1.1);
  box-shadow: 0 0 30px hsl(var(--primary) / 0.5);
}
