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

:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --secondary: #8b5cf6;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --bg-dark: #0f172a;
    --bg-card: #1e293b;
    --bg-card-hover: #334155;
    --text-light: #f1f5f9;
    --text-gray: #94a3b8;
    --border: #334155;
    --gradient-1: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --gradient-2: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    --gradient-3: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    --gradient-4: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%);
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg-dark);
    color: var(--text-light);
    overflow-x: hidden;
}

/* Page Management */
.page {
    display: none;
    min-height: 100vh;
}

.page.active {
    display: block;
}

/* Auth Page Styles */
.auth-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
    padding: 20px;
}

.auth-card {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 24px;
    padding: 40px;
    width: 100%;
    max-width: 450px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.auth-header {
    text-align: center;
    margin-bottom: 32px;
}

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 8px;
}

.logo-icon {
    font-size: 48px;
}

.logo h1 {
    font-size: 28px;
    font-weight: 700;
    color: white;
}

.tagline {
    color: rgba(255, 255, 255, 0.9);
    font-size: 16px;
}

.auth-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 24px;
    background: rgba(0, 0, 0, 0.2);
    padding: 4px;
    border-radius: 12px;
}

.auth-tab {
    flex: 1;
    padding: 12px;
    border: none;
    background: transparent;
    color: rgba(255, 255, 255, 0.7);
    font-size: 15px;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.auth-tab.active {
    background: white;
    color: var(--primary);
}

.auth-form {
    display: none;
}

.auth-form.active {
    display: block;
}

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

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: white;
    font-weight: 500;
    font-size: 14px;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.9);
    border: 2px solid transparent;
    border-radius: 10px;
    font-size: 15px;
    color: #1e293b;
    transition: all 0.3s ease;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    background: white;
}

.form-group textarea {
    resize: vertical;
    font-family: 'Inter', sans-serif;
}

/* Buttons (Using .btn from design-system.css, overriding for app style) */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

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

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(99, 102, 241, 0.3);
}

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

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

.btn-accent {
    background: var(--gradient-4);
    color: var(--bg-dark); /* Changed for better contrast */
}

.btn-accent:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(67, 233, 123, 0.3);
}

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

.btn-success:hover {
    background: #059669;
    transform: translateY(-2px);
}

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

.btn-danger:hover {
    background: #dc2626;
    transform: translateY(-2px);
}

.btn-ghost {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.btn-ghost:hover {
    background: rgba(255, 255, 255, 0.2);
}

.btn-block {
    width: 100%;
    margin-bottom: 12px;
}

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

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

.icon-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    padding: 10px;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 20px;
}

.icon-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
}

/* Navigation */
.navbar {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    padding: 16px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(10px);
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 20px;
    font-weight: 700;
}

.brand-text {
    display: none;
}

.nav-menu {
    display: flex;
    gap: 8px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: transparent;
    border: none;
    color: var(--text-gray);
    font-size: 14px;
    font-weight: 500;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-light);
}

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

.nav-item span:last-child {
    display: none;
}

.nav-icon {
    font-size: 20px;
}

.mobile-menu-toggle {
    display: none;
    flex-direction: column;
    gap: 4px;
    background: transparent;
    border: none;
    cursor: pointer;
}

.mobile-menu-toggle span {
    width: 24px;
    height: 3px;
    background: var(--text-light);
    border-radius: 2px;
    transition: all 0.3s ease;
}

/* App Sections */
.app-section {
    display: none;
    padding: 24px;
    max-width: 1400px;
    margin: 0 auto;
}

.app-section.active {
    display: block;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 32px;
    flex-wrap: wrap;
    gap: 16px;
}

.section-header h2 {
    font-size: 32px;
    font-weight: 700;
    margin-bottom: 4px;
}

.section-subtitle {
    color: var(--text-gray);
    font-size: 16px;
}

/* Streak Badge */
.streak-badge {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--gradient-2);
    padding: 16px 24px;
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(239, 68, 68, 0.3);
}

.streak-icon {
    font-size: 32px;
}

.streak-number {
    font-size: 28px;
    font-weight: 700;
    line-height: 1;
}

.streak-label {
    font-size: 12px;
    opacity: 0.9;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 32px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 16px;
    transition: all 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    border-color: var(--primary);
}

.stat-icon {
    width: 56px;
    height: 56px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
}

.stat-label {
    font-size: 14px;
    color: var(--text-gray);
    margin-bottom: 4px;
}

.stat-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-light);
}

/* Action Grid */
.action-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 32px;
}

.action-card {
    background: var(--bg-card);
    border: 2px solid var(--border);
    border-radius: 16px;
    padding: 32px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.action-card:hover {
    transform: translateY(-4px);
    border-color: var(--primary);
    background: var(--bg-card-hover);
    box-shadow: 0 10px 30px rgba(99, 102, 241, 0.2);
}

.action-icon {
    font-size: 48px;
    margin-bottom: 16px;
}

.action-card h3 {
    font-size: 20px;
    margin-bottom: 8px;
}

.action-card p {
    color: var(--text-gray);
    font-size: 14px;
    margin: 0; /* Override default p margin */
}

/* Dashboard Bottom */
.dashboard-bottom {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.recent-activity-card,
.achievements-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 24px;
}

.recent-activity-card h3,
.achievements-card h3 {
    font-size: 18px;
    margin-bottom: 20px;
}

.activity-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.activity-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 10px;
}

.activity-icon {
    font-size: 24px;
    flex-shrink: 0;
}

.activity-text {
    font-size: 14px;
    color: var(--text-light);
    margin-bottom: 4px;
}

.activity-time {
    font-size: 12px;
    color: var(--text-gray);
}

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

.badge-placeholder {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 32px;
    background: rgba(255, 255, 255, 0.03);
    border: 2px dashed var(--border);
    border-radius: 12px;
    text-align: center;
}

.badge-placeholder span {
    font-size: 48px;
    margin-bottom: 8px;
}

.badge-placeholder p {
    font-size: 14px;
    color: var(--text-gray);
    margin: 0; /* Override default p margin */
}

/* Upload Section */
.upload-container {
    max-width: 800px;
    margin: 0 auto;
}

.upload-area {
    border: 3px dashed var(--border);
    border-radius: 16px;
    padding: 60px 40px;
    text-align: center;
    background: rgba(255, 255, 255, 0.02);
    transition: all 0.3s ease;
    cursor: pointer;
}

.upload-area:hover,
.upload-area.dragover {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.05);
}

.upload-icon {
    font-size: 64px;
    margin-bottom: 16px;
}

.upload-area h3 {
    font-size: 20px;
    margin-bottom: 8px;
}

.upload-area p {
    color: var(--text-gray);
    margin-bottom: 20px;
}

.divider {
    text-align: center;
    margin: 32px 0;
    position: relative;
}

.divider::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    background: var(--border);
}

.divider span {
    position: relative;
    background: var(--bg-dark);
    padding: 0 16px;
    color: var(--text-gray);
    font-size: 14px;
    font-weight: 600;
}

.text-input-area {
    margin-bottom: 24px;
}

.text-input-area label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--text-light);
}

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

.generate-options {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.generate-options .btn {
    flex: 1;
    min-width: 200px;
}

/* Quiz Section */
.quiz-view {
    display: none;
}

.quiz-view.active {
    display: block;
}

.quiz-start-card,
.flashcards-start-card,
.flashcards-complete-card {
    max-width: 600px;
    margin: 60px auto;
    text-align: center;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 24px;
    padding: 60px 40px;
}

.quiz-icon,
.flashcard-icon,
.complete-icon {
    font-size: 80px;
    margin-bottom: 24px;
}

.quiz-start-card h2,
.flashcards-start-card h2,
.flashcards-complete-card h2 {
    font-size: 32px;
    margin-bottom: 12px;
}

.quiz-start-card p,
.flashcards-start-card p,
.flashcards-complete-card p {
    color: var(--text-gray);
    font-size: 16px;
    margin-bottom: 32px;
}

.quiz-options {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin: 24px 0;
}

.checkbox-option {
    display: flex;
    align-items: center;
    justify-content: center; /* Center the checkbox */
    gap: 8px;
    font-size: 15px;
    cursor: pointer;
}

.checkbox-option input {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.quiz-header {
    margin-bottom: 32px;
}

.quiz-progress-bar {
    height: 8px;
    background: var(--bg-card);
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 12px;
}

.quiz-progress-fill {
    height: 100%;
    background: var(--gradient-3);
    transition: width 0.3s ease;
}

.quiz-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 14px;
    color: var(--text-gray);
}

.quiz-timer {
    font-weight: 600;
    color: var(--warning);
    font-size: 16px;
}

.quiz-timer.hidden {
    display: none;
}

.quiz-content {
    max-width: 800px;
    margin: 0 auto;
}

.question-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 32px;
    margin-bottom: 24px;
}

.question-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 24px;
}

.question-header h3 {
    flex: 1;
    font-size: 20px;
    line-height: 1.5;
}

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

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

.option {
    padding: 16px 20px;
    background: rgba(255, 255, 255, 0.03);
    border: 2px solid var(--border);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 15px;
    text-align: left;
    color: var(--text-light); /* Ensure text is light */
}

.option:hover {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.1);
}

.option.selected {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.2);
}

.option.correct {
    border-color: var(--success);
    background: rgba(16, 185, 129, 0.2);
}

.option.incorrect {
    border-color: var(--danger);
    background: rgba(239, 68, 68, 0.2);
}

.quiz-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.quiz-nav-buttons {
    display: flex;
    gap: 12px;
}

.explanation-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 24px;
    animation: slideUp 0.3s ease;
}

.explanation-card.hidden {
    display: none;
}

.explanation-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.explanation-header span {
    font-size: 32px;
}

.explanation-header h4 {
    font-size: 20px;
}

#explanation-text {
    color: var(--text-gray);
    line-height: 1.6;
    margin-bottom: 20px;
}

/* Results */
.results-card {
    max-width: 600px;
    margin: 60px auto;
    text-align: center;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 24px;
    padding: 60px 40px;
    position: relative;
    overflow: hidden;
}

#results-confetti {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
}

.results-icon {
    font-size: 80px;
    margin-bottom: 16px;
}

#results-title {
    font-size: 32px;
    margin-bottom: 32px;
}

.results-score {
    margin-bottom: 32px;
}

.score-circle {
    width: 160px;
    height: 160px;
    border-radius: 50%;
    background: var(--gradient-3);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
    box-shadow: 0 10px 40px rgba(79, 172, 254, 0.4);
}

#score-percentage {
    font-size: 48px;
    font-weight: 700;
    color: white;
}

#score-text {
    font-size: 18px;
    color: var(--text-gray);
}

.results-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-bottom: 32px;
    padding: 24px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 12px;
}

.result-stat {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.result-stat .stat-label {
    font-size: 13px;
    color: var(--text-gray);
}

.result-stat .stat-value {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-light);
}

.badges-earned {
    margin-bottom: 24px;
    padding: 24px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 12px;
}

.badges-earned.hidden {
    display: none;
}

.results-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Flashcards */
.flashcards-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 32px;
}

.flashcard-counter {
    font-size: 16px;
    font-weight: 600;
}

.flashcard-actions {
    display: flex;
    gap: 8px;
}

.flashcard-container {
    perspective: 1000px;
    margin-bottom: 32px;
}

.flashcard {
    width: 100%;
    max-width: 600px;
    height: 400px;
    margin: 0 auto;
    cursor: pointer;
}

.flashcard-inner {
    position: relative;
    width: 100%;
    height: 100%;
    transition: transform 0.6s;
    transform-style: preserve-3d;
}

.flashcard.flipped .flashcard-inner {
    transform: rotateY(180deg);
}

.flashcard-front,
.flashcard-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px;
    background: var(--bg-card);
    border: 2px solid var(--border);
    border-radius: 24px;
    text-align: center;
}

.flashcard-back {
    transform: rotateY(180deg);
}

.flashcard-label {
    position: absolute;
    top: 20px;
    left: 20px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-gray);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.flashcard-content {
    font-size: 28px;
    font-weight: 600;
    line-height: 1.4;
}

.flashcard-hint {
    position: absolute;
    bottom: 20px;
    font-size: 13px;
    color: var(--text-gray);
}

.flashcard-category {
    position: absolute;
    bottom: 20px;
    padding: 6px 12px;
    background: var(--primary);
    color: white;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.flashcard-controls {
    display: flex;
    justify-content: center;
    gap: 16px;
    margin-bottom: 24px;
}

.flashcard-progress {
    display: flex;
    justify-content: center;
    gap: 32px;
    padding: 20px;
    background: var(--bg-card);
    border-radius: 12px;
}

.progress-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.progress-label {
    font-size: 13px;
    color: var(--text-gray);
}

.progress-value {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-light);
}

.complete-stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    margin-bottom: 32px;
    padding: 24px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 12px;
}

.complete-stat {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.complete-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Progress Section */
.progress-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 20px;
    margin-bottom: 32px;
}

.chart-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 24px;
}

.chart-card h3 {
    font-size: 18px;
    margin-bottom: 20px;
}

.chart-card canvas {
    max-height: 300px;
}

.streak-calendar-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 24px;
    margin-bottom: 32px;
}

.streak-calendar-card h3 {
    font-size: 18px;
    margin-bottom: 20px;
}

.streak-calendar {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 8px;
}

.calendar-day {
    aspect-ratio: 1;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.05);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.calendar-day:hover {
    transform: scale(1.1);
}

.calendar-day.active {
    background: var(--success);
}

.calendar-day.today {
    border: 2px solid var(--primary);
}

.badges-section {
    margin-bottom: 32px;
}

.badges-section h3 {
    font-size: 24px;
    margin-bottom: 20px;
}

.badges-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
}

.badge-card {
    background: var(--bg-card);
    border: 2px solid var(--border);
    border-radius: 16px;
    padding: 24px;
    text-align: center;
    transition: all 0.3s ease;
}

.badge-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.badge-card.locked {
    opacity: 0.4;
}

.badge-icon {
    font-size: 48px;
    margin-bottom: 12px;
}

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

.badge-description {
    font-size: 13px;
    color: var(--text-gray);
    margin-bottom: 12px;
}

.badge-xp {
    display: inline-block;
    padding: 4px 12px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.history-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 24px;
}

.history-card h3 {
    font-size: 18px;
    margin-bottom: 20px;
}

.history-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.history-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 10px;
}

.history-info h4 {
    font-size: 15px;
    margin-bottom: 4px;
}

.history-info p {
    font-size: 13px;
    color: var(--text-gray);
    margin: 0; /* Override default p margin */
}

.history-score {
    font-size: 20px;
    font-weight: 700;
}

/* Profile Section */
.profile-header {
    display: flex;
    align-items: center;
    gap: 24px;
    margin-bottom: 32px;
    padding: 32px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
}

.profile-avatar {
    position: relative;
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: var(--gradient-1);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 48px;
    font-weight: 700;
    color: white;
    flex-shrink: 0;
}

.level-badge {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 40px;
    height: 40px;
    background: var(--primary);
    border: 3px solid var(--bg-dark);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: 700;
}

.profile-info {
    flex: 1;
}

.profile-info h2 {
    font-size: 32px;
    margin-bottom: 4px;
}

.profile-title {
    color: var(--text-gray);
    font-size: 16px;
    margin-bottom: 16px;
}

.xp-progress {
    margin-top: 12px;
}

.xp-bar {
    height: 12px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 8px;
}

.xp-fill {
    height: 100%;
    background: var(--gradient-3);
    transition: width 0.3s ease;
}

.xp-text {
    font-size: 13px;
    color: var(--text-gray);
}

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

.profile-stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 24px;
    text-align: center;
}

.profile-stat-icon {
    font-size: 36px;
    margin-bottom: 8px;
}

.profile-stat-value {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 4px;
}

.profile-stat-label {
    font-size: 13px;
    color: var(--text-gray);
}

.profile-achievements {
    margin-bottom: 32px;
}

.profile-achievements h3 {
    font-size: 24px;
    margin-bottom: 20px;
}

.profile-badges-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 16px;
}

.profile-settings {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 24px;
}

.profile-settings h3 {
    font-size: 18px;
    margin-bottom: 20px;
}

.settings-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 24px;
}

.setting-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 10px;
}

.setting-label {
    font-size: 15px;
    font-weight: 600;
    display: block;
    margin-bottom: 4px;
}

.setting-description {
    font-size: 13px;
    color: var(--text-gray);
}

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 28px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--border);
    transition: 0.3s;
    border-radius: 28px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: 0.3s;
    border-radius: 50%;
}

input:checked + .toggle-slider {
    background-color: var(--primary);
}

input:checked + .toggle-slider:before {
    transform: translateX(22px);
}

/* Toast Notifications */
#toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.toast {
    min-width: 300px;
    padding: 16px 20px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    gap: 12px;
    animation: slideIn 0.3s ease;
}

.toast-icon {
    font-size: 24px;
}

.toast-message {
    flex: 1;
    font-size: 14px;
}

.toast-close {
    background: transparent;
    border: none;
    color: var(--text-gray);
    font-size: 20px;
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

.toast.success {
    border-left: 4px solid var(--success);
}

.toast.error {
    border-left: 4px solid var(--danger);
}

.toast.warning {
    border-left: 4px solid var(--warning);
}

.toast.info {
    border-left: 4px solid var(--primary);
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.95);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.loading-overlay.hidden {
    display: none;
}

.loading-spinner {
    width: 60px;
    height: 60px;
    border: 4px solid rgba(255, 255, 255, 0.1);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

#loading-text {
    margin-top: 20px;
    font-size: 16px;
    color: var(--text-gray);
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9998;
    padding: 20px;
}

.modal-overlay.hidden {
    display: none;
}

.modal {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    animation: scaleIn 0.3s ease;
}

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

.modal-header h3 {
    font-size: 20px;
}

.modal-close {
    background: transparent;
    border: none;
    color: var(--text-gray);
    font-size: 28px;
    cursor: pointer;
    line-height: 1;
    padding: 0;
}

.modal-body {
    padding: 24px;
}

.modal-body p {
    margin-bottom: 0; /* Remove default p margin for modal */
    line-height: 1.6;
    color: var(--text-gray);
}

.modal-footer {
    padding: 24px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

/* Animations */
@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOut {
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

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

@keyframes scaleIn {
    from {
        transform: scale(0.9);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-10px); }
    75% { transform: translateX(10px); }
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

@keyframes fall {
    to {
        transform: translateY(100vh) rotate(360deg);
        opacity: 0;
    }
}


/* Responsive Design */
@media (min-width: 768px) {
    .brand-text {
        display: inline;
    }
    
    .nav-item span:last-child {
        display: inline;
    }
    
    .nav-icon {
        font-size: 18px;
    }
}

@media (max-width: 768px) {
    .navbar {
        padding: 12px 16px;
    }
    
    .nav-menu {
        position: fixed;
        top: 60px;
        left: 0;
        right: 0;
        background: var(--bg-card);
        border-bottom: 1px solid var(--border);
        flex-direction: column;
        padding: 12px;
        gap: 4px;
        display: none;
    }
    
    .nav-menu.active {
        display: flex;
    }
    
    .mobile-menu-toggle {
        display: flex;
    }
    
    .section-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .section-header h2 {
        font-size: 24px;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .action-grid {
        grid-template-columns: 1fr;
    }
    
    .dashboard-bottom {
        grid-template-columns: 1fr;
    }
    
    .progress-grid {
        grid-template-columns: 1fr;
    }
    
    .results-stats {
        grid-template-columns: 1fr;
    }
    
    .quiz-controls {
        flex-direction: column;
        gap: 16px; /* Add gap for column layout */
    }
    
    .quiz-nav-buttons {
        width: 100%;
    }
    
    .quiz-nav-buttons .btn {
        flex: 1;
    }
    
    .flashcard {
        height: 350px;
    }
    
    .flashcard-controls {
        flex-direction: column;
    }
    
    .flashcard-controls .btn {
        width: 100%;
    }
    
    .profile-header {
        flex-direction: column;
        text-align: center;
    }
    
    .generate-options {
        flex-direction: column;
    }
    
    .generate-options .btn {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .auth-card {
        padding: 24px;
    }
    
    .app-section {
        padding: 16px;
    }
    
    .streak-badge {
        padding: 12px 16px;
    }
    
    .streak-number {
        font-size: 20px;
    }
    
    #toast-container {
        left: 20px;
        right: 20px; /* Make it full width on small screens */
    }
    
    .toast {
        min-width: auto;
    }
}

/* Utility Classes */
.hidden {
    display: none !important;
}

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

.mt-4 {
    margin-top: 16px;
}

.mb-4 {
    margin-bottom: 16px;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-dark);
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-gray);
}
/* --- NEW: NOTES & Q&A SECTIONS STYLES --- */

/* Notes Export Options */
.export-options {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 24px;
}

/* Content Container for Notes/Q&A */
.content-container {
    padding: 24px 0;
}

/* Empty State for Notes/Q&A */
.empty-state {
    max-width: 500px;
    margin: 60px auto;
    text-align: center;
    padding: 40px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px dashed var(--border);
    border-radius: 16px;
}

.empty-state h3 {
    font-size: 24px;
    margin-bottom: 12px;
}

.empty-state p {
    color: var(--text-gray);
    font-size: 16px;
}

/* Q&A Input Area */
.qa-input-area {
    max-width: 800px;
    margin: 0 auto 32px;
}

/* Q&A History Item Styles */
.qa-history .qa-item {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 24px;
    margin-bottom: 16px;
    animation: slideUp 0.3s ease;
}

.qa-history .qa-item > div:first-child {
    font-weight: 600;
    color: var(--primary);
    margin-bottom: 8px;
}

.qa-history .qa-item > div:nth-child(2) {
    color: var(--text-light);
    line-height: 1.6;
}

.qa-history .qa-item .qa-answer {
    font-weight: 600;
    color: var(--success);
    margin-top: 16px;
}

/* Content Display for Notes/Summary */
.content-display {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 32px;
    line-height: 1.8;
    max-width: 900px;
    margin: 0 auto;
}

.content-display pre {
    white-space: pre-wrap;
}

/* Responsive adjustments for Q&A */
@media (max-width: 640px) {
    .qa-history .qa-item {
        padding: 16px;
    }
}
