/* ======================================
   Quiz VIT - Custom Styles
   ====================================== */

/* CSS Variables for Theming */
:root {
    --bg-gradient-start: #667eea;
    --bg-gradient-end: #764ba2;
    --card-bg: #ffffff;
    --card-hover-bg: #f8f9fa;
    --text-primary: #212529;
    --text-secondary: #6c757d;
    --text-muted: #6c757d;
    --border-color: #e9ecef;
    --shadow-color: rgba(0, 0, 0, 0.1);
    --shadow-hover: rgba(0, 0, 0, 0.15);
    --input-bg: #ffffff;
    --input-border: #ced4da;
    --question-text: #2c3e50;
    --stat-card-bg: #ffffff;
    --stat-card-bg-end: #f8f9fa;
    --association-bg: #e7f1ff;
    --association-border: #b6d4fe;
    --association-text: #084298;
    --wrong-question-bg: #fff3cd;
    --wrong-question-border: #ffc107;
    --stats-item-bg: #f8f9fa;
    --navbar-bg: #0d6efd;
}

/* Dark Mode Variables */
body.dark-mode {
    --bg-gradient-start: #1a1a2e;
    --bg-gradient-end: #16213e;
    --card-bg: #1e3a5f;
    --card-hover-bg: #2a4a6f;
    --text-primary: #f8f9fa;
    --text-secondary: #dee2e6;
    --text-muted: #ced4da;
    --border-color: #4a5568;
    --shadow-color: rgba(0, 0, 0, 0.4);
    --shadow-hover: rgba(0, 0, 0, 0.6);
    --input-bg: #2c3e50;
    --input-border: #4a5568;
    --question-text: #ffffff;
    --stat-card-bg: #2a4a6f;
    --stat-card-bg-end: #1e3a5f;
    --association-bg: #2a4a6f;
    --association-border: #4a90e2;
    --association-text: #d0e7ff;
    --wrong-question-bg: #4a3800;
    --wrong-question-border: #ffc107;
    --stats-item-bg: #2a4a6f;
    --navbar-bg: #0a3d62;
}

/* General Styles */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, var(--bg-gradient-start) 0%, var(--bg-gradient-end) 100%);
    min-height: 100vh;
    padding-bottom: 2rem;
    color: var(--text-primary);
    transition: background 0.3s ease, color 0.3s ease;
}

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

.view-container {
    animation: fadeIn 0.3s ease-in;
}

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

/* Header/Navbar */
.navbar {
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.navbar-brand {
    font-size: 1.5rem;
    font-weight: bold;
}

/* Cards */
.card {
    border: none;
    border-radius: 15px;
    background-color: var(--card-bg);
    color: var(--text-primary);
    box-shadow: 0 5px 20px var(--shadow-color);
    transition: transform 0.3s ease, box-shadow 0.3s ease, background-color 0.3s ease;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px var(--shadow-hover);
}

/* Stat Cards */
.stat-card {
    background: linear-gradient(135deg, var(--stat-card-bg) 0%, var(--stat-card-bg-end) 100%);
    border-left: 4px solid;
    transition: all 0.3s ease;
}

.stat-card:hover {
    transform: scale(1.05);
}

.stat-icon {
    font-size: 3rem;
    opacity: 0.8;
}

/* Action Cards */
.action-card {
    background: var(--card-bg);
    transition: all 0.3s ease;
    cursor: pointer;
}

.action-card:hover {
    background: var(--card-hover-bg);
}

.action-icon {
    font-size: 4rem;
    opacity: 0.7;
}

/* Buttons */
.btn {
    border-radius: 8px;
    font-weight: 500;
    transition: all 0.3s ease;
    border: none;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.btn-lg {
    padding: 0.75rem 1.5rem;
    font-size: 1.1rem;
}

/* Outline buttons in dark mode */
body.dark-mode .btn-outline-primary {
    color: #8b9ef9;
    border-color: #8b9ef9;
}

body.dark-mode .btn-outline-primary:hover {
    background-color: #8b9ef9;
    border-color: #8b9ef9;
    color: #1a1a2e;
}

body.dark-mode .btn-outline-light {
    color: #f8f9fa;
    border-color: #f8f9fa;
}

body.dark-mode .btn-outline-light:hover {
    background-color: #f8f9fa;
    border-color: #f8f9fa;
    color: #1a1a2e;
}

/* Quiz Answer Buttons */
.answer-btn {
    padding: 1rem;
    text-align: left;
    font-size: 1rem;
    background: var(--card-bg);
    border: 2px solid var(--border-color);
    color: var(--text-primary);
    transition: all 0.2s ease;
}

.answer-btn:hover:not(:disabled) {
    background: var(--card-hover-bg);
    border-color: #0d6efd;
    transform: translateX(5px);
}

.answer-btn.correct {
    background: #d1e7dd;
    border-color: #0f5132;
    color: #0f5132;
}

body.dark-mode .answer-btn.correct {
    background: #1e4620;
    border-color: #51cf66;
    color: #51cf66;
}

.answer-btn.wrong {
    background: #f8d7da;
    border-color: #842029;
    color: #842029;
}

body.dark-mode .answer-btn.wrong {
    background: #4a1f1f;
    border-color: #ff6b6b;
    color: #ff6b6b;
}

.answer-btn.selected {
    background: #cfe2ff;
    border-color: #0d6efd;
    border-width: 3px;
    color: #084298;
    transform: translateX(5px);
    box-shadow: 0 4px 12px rgba(13, 110, 253, 0.3);
}

body.dark-mode .answer-btn.selected {
    background: #1e3a5f;
    border-color: #4dabf7;
    color: #74c0fc;
}

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

/* Progress Bar */
.progress {
    background-color: #e9ecef;
    border-radius: 10px;
    overflow: hidden;
}

body.dark-mode .progress {
    background-color: #2c3e50;
}

.progress-bar {
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    transition: width 0.5s ease;
}

body.dark-mode .progress-bar {
    background: linear-gradient(90deg, #8b9ef9 0%, #a47dd4 100%);
}

.progress-bar-height-custom {
    height: 8px;
}

/* Timer Display with Warning Colors */
#timer-display {
    font-size: 1.2rem;
    font-weight: bold;
    padding: 0.5rem 1rem;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    transition: all 0.3s ease;
}

/* Timer Safe (> 50% time remaining) - Green */
#timer-display.timer-safe {
    color: #28a745;
    background: rgba(40, 167, 69, 0.15);
}

/* Timer Warning (20-50% time remaining) - Yellow */
#timer-display.timer-warning {
    color: #ffc107;
    background: rgba(255, 193, 7, 0.15);
    animation: pulse-slow 2s ease-in-out infinite;
}

/* Timer Danger (< 20% time remaining) - Red */
#timer-display.timer-danger {
    color: #dc3545;
    background: rgba(220, 53, 69, 0.15);
    animation: pulse 0.5s ease-in-out infinite;
}

/* Legacy warning class for compatibility */
#timer-display.warning {
    animation: pulse 1s infinite;
    color: #ffc107;
}

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

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

/* Question Container */
#question-text {
    font-size: 1.3rem;
    font-weight: 500;
    color: var(--question-text);
    line-height: 1.6;
}

/* Results Display */
#final-score {
    font-size: 5rem;
    font-weight: bold;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

body.dark-mode #final-score {
    background: linear-gradient(135deg, #8b9ef9 0%, #a47dd4 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

#final-percentage {
    color: #667eea;
    font-weight: 600;
}

body.dark-mode #final-percentage {
    color: #8b9ef9;
}

/* Statistics Breakdown */
.stats-item {
    padding: 1rem;
    margin-bottom: 1rem;
    background: var(--stats-item-bg);
    border-radius: 8px;
    border-left: 4px solid #667eea;
}

.stats-item h6 {
    margin-bottom: 0.5rem;
    color: #495057;
    font-weight: 600;
}

body.dark-mode .stats-item h6 {
    color: #f8f9fa;
}

.stats-item .progress {
    height: 25px;
    margin-top: 0.5rem;
}

.stats-item .progress-bar {
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Wrong Questions List */
.wrong-question-item {
    padding: 1rem;
    margin-bottom: 1rem;
    background: var(--wrong-question-bg);
    border-radius: 8px;
    border-left: 4px solid var(--wrong-question-border);
}

.wrong-question-item .question {
    font-weight: 600;
    color: #664d03;
    margin-bottom: 0.5rem;
}

body.dark-mode .wrong-question-item .question {
    color: #ffc107;
}

.wrong-question-item .your-answer {
    color: #dc3545;
    margin-bottom: 0.25rem;
}

body.dark-mode .wrong-question-item .your-answer {
    color: #ff6b6b;
}

.wrong-question-item .correct-answer {
    color: #198754;
    font-weight: 500;
}

body.dark-mode .wrong-question-item .correct-answer {
    color: #51cf66;
}

/* Area Management */
.association-badge {
    display: inline-block;
    padding: 0.5rem 1rem;
    margin: 0.25rem;
    background: var(--association-bg);
    border: 1px solid var(--association-border);
    border-radius: 20px;
    color: var(--association-text);
    font-size: 0.9rem;
}

#current-associations-display {
    max-height: 300px;
    overflow-y: auto;
}

/* Form Controls */
.form-control,
.form-select {
    background-color: var(--input-bg);
    border-color: var(--input-border);
    color: var(--text-primary);
}

.form-control:focus,
.form-select:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 0.25rem rgba(102, 126, 234, 0.25);
    background-color: var(--input-bg);
    color: var(--text-primary);
}

.form-check-input:checked {
    background-color: #667eea;
    border-color: #667eea;
}

.form-label {
    color: var(--text-primary);
}

.text-muted {
    color: var(--text-muted) !important;
}

/* Alert Customization */
.alert {
    border-radius: 10px;
    border: none;
}

/* Toast Notification */
.toast {
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.toast-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-top-left-radius: 10px;
    border-top-right-radius: 10px;
}

body.dark-mode .toast-header {
    background: linear-gradient(135deg, #8b9ef9 0%, #a47dd4 100%);
}

.toast-header .btn-close {
    filter: brightness(0) invert(1);
}

.toast-body {
    background-color: white;
    color: #212529;
    border-bottom-left-radius: 10px;
    border-bottom-right-radius: 10px;
}

body.dark-mode .toast-body {
    background-color: #2c3e50;
    color: #f8f9fa;
}

/* Responsive Adjustments */
@media (max-width: 768px) {
    .navbar-brand {
        font-size: 1.2rem;
    }

    .stat-icon {
        font-size: 2rem;
    }

    .action-icon {
        font-size: 3rem;
    }

    #final-score {
        font-size: 3rem;
    }

    #question-text {
        font-size: 1.1rem;
    }

    .answer-btn {
        font-size: 0.9rem;
        padding: 0.75rem;
    }

    .card-body {
        padding: 1rem;
        min-height: auto;
        max-height: none;
    }

    .container {
        padding-left: 10px;
        padding-right: 10px;
        min-height: auto;
    }

    /* Fix per quiz setup su mobile */
    .view-container {
        min-height: 100vh;
        overflow-y: auto;
    }

    .card {
        margin-bottom: 2rem;
    }

    h2 {
        font-size: 1.5rem;
    }

    h3 {
        font-size: 1.3rem;
    }

    h4 {
        font-size: 1.2rem;
    }

    h5 {
        font-size: 1.1rem;
    }

    .btn-lg {
        padding: 0.5rem 1rem;
        font-size: 1rem;
    }

    .d-flex.gap-2 {
        flex-wrap: wrap;
    }

    .stats-item {
        padding: 0.75rem;
    }
}

@media (max-width: 576px) {
    #final-score {
        font-size: 2.5rem;
    }

    .stat-card .card-body {
        padding: 0.75rem;
    }

    .stat-icon {
        font-size: 1.5rem;
    }

    .action-icon {
        font-size: 2.5rem;
    }

    .navbar-brand {
        font-size: 1rem;
    }

    #question-text {
        font-size: 1rem;
    }

    .answer-btn {
        font-size: 0.85rem;
        padding: 0.6rem;
    }
}

/* Loading Spinner */
.spinner-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.spinner-border-custom {
    width: 3rem;
    height: 3rem;
    border-width: 0.3em;
}

/* Smooth Transitions */
* {
    transition: background-color 0.2s ease, color 0.2s ease;
}

button,
.card {
    transition: all 0.3s ease;
}

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

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: #764ba2;
}

/* Badge Customization */
.badge {
    font-weight: 500;
    padding: 0.5rem 1rem;
    border-radius: 20px;
}

body.dark-mode .badge.bg-light {
    background-color: #4a5568 !important;
    color: #f8f9fa !important;
}

body.dark-mode .badge.bg-success {
    background-color: #2f7d32 !important;
    color: #ffffff !important;
}

/* Card Headers */
.card-header {
    border-top-left-radius: 15px !important;
    border-top-right-radius: 15px !important;
    font-weight: 600;
}

body.dark-mode .card-header {
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

/* Alert in dark mode */
body.dark-mode .alert-info {
    background-color: #1e4d7a;
    color: #d0e7ff;
    border-color: #4a90e2;
}

body.dark-mode .alert-success {
    background-color: #1e4620;
    color: #51cf66;
    border-color: #2f7d32;
}

body.dark-mode .alert-danger {
    background-color: #4a1f1f;
    color: #ff6b6b;
    border-color: #c62828;
}

body.dark-mode .alert-warning {
    background-color: #4a3800;
    color: #ffc107;
    border-color: #f57c00;
}

body.dark-mode .alert-secondary {
    background-color: var(--card-bg);
    color: var(--text-primary);
    border-color: var(--border-color);
}

/* Strong tags in dark mode */
body.dark-mode strong {
    color: #ffffff;
}

/* Card text in dark mode */
body.dark-mode .card-text {
    color: var(--text-secondary);
}

body.dark-mode .card-title {
    color: var(--text-primary);
}

/* Small text in dark mode */
body.dark-mode small {
    color: var(--text-muted);
}

/* H tags in dark mode for better visibility */
body.dark-mode h1,
body.dark-mode h2,
body.dark-mode h3,
body.dark-mode h4,
body.dark-mode h5,
body.dark-mode h6 {
    color: #ffffff;
}

/* Improve visibility of icons in dark mode */
body.dark-mode .bi {
    opacity: 0.95;
}

/* Option disabled styling in dark mode */
body.dark-mode option:disabled {
    color: #6c757d;
}

/* Em tags in dark mode */
body.dark-mode em {
    color: var(--text-muted);
}

/* Inline Styles Moved from HTML */
.toast-container-custom {
    z-index: 2500; /* Above bottom nav (z-index: 1010) but below modals */
}

.progress-height-8 {
    height: 8px;
}

/* ======================================
   Loading Overlay
   ====================================== */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    backdrop-filter: blur(4px);
    transition: opacity 0.3s ease;
}

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

.loading-content {
    text-align: center;
    color: white;
}

.loading-content .spinner-border {
    width: 3rem;
    height: 3rem;
}

.loading-content p {
    color: white;
    font-size: 1.1rem;
    margin-top: 1rem;
}

/* Dark mode loading */
body.dark-mode .loading-overlay {
    background: rgba(18, 18, 18, 0.8);
}

/* ======================================
   Touch Target Improvements (Mobile)
   ====================================== */
/* Ensure all interactive elements are at least 44x44px */
.btn {
    min-height: 44px;
    padding: 0.5rem 1rem;
}

.btn-sm {
    min-height: 38px;
    padding: 0.375rem 0.75rem;
}

.form-check-input {
    min-width: 24px;
    min-height: 24px;
    cursor: pointer;
}

.form-check {
    padding: 0.5rem 0;
    min-height: 44px;
    display: flex;
    align-items: center;
}

/* Answer buttons in quiz */
.answer-btn {
    min-height: 56px;
    padding: 1rem;
    font-size: 1rem;
}

/* Icon buttons need larger tap area */
.btn-icon {
    min-width: 44px;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* Increase tap area for small icons without changing visual size */
i.bi {
    padding: 8px;
    margin: -8px;
    cursor: pointer;
}

/* Badge/tag clickable items */
.association-badge i {
    padding: 10px;
    margin: -10px;
}

/* ======================================
   Quiz Setup Layout Fixes
   ====================================== */
/* Ensure quiz setup card is fully scrollable */
#quiz-setup-container .card {
    max-height: none !important;
    overflow: visible !important;
    height: auto !important;
}

#quiz-setup-container .card-body {
    overflow-y: visible !important;
    overflow-x: visible !important;
    max-height: none !important;
    height: auto !important;
    padding: 1.5rem;
}

/* Form checks/switches: ensure proper spacing */
.form-check {
    padding-left: 2.5rem;
    min-height: 2.5rem;
    display: flex;
    align-items: center;
}

.form-check-input {
    margin-top: 0;
    width: 3rem;
    height: 1.5rem;
    flex-shrink: 0;
}

.form-check-label {
    padding-left: 0.5rem;
    cursor: pointer;
}

/* Mobile: Ensure full visibility */
@media (max-width: 768px) {
    #quiz-setup-container .card-body {
        padding: 1rem;
    }

    .form-check {
        padding-left: 2rem;
    }

    .form-check-input {
        width: 2.5rem;
        height: 1.25rem;
    }
}

/* ======================================
   Input Validation
   ====================================== */
/* Invalid input styling */
.form-control.is-invalid {
    border-color: #dc3545;
    padding-right: calc(1.5em + 0.75rem);
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' width='12' height='12' fill='none' stroke='%23dc3545'%3e%3ccircle cx='6' cy='6' r='4.5'/%3e%3cpath stroke-linejoin='round' d='M5.8 3.6h.4L6 6.5z'/%3e%3ccircle cx='6' cy='8.2' r='.6' fill='%23dc3545' stroke='none'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right calc(0.375em + 0.1875rem) center;
    background-size: calc(0.75em + 0.375rem) calc(0.75em + 0.375rem);
}

body.dark-mode .form-control.is-invalid {
    border-color: #ea868f;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' width='12' height='12' fill='none' stroke='%23ea868f'%3e%3ccircle cx='6' cy='6' r='4.5'/%3e%3cpath stroke-linejoin='round' d='M5.8 3.6h.4L6 6.5z'/%3e%3ccircle cx='6' cy='8.2' r='.6' fill='%23ea868f' stroke='none'/%3e%3c/svg%3e");
}

.form-control.is-invalid:focus {
    border-color: #dc3545;
    box-shadow: 0 0 0 0.25rem rgba(220, 53, 69, 0.25);
}

body.dark-mode .form-control.is-invalid:focus {
    border-color: #ea868f;
    box-shadow: 0 0 0 0.25rem rgba(234, 134, 143, 0.25);
}

/* Invalid feedback styling */
.invalid-feedback {
    display: none;
    width: 100%;
    margin-top: 0.25rem;
    font-size: 0.875em;
    color: #dc3545;
}

body.dark-mode .invalid-feedback {
    color: #ea868f;
}

.invalid-feedback[style*="display: block"] {
    display: block !important;
}

/* ======================================
   Mobile UX - Swipe Gestures
   ====================================== */
/* Smooth transitions for swipe gestures */
#quiz-container .card {
    transition: transform 0.3s ease, opacity 0.3s ease;
    touch-action: pan-y; /* Allow vertical scrolling but enable horizontal swipe detection */
}

/* Prevent text selection during swipe */
#quiz-container.swiping {
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

/* Visual hint for swipe gesture */
#quiz-container .card::after {
    content: '← Swipe per avanti';
    position: absolute;
    bottom: -35px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.75rem;
    color: var(--text-muted);
    opacity: 0.5;
    pointer-events: none;
    white-space: nowrap;
}

/* Hide hint after first swipe or on results */
#quiz-container.hint-dismissed .card::after,
#results-container .card::after {
    display: none;
}

body.dark-mode #quiz-container .card::after {
    color: #6c757d;
}

/* Mobile optimization */
@media (max-width: 768px) {
    #quiz-container .card {
        touch-action: pan-y;
    }
}

/* ======================================
   Enhanced Visual Feedback & Animations
   ====================================== */

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

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

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes bounceIn {
    0% {
        opacity: 0;
        transform: scale(0.3);
    }
    50% {
        transform: scale(1.05);
    }
    70% {
        transform: scale(0.9);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes correctPulse {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(15, 81, 50, 0.7);
    }
    50% {
        box-shadow: 0 0 0 10px rgba(15, 81, 50, 0);
    }
}

@keyframes wrongShake {
    0%, 100% {
        transform: translateX(0);
    }
    10%, 30%, 50%, 70%, 90% {
        transform: translateX(-5px);
    }
    20%, 40%, 60%, 80% {
        transform: translateX(5px);
    }
}

/* Enhanced Answer Button Animations */
.answer-btn {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.answer-btn:hover:not(:disabled) {
    transform: translateX(5px) scale(1.02);
}

.answer-btn.selected {
    animation: bounceIn 0.4s ease-out;
}

.answer-btn.correct {
    animation: correctPulse 1s ease-out, pulse 0.6s ease-out;
}

body.dark-mode .answer-btn.correct {
    animation: correctPulse 1s ease-out, pulse 0.6s ease-out;
}

.answer-btn.wrong {
    animation: wrongShake 0.5s ease-out;
}

/* Confirm Button Animation */
#confirm-answer-container {
    animation: slideInRight 0.3s ease-out;
}

#confirm-answer-btn {
    transition: all 0.3s ease;
}

#confirm-answer-btn:hover {
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 6px 20px rgba(25, 135, 84, 0.4);
}

#confirm-answer-btn:active {
    transform: translateY(0) scale(0.98);
}

/* Feedback Message Animation */
#answer-feedback {
    animation: slideInRight 0.4s ease-out;
}

#feedback-message {
    animation: bounceIn 0.5s ease-out;
}

/* Progress Bar Animation */
.progress-bar {
    transition: width 0.6s ease-out;
}

/* Question Container Fade In */
#question-container {
    animation: fadeInSlideUp 0.5s ease-out;
}

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

/* Card Hover Enhancement */
.card {
    transition: transform 0.3s ease, box-shadow 0.3s ease, background-color 0.3s ease;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px var(--shadow-hover);
}

/* Button Press Feedback */
.btn:active {
    transform: translateY(0) scale(0.95);
}

/* Score Animation on Results */
#final-score {
    animation: bounceIn 0.8s ease-out;
}

/* ======================================
   Question Navigation (Flag & Skip)
   ====================================== */
#flag-question-btn, #skip-question-btn {
    min-width: 38px;
    min-height: 38px;
    padding: 0.375rem 0.5rem;
    transition: all 0.2s ease;
    font-size: 1.1rem;
}

/* Flag button default state - make it more visible */
#flag-question-btn {
    background-color: rgba(255, 193, 7, 0.1);
    border-color: #ffc107;
    color: #ffc107;
}

#flag-question-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 8px rgba(255, 193, 7, 0.4);
    background-color: rgba(255, 193, 7, 0.2);
}

#skip-question-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 8px rgba(108, 117, 125, 0.3);
}

/* Flagged state - more prominent */
#flag-question-btn.flagged {
    background-color: #ffc107;
    color: #000;
    border-color: #ffc107;
    box-shadow: 0 0 0 3px rgba(255, 193, 7, 0.3);
}

#flag-question-btn.flagged i {
    animation: flagWave 0.5s ease-out;
}

#flag-question-btn.flagged:hover {
    background-color: #ffb300;
    box-shadow: 0 4px 12px rgba(255, 193, 7, 0.5), 0 0 0 3px rgba(255, 193, 7, 0.3);
}

@keyframes flagWave {
    0%, 100% { transform: rotate(0deg); }
    25% { transform: rotate(-15deg); }
    75% { transform: rotate(15deg); }
}

/* Dark mode support */
body.dark-mode #flag-question-btn:hover {
    box-shadow: 0 4px 8px rgba(255, 193, 7, 0.4);
}

body.dark-mode #skip-question-btn:hover {
    box-shadow: 0 4px 8px rgba(108, 117, 125, 0.4);
}

/* ======================================
   Question Palette (Minimap)
   ====================================== */
#question-palette-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s ease-out;
}

.palette-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
}

.palette-container {
    position: relative;
    background: white;
    border-radius: 12px;
    max-width: 90%;
    max-height: 85vh;
    width: 500px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    animation: slideInUp 0.3s ease-out;
}

body.dark-mode .palette-container {
    background: #1a1d29;
}

.palette-header {
    background: var(--primary);
    color: white;
    padding: 1rem 1.5rem;
    border-radius: 12px 12px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.palette-header .btn-link {
    padding: 0.25rem;
    text-decoration: none;
    opacity: 0.8;
    transition: opacity 0.2s;
}

.palette-header .btn-link:hover {
    opacity: 1;
}

.palette-body {
    padding: 1.5rem;
    overflow-y: auto;
    max-height: calc(85vh - 60px);
    flex: 1;
}

/* Stats bar */
.palette-stats {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    justify-content: center;
}

.stat-badge {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: var(--bg-secondary);
    border-radius: 20px;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text);
}

.stat-badge i {
    font-size: 1rem;
}

.stat-badge span {
    font-weight: 600;
    color: var(--primary);
}

.stat-badge.answered span {
    color: var(--success);
}

.stat-badge.flagged span {
    color: var(--warning);
}

body.dark-mode .stat-badge {
    background: #252836;
}

/* Filter buttons */
.palette-filters {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    flex-wrap: wrap;
}

.btn-filter {
    padding: 0.5rem 1rem;
    border: 2px solid var(--bg-secondary);
    background: transparent;
    color: var(--text-muted);
    border-radius: 20px;
    transition: all 0.2s ease;
    font-size: 0.875rem;
    font-weight: 500;
}

.btn-filter:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: rgba(13, 110, 253, 0.1);
}

.btn-filter.active {
    border-color: #0d6efd !important;
    background: #0d6efd !important;
    color: #ffffff !important;
}

.btn-filter i {
    font-size: 0.875rem;
}

body.dark-mode .btn-filter {
    border-color: #252836;
}

body.dark-mode .btn-filter:hover {
    background: rgba(13, 110, 253, 0.2);
}

body.dark-mode .btn-filter.active {
    color: white !important;
}

.palette-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    padding: 0.75rem;
    background: var(--bg-secondary);
    border-radius: 8px;
}

body.dark-mode .palette-legend {
    background: #252836;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
}

.legend-dot {
    width: 24px;
    height: 24px;
    border-radius: 4px;
    display: inline-block;
    border: 2px solid transparent;
}

.legend-dot.current {
    background: var(--primary);
    border-color: var(--primary);
    box-shadow: 0 0 0 2px white, 0 0 0 4px var(--primary);
}

.legend-dot.answered {
    background: var(--success);
}

.legend-dot.unanswered {
    background: var(--bg-tertiary);
    border-color: var(--border);
}

body.dark-mode .legend-dot.unanswered {
    background: #2d3748;
    border-color: #4a5568;
}

.legend-dot.flagged {
    background: var(--warning);
    position: relative;
}

.legend-dot.flagged::after {
    content: '\F288'; /* bi-flag-fill */
    font-family: 'bootstrap-icons';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 12px;
}

.palette-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(45px, 1fr));
    gap: 0.5rem;
    margin-top: 0.5rem;
}

/* Optimize for many questions */
.palette-grid.many-questions {
    grid-template-columns: repeat(auto-fill, minmax(40px, 1fr));
    gap: 0.4rem;
}

.palette-grid.very-many-questions {
    grid-template-columns: repeat(auto-fill, minmax(35px, 1fr));
    gap: 0.35rem;
}

.palette-cell {
    aspect-ratio: 1;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 2px solid transparent;
    position: relative;
}

/* Smaller text for many questions */
.palette-grid.many-questions .palette-cell {
    font-size: 0.75rem;
}

.palette-grid.very-many-questions .palette-cell {
    font-size: 0.7rem;
    font-weight: 500;
}

.palette-cell.hidden-by-filter {
    display: none;
}

.palette-cell:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.palette-cell.current {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px white, 0 0 0 4px var(--primary);
}

.palette-cell.answered {
    background: var(--success);
    color: white;
}

.palette-cell.unanswered {
    background: var(--bg-tertiary);
    color: var(--text);
    border-color: var(--border);
}

body.dark-mode .palette-cell.unanswered {
    background: #2d3748;
    border-color: #4a5568;
    color: #e5e7eb;
}

/* Flagged cells - use darker text for better visibility */
.palette-cell.flagged {
    background: #fff3cd !important; /* Light yellow background */
    color: #000 !important; /* Black text */
    border: 2px solid var(--warning) !important;
}

body.dark-mode .palette-cell.flagged {
    background: #6c5709 !important; /* Dark yellow background */
    color: #fff !important; /* White text */
    border-color: var(--warning) !important;
}

/* Flagged badge */
.palette-cell.flagged::after {
    content: '\F288'; /* bi-flag-fill */
    font-family: 'bootstrap-icons';
    position: absolute;
    top: -4px;
    right: -4px;
    color: #000;
    font-size: 8px;
    background: var(--warning);
    border-radius: 50%;
    width: 14px;
    height: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    border: 2px solid white;
}

body.dark-mode .palette-cell.flagged::after {
    border-color: #1a1d29;
}

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

/* Mobile adjustments */
@media (max-width: 576px) {
    .palette-container {
        max-width: 95%;
        width: auto;
    }

    .palette-grid {
        grid-template-columns: repeat(auto-fill, minmax(45px, 1fr));
        gap: 0.5rem;
    }

    .palette-legend {
        gap: 0.75rem;
    }

    .legend-item {
        font-size: 0.8rem;
    }
}

#final-percentage {
    animation: slideInRight 0.6s ease-out 0.2s backwards;
}

/* Toast/Alert Slide In */
.alert {
    animation: slideInRight 0.3s ease-out;
}

/* Spinner Smooth Rotation */
.spinner-border {
    animation: spinner-border 0.75s linear infinite;
}

/* Timer Warning Pulse */
#timer-display.warning {
    animation: pulse 0.5s ease-in-out infinite;
    color: #dc3545;
    font-weight: bold;
}

/* Reduce motion for users with preference */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ======================================
   Bottom Navigation Bar (Mobile)
   ====================================== */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 65px;
    background: #ffffff;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px); /* Safari support */
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: space-around;
    align-items: center;
    z-index: 1000;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.15);
    padding-bottom: env(safe-area-inset-bottom); /* iOS notch support */
}

body.dark-mode .bottom-nav {
    background: #1a1d29;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px); /* Safari support */
    border-top-color: #2d3748;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.4);
}

.bottom-nav .nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 0.75rem;
    padding: 8px;
    cursor: pointer;
    transition: color 0.2s ease, transform 0.1s ease;
    min-height: 56px;
    min-width: 56px;
}

.bottom-nav .nav-item i {
    font-size: 1.5rem;
}

.bottom-nav .nav-item:active {
    transform: scale(0.95);
}

.bottom-nav .nav-item.active {
    color: var(--primary);
    font-weight: 600;
}

body.dark-mode .bottom-nav .nav-item {
    color: #9ca3af;
}

body.dark-mode .bottom-nav .nav-item.active {
    color: var(--primary);
}

/* Hide bottom nav during quiz and quiz setup */
#quiz-setup-container:not(.hidden) ~ .bottom-nav,
.quiz-active .bottom-nav {
    display: none;
}

/* Add padding to main content to avoid overlap with bottom nav */
.view-container {
    padding-bottom: 80px;
}

/* Desktop: hide bottom nav */
@media (min-width: 769px) {
    .bottom-nav {
        display: none;
    }

    .view-container {
        padding-bottom: 20px;
    }
}

/* ======================================
   Onboarding Tutorial
   ====================================== */
.onboarding-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(10px);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    overflow-y: auto;
}

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

.onboarding-content {
    background: #ffffff;
    border-radius: 20px;
    padding: 40px 30px;
    max-width: 500px;
    width: 100%;
    position: relative;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

body.dark-mode .onboarding-content {
    background: #1a1d29;
}

.onboarding-skip {
    position: absolute;
    top: 15px;
    right: 15px;
    background: transparent;
    border: none;
    color: #6c757d;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 10px;
    transition: color 0.2s ease;
}

.onboarding-skip:hover {
    color: #1a1d29;
}

body.dark-mode .onboarding-skip {
    color: #9ca3af;
}

body.dark-mode .onboarding-skip:hover {
    color: #f8f9fa;
}

.onboarding-slide {
    display: none;
    text-align: center;
    animation: fadeInSlideUp 0.5s ease-out;
}

.onboarding-slide.active {
    display: block;
}

.onboarding-icon {
    font-size: 4rem;
    margin-bottom: 20px;
}

.onboarding-slide h2 {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 15px;
    color: #1a1d29;
}

body.dark-mode .onboarding-slide h2 {
    color: #f8f9fa;
}

.onboarding-slide p {
    font-size: 1rem;
    color: #6c757d;
    margin-bottom: 10px;
}

body.dark-mode .onboarding-slide p {
    color: #9ca3af;
}

.onboarding-slide ul {
    display: inline-block;
    text-align: left;
    margin: 0 auto;
}

.onboarding-slide ul li {
    margin-bottom: 10px;
    font-size: 0.95rem;
    color: #2d3748;
}

body.dark-mode .onboarding-slide ul li {
    color: #e5e7eb;
}

.onboarding-nav {
    margin-top: 40px;
}

.onboarding-dots {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 25px;
}

.onboarding-dots .dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #6c757d;
    opacity: 0.3;
    transition: opacity 0.3s ease, transform 0.3s ease;
    cursor: pointer;
}

body.dark-mode .onboarding-dots .dot {
    background: #9ca3af;
}

.onboarding-dots .dot.active {
    opacity: 1;
    transform: scale(1.3);
    background: #0d6efd;
}

.onboarding-buttons {
    display: flex;
    justify-content: space-between;
    gap: 10px;
}

.onboarding-buttons .btn {
    flex: 1;
    min-height: 48px;
}

/* Mobile optimization */
@media (max-width: 768px) {
    .onboarding-content {
        padding: 30px 20px;
    }

    .onboarding-slide h2 {
        font-size: 1.5rem;
    }

    .onboarding-icon {
        font-size: 3rem;
    }
}

/* ======================================
   Pause Overlay
   ====================================== */
#pause-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 3000;
    display: flex;
    align-items: center;
    justify-content: center;
}

#pause-overlay.hidden {
    display: none;
}

.pause-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.pause-container {
    position: relative;
    z-index: 1;
    animation: fadeInScale 0.3s ease-out;
}

.pause-content {
    background: var(--bg-primary);
    border-radius: 16px;
    padding: 3rem 2.5rem;
    text-align: center;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    min-width: 320px;
    max-width: 90vw;
}

.pause-icon {
    font-size: 5rem;
    color: var(--warning);
    animation: pulse 2s ease-in-out infinite;
}

.pause-content h3 {
    font-size: 1.75rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 0.5rem;
}

.pause-content p {
    font-size: 1rem;
    color: var(--text-muted);
}

.pause-content .btn {
    min-width: 180px;
    font-size: 1.1rem;
    padding: 0.75rem 2rem;
}

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

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

/* Pause Button Styling */
#pause-quiz-btn {
    min-width: 38px;
    min-height: 38px;
    transition: all 0.2s ease;
}

#pause-quiz-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(255, 193, 7, 0.3);
}

#pause-quiz-btn.hidden {
    display: none;
}

/* Dark mode adjustments */
body.dark-mode .pause-content {
    background: #1a1d29;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6);
}

body.dark-mode .pause-backdrop {
    background: rgba(0, 0, 0, 0.9);
}

/* Mobile responsive */
@media (max-width: 576px) {
    .pause-content {
        padding: 2rem 1.5rem;
        min-width: 280px;
    }

    .pause-icon {
        font-size: 4rem;
    }

    .pause-content h3 {
        font-size: 1.5rem;
    }

    .pause-content .btn {
        min-width: 150px;
        font-size: 1rem;
    }
}

/* ======================================
   Advanced Analytics Styles (v1.7.0)
   ====================================== */

/* Trend Chart */
.trend-chart {
    padding: 1rem;
    background: var(--card-bg);
    border-radius: 8px;
}

.trend-day {
    padding: 0 5px;
}

.trend-bar-container {
    background: var(--stats-item-bg);
    border-radius: 4px;
    padding: 5px;
    margin-bottom: 5px;
}

.trend-bar {
    border-radius: 4px;
    transition: all 0.3s ease;
    position: relative;
}

.trend-bar:hover {
    opacity: 0.8;
    transform: scaleY(1.05);
}

/* Weak Points Section */
#weak-points-section .alert {
    border-left: 4px solid;
}

#weak-points-section .alert-warning {
    background-color: rgba(255, 193, 7, 0.1);
    border-left-color: #ffc107;
}

body.dark-mode #weak-points-section .alert-warning {
    background-color: rgba(255, 193, 7, 0.15);
    color: var(--text-primary);
}

/* Suggestions Cards */
#suggestions-section .card {
    transition: all 0.3s ease;
}

#suggestions-section .card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 16px var(--shadow-hover);
}

#suggestions-section .card-title {
    font-size: 1rem;
    margin-bottom: 0.75rem;
}

#suggestions-section .card-text {
    color: var(--text-muted);
    margin-bottom: 1rem;
}

/* Responsive adjustments for charts */
@media (max-width: 768px) {
    .trend-bar-container {
        height: 80px !important;
    }

    .trend-day {
        font-size: 0.75rem;
    }

    #suggestions-section .col-md-4 {
        margin-bottom: 1rem;
    }
}

/* ======================================
   Resume/Quit Quiz Modals
   ====================================== */

/* Resume Quiz Modal Info List */
.resume-quiz-info li {
    padding: 0.6rem 0;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
}

.resume-quiz-info li:last-child {
    border-bottom: none;
}

.resume-quiz-info li i {
    color: var(--navbar-bg);
    width: 24px;
}

/* Quit Quiz Modal */
.quit-quiz-info {
    background-color: var(--stats-item-bg);
    padding: 0.75rem;
    border-radius: 8px;
    margin-top: 0.5rem;
}

/* Modal Dark Mode Support */
body.dark-mode #resume-quiz-modal .modal-content,
body.dark-mode #quit-quiz-modal .modal-content {
    background-color: var(--card-bg);
    color: var(--text-primary);
}

body.dark-mode #resume-quiz-modal .modal-header {
    background-color: var(--navbar-bg) !important;
}

body.dark-mode #quit-quiz-modal .modal-header {
    background-color: #8B6914 !important;
    color: var(--text-primary);
}

body.dark-mode .resume-quiz-info li {
    border-color: var(--border-color);
}

body.dark-mode .resume-quiz-info li i {
    color: #60a5fa;
}

body.dark-mode .quit-quiz-info {
    background-color: var(--stat-card-bg);
}

body.dark-mode #resume-quiz-modal .btn-outline-danger,
body.dark-mode #quit-quiz-modal .btn-outline-danger {
    color: #f87171;
    border-color: #f87171;
}

body.dark-mode #resume-quiz-modal .btn-outline-danger:hover,
body.dark-mode #quit-quiz-modal .btn-outline-danger:hover {
    background-color: #f87171;
    color: #1a1a2e;
}

/* ======================================
   Study/Consult View Styles
   ====================================== */

/* Search Input Enhancements */
#study-search-input {
    border-radius: 8px 0 0 8px;
    font-size: 16px; /* Prevents zoom on iOS */
}

#study-search-input:focus {
    border-color: var(--navbar-bg);
    box-shadow: 0 0 0 0.25rem rgba(102, 126, 234, 0.25);
}

/* Search Results Container */
.study-results-container {
    max-height: 60vh;
    overflow-y: auto;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--card-bg);
}

/* Accordion Customization for Study View */
#study-areas-accordion .accordion-item {
    border: none;
    margin-bottom: 0.5rem;
    border-radius: 8px !important;
    overflow: hidden;
    background: var(--card-bg);
    box-shadow: 0 2px 4px var(--shadow-color);
}

#study-areas-accordion .accordion-button {
    background: var(--card-bg);
    color: var(--text-primary);
    font-weight: 600;
    padding: 1rem;
    border-radius: 8px;
}

#study-areas-accordion .accordion-button:not(.collapsed) {
    background: linear-gradient(135deg, var(--bg-gradient-start) 0%, var(--bg-gradient-end) 100%);
    color: white;
}

#study-areas-accordion .accordion-button::after {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%23667eea'%3e%3cpath fill-rule='evenodd' d='M1.646 4.646a.5.5 0 0 1 .708 0L8 10.293l5.646-5.647a.5.5 0 0 1 .708.708l-6 6a.5.5 0 0 1-.708 0l-6-6a.5.5 0 0 1 0-.708z'/%3e%3c/svg%3e");
}

#study-areas-accordion .accordion-button:not(.collapsed)::after {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='white'%3e%3cpath fill-rule='evenodd' d='M1.646 4.646a.5.5 0 0 1 .708 0L8 10.293l5.646-5.647a.5.5 0 0 1 .708.708l-6 6a.5.5 0 0 1-.708 0l-6-6a.5.5 0 0 1 0-.708z'/%3e%3c/svg%3e");
}

/* Subject Accordion (nested) */
.study-subject-accordion .accordion-item {
    border: 1px solid var(--border-color);
    margin-bottom: 0.25rem;
    border-radius: 6px !important;
}

.study-subject-accordion .accordion-button {
    padding: 0.75rem 1rem;
    font-size: 0.95rem;
    background: var(--stats-item-bg);
}

.study-subject-accordion .accordion-button:not(.collapsed) {
    background: rgba(102, 126, 234, 0.1);
    color: var(--text-primary);
}

/* Question Cards in Study View */
.study-question-card {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    margin-bottom: 0.75rem;
    background: var(--card-bg);
    transition: all 0.2s ease;
}

.study-question-card:hover {
    box-shadow: 0 4px 12px var(--shadow-color);
}

.study-question-header {
    padding: 0.75rem 1rem;
    background: var(--stats-item-bg);
    border-radius: 8px 8px 0 0;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.study-question-header.collapsed {
    border-radius: 8px;
}

.study-question-text {
    font-weight: 500;
    color: var(--question-text);
    flex-grow: 1;
    margin-right: 1rem;
}

.study-question-toggle {
    color: var(--text-muted);
    transition: transform 0.2s ease;
}

.study-question-header:not(.collapsed) .study-question-toggle {
    transform: rotate(180deg);
}

/* Answers Display */
.study-answers-container {
    padding: 1rem;
    border-top: 1px solid var(--border-color);
}

.study-answer-item {
    padding: 0.75rem 1rem;
    margin-bottom: 0.5rem;
    border-radius: 6px;
    border: 2px solid var(--border-color);
    background: var(--card-bg);
    display: flex;
    align-items: flex-start;
}

.study-answer-item:last-child {
    margin-bottom: 0;
}

.study-answer-item.correct {
    background: #d1e7dd;
    border-color: #0f5132;
    color: #0f5132;
}

body.dark-mode .study-answer-item.correct {
    background: #1e4620;
    border-color: #51cf66;
    color: #51cf66;
}

.study-answer-item.incorrect {
    background: var(--stats-item-bg);
    color: var(--text-secondary);
}

/* Search Highlight */
.search-highlight {
    background-color: #ffc107;
    color: #000;
    padding: 0 2px;
    border-radius: 2px;
}

body.dark-mode .search-highlight {
    background-color: #ffc107;
    color: #000;
}

/* Subject/Question Count Badges */
.study-count-badge {
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
    margin-left: 0.5rem;
}

/* Lazy Loading Indicator */
.study-loading-indicator {
    text-align: center;
    padding: 1rem;
    color: var(--text-muted);
}

/* Mobile Responsive Adjustments */
@media (max-width: 768px) {
    .study-question-text {
        font-size: 0.9rem;
    }

    .study-answer-item {
        padding: 0.6rem 0.75rem;
        font-size: 0.9rem;
    }
}

/* Bottom nav adjustment for 5 items */
@media (max-width: 400px) {
    .bottom-nav .nav-item span {
        font-size: 0.65rem;
    }

    .bottom-nav .nav-item i {
        font-size: 1.25rem;
    }
}

/* ======================================
   Studio Cyber - Answer Styles
   ====================================== */
.study-cyber-answer {
    display: flex;
    align-items: flex-start;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    margin-bottom: 0.5rem;
    font-size: 1rem;
    line-height: 1.5;
}

.study-cyber-answer.correct {
    background-color: #d1e7dd;
    border: 2px solid #0f5132;
    color: #0f5132;
}

.study-cyber-answer.wrong {
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    color: var(--text-muted);
}

.study-cyber-answer i {
    flex-shrink: 0;
    margin-top: 0.15rem;
}

/* Dark mode adjustments */
body.dark-mode .study-cyber-answer.correct {
    background-color: rgba(25, 135, 84, 0.2);
    border-color: #198754;
    color: #75b798;
}

body.dark-mode .study-cyber-answer.wrong {
    background-color: var(--card-bg);
    border-color: var(--border-color);
    color: var(--text-muted);
}

/* Mobile responsive */
@media (max-width: 768px) {
    .study-cyber-answer {
        padding: 0.6rem 0.75rem;
        font-size: 0.9rem;
    }
}

/* Studio Cyber - Search Results */
.study-cyber-search-item {
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    margin-bottom: 0.5rem;
    background: var(--card-bg);
    cursor: pointer;
    transition: all 0.2s ease;
}

.study-cyber-search-item:hover {
    background: var(--card-hover-bg);
    border-color: #17a2b8;
    transform: translateX(3px);
}

.study-cyber-search-item p {
    font-size: 0.95rem;
    color: var(--text-primary);
}
