/* --- Final AI Mock Test - Main Styling (v2 - Fully Responsive) --- */

/* --- 1. Intro Page (mock-test.html) Styling --- */
.mock-test-page {
    display: flex; align-items: center; justify-content: center;
    min-height: calc(100vh - 200px);
}
.mock-test-container {
    width: 100%; max-width: 900px; padding: 2rem; animation: fadeIn 0.5s ease-out;
}
.test-step { display: none; text-align: center; }
.test-step.active { display: block; animation: slideUpIn 0.6s ease-out; }
.step-icon { font-size: 3rem; color: var(--primary-color); margin-bottom: 1rem; }
.step-title { font-size: 2.5rem; color: var(--text-color); margin: 0 0 0.5rem 0; }
.step-subtitle { font-size: 1.2rem; color: #6c757d; margin-bottom: 3rem; }
.selection-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 2rem; }
/* mock-test.css मध्ये टाका */
.chapter-grid {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    max-width: 600px;
    margin: 0 auto;
}

.chapter-card {
    background: #fff;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    padding: 1rem 1.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: left;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.chapter-card:hover {
    transform: translateX(5px);
    border-color: var(--primary-color);
    box-shadow: 0 5px 15px rgba(0, 119, 182, 0.1);
}

.chapter-card i {
    font-size: 1.5rem;
    color: var(--primary-color);
}
.selection-card {
    background: #fff; border: 2px solid #e0e0e0; border-radius: 16px; padding: 2rem;
    cursor: pointer; transition: all 0.3s ease; text-align: center;
}
.selection-card:hover { transform: translateY(-8px); border-color: var(--primary-color); box-shadow: 0 10px 30px rgba(0, 119, 182, 0.15); }
.selection-card:disabled { opacity: 0.5; cursor: not-allowed; transform: none; box-shadow: none; border-color: #e0e0e0; }
.selection-card i { font-size: 2.8rem; color: var(--primary-color); margin-bottom: 1rem; }
.selection-card h3 { font-size: 1.5rem; color: var(--text-color); margin: 0; }
.selection-card p { color: #6c757d; margin-top: 0.5rem; }
.back-btn-step { background: none; border: none; cursor: pointer; color: var(--primary-color); font-weight: 600; display: flex; align-items: center; gap: 5px; margin-bottom: 2rem; }


/* --- 2. Test Environment (test-environment.html) Styling --- */

.test-body-fullscreen {
    background-color: #eef5f9;
    overflow: hidden; /* Prevent body scroll on desktop */
}
/* Environment Setup Loader */
.environment-loader { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(255, 255, 255, 0.9); backdrop-filter: blur(5px); z-index: 9999; align-items: center; justify-content: center; }
.environment-loader.active { display: flex; }
.loader-content { text-align: center; animation: slideUpIn 0.8s ease-out; }
.spinner-large { width: 60px; height: 60px; border: 6px solid rgba(0, 119, 182, 0.2); border-top-color: var(--primary-color); border-radius: 50%; animation: spin 1.2s linear infinite; margin: 0 auto 1.5rem auto; }
.loader-content h2 { font-size: 1.8rem; color: var(--text-color); }
.loader-content p { color: #6c757d; }
.countdown-timer {
    margin-top: 1.5rem;
    font-size: 1.1rem;
    font-weight: 500;
    color: var(--primary-color);
    animation: fadeIn 1s;
}

/* Main Test Interface */
.test-interface-hidden { display: none; }
.test-header { display: flex; justify-content: space-between; align-items: center; background: #fff; padding: 0.8rem 2rem; box-shadow: 0 2px 10px rgba(0,0,0,0.1); }
.test-info { display: flex; align-items: center; gap: 15px; }
.test-logo { height: 40px; }
.timer { font-size: 1.2rem; font-weight: 600; color: #DC3545; }
/* --- मोबाईलवर सब्जेक्ट टॅब्स आणि हेडर फिक्स --- */

@media (max-width: 768px) {
    /* १. हेडरला फ्लेक्स-रॅप करा जेणेकरून टॅब्स खाली येतील */
    .test-header {
        flex-direction: column; /* सर्व गोष्टी एकाखाली एक येतील */
        align-items: flex-start;
        padding: 10px 15px;
        gap: 10px;
        height: auto; /* हाईट आपोआप वाढू द्या */
    }

    /* २. लोगो आणि टायमर एका ओळीत ठेवा */
    .test-info {
        display: flex;
        justify-content: space-between;
        width: 100%;
        align-items: center;
    }

    .test-logo {
        height: 30px; /* मोबाईलवर लोगो थोडा लहान करा */
    }

    .timer {
        font-size: 1rem;
        margin-left: auto;
    }

    /* ३. सब्जेक्ट टॅब्सला पूर्ण रुंदी द्या आणि आडवे स्क्रोल होऊ द्या */
    .subject-tabs {
        display: flex;
        width: 100%;
        margin-left: 0; /* जुना मार्जिन काढून टाका */
        overflow-x: auto; /* जर टॅब्स जास्त असतील तर आडवे स्क्रोल होईल */
        white-space: nowrap; /* टॅब्स एका ओळीत राहतील */
        padding-bottom: 5px;
        -webkit-overflow-scrolling: touch; /* मोबाईलवर स्मूथ स्क्रोलिंगसाठी */
        gap: 8px;
    }

    /* स्क्रोलबार लपवण्यासाठी (दिसायला स्वच्छ वाटेल) */
    .subject-tabs::-webkit-scrollbar {
        display: none;
    }

    .tab-btn {
        flex-shrink: 0; /* टॅब्स आकसत नाहीत (Shrink होत नाहीत) */
        padding: 6px 12px;
        font-size: 0.85rem;
    }

    /* ४. "Mock Test" नाव खूप मोठे असेल तर ते लहान करा किंवा लपवा */
    #subject-name {
        font-size: 0.9rem;
        display: inline-block;
        max-width: 150px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
}
.test-container {
    display: grid;
    grid-template-columns: 1fr 320px; /* Wider palette on desktop */
    gap: 1.5rem;
    padding: 1.5rem;
    height: calc(100vh - 70px);
    overflow: hidden; /* Prevents container from overflowing */
}
/* Question Area (Left Side) */
.question-area { display: flex; flex-direction: column; background: #fff; border-radius: 12px; overflow: hidden; }
.question-header { padding: 1rem 1.5rem; border-bottom: 1px solid #e0e0e0; font-weight: 600; flex-shrink: 0; }
.question-content { padding: 1.5rem; flex-grow: 1; overflow-y: auto; }
.question-text { font-size: 1.1rem; line-height: 1.7; margin-bottom: 2rem; word-wrap: break-word; } /* Important for long text */

/* Options Styling (Upgraded) */
.options-container { display: grid; grid-template-columns: 1fr; gap: 1rem; }
.option { display: flex; align-items: center; background-color: #f8f9fa; border: 2px solid #e0e0e0; border-radius: 12px; padding: 1rem; cursor: pointer; transition: all 0.2s ease; position: relative; }
.option:hover { border-color: var(--primary-color); background-color: var(--light-blue-bg); }
.option input[type="radio"] { opacity: 0; position: absolute; width: 100%; height: 100%; top: 0; left: 0; cursor: pointer; }
.option label { font-size: 1rem; font-weight: 500; color: var(--text-color); cursor: pointer; padding-left: 35px; word-break: break-word; }
.option label::before { content: ''; position: absolute; left: 15px; top: 50%; transform: translateY(-50%); width: 22px; height: 22px; border: 2px solid #ccc; border-radius: 50%; transition: all 0.2s ease; }
.option input[type="radio"]:checked + label::before { border-color: var(--primary-color); background-color: var(--primary-color); box-shadow: 0 0 0 3px white inset; }
.option input[type="radio"]:checked + label { color: var(--primary-color); font-weight: 600; }

.question-navigation { display: flex; flex-wrap: wrap; gap: 1rem; padding: 1.5rem; border-top: 1px solid #e0e0e0; flex-shrink: 0; }
.btn-review { background-color: #ffc107; color: #333 !important; }

/* Palette Area (Right Side) */
.palette-area { background: #fff; border-radius: 12px; padding: 1.5rem; display: flex; flex-direction: column; overflow-y: auto; }
.palette-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; margin-bottom: 1.5rem; }
.palette-box { width: 100%; aspect-ratio: 1 / 1; border: 1px solid #ccc; border-radius: 8px; cursor: pointer; font-weight: 600; transition: all 0.2s; }
.palette-box:hover { transform: scale(1.1); }
.palette-box.not-answered { background-color: #f8f9fa; }
.palette-box.answered { background-color: #198754; color: #fff; border-color: #198754; }
.palette-box.marked { background-color: #6f42c1; color: #fff; border-color: #6f42c1; }
.palette-box.current { border-color: var(--primary-color); border-width: 3px; transform: scale(1.05); }
.palette-legend { display: grid; gap: 0.5rem; margin-bottom: 1.5rem; }
.palette-legend div { display: flex; align-items: center; }
.palette-legend .palette-box { width: 18px; height: 18px; margin-right: 10px; pointer-events: none; }
.submit-btn-final { margin-top: auto; background-color: #DC3545; }

/* --- Mobile & Tablet View --- */
@media (max-width: 992px) {
    .test-body-fullscreen { overflow-y: auto; }
    .test-container { grid-template-columns: 1fr; height: auto; padding: 1rem; }
    .palette-area { order: -1; margin-bottom: 1.5rem; }
    .question-area { min-height: 500px; }
    .test-header { padding: 0.8rem 1rem; }
    .question-text { font-size: 1rem; }
    .option label { font-size: 0.95rem; }
}


@keyframes spin { to { transform: rotate(360deg); } }
@keyframes blink { 0%, 80%, 100% { opacity: 0; } 40% { opacity: 1; } }

/* Result Modal */
.modal-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.6); display: flex; align-items: center; justify-content: center;
    z-index: 10000; animation: fadeIn 0.5s;
}
.result-modal-content {
    background: #fff; border-radius: 16px; width: 90%; max-width: 500px;
    text-align: center; animation: slideUpIn 0.6s;
}
.result-header { background: var(--primary-color); color: #fff; padding: 1.5rem; border-radius: 16px 16px 0 0; }
.result-summary { display: flex; justify-content: space-around; padding: 2rem; }
.summary-item span { font-size: 2.5rem; font-weight: 700; color: var(--primary-color); }
.result-details { padding: 0 2rem; }
.result-details p { font-size: 1.1rem; }
.result-details .correct { color: #198754; }
.result-details .wrong { color: #DC3545; }
.result-actions { padding: 2rem; display: flex; justify-content: center; gap: 1rem; }

/* Review Answers Section */
#review-section {
    /* This container will hold everything */
    width: 100%;
    max-width: 900px; /* Limits width on desktop */
    margin: 0 auto; /* Centers the container */
    padding: 2rem 1rem; /* Adds padding on the sides for mobile */
}

.review-header {
    display: flex;
    flex-direction: column; /* मोबाईलवर एकाखाली एक ठेवा */
    align-items: flex-start; /* सर्व डावीकडे अलाइन करा */
    gap: 1rem; /* शीर्षक आणि बटणामध्ये जागा सोडा */
    margin-bottom: 2rem;
}

.review-header h1 {
    font-size: 2.2rem; /* शीर्षकाचा आकार मोबाईलसाठी थोडा मोठा केला */
    margin: 0;
    line-height: 1.2;
}

/* --- Media Query for DESKTOP View --- */
/* This will apply only when screen is wider than 576px */
@media (min-width: 576px) {
    .review-header {
        flex-direction: row; /* डेस्कटॉपवर शेजारी-शेजारी ठेवा */
        justify-content: space-between;
        align-items: center;
    }

    .review-header h1 {
        font-size: 2.5rem;
    }
}
.review-card {
    background: #fff;
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    border-left: 5px solid #ccc; /* Default border */
}
.review-card.correct { border-left-color: #198754; }
.review-card.wrong { border-left-color: #DC3545; }
.review-card.unanswered { border-left-color: #6c757d; }

.review-question {
    font-size: 1.1rem;
    margin-bottom: 1rem;
}

.review-options {
    list-style: none;
    padding: 0;
    margin-bottom: 1rem;
}
.review-options li {
    padding: 0.8rem 1rem;
    border-radius: 8px;
    margin-bottom: 0.5rem;
    border: 1px solid #eee;
}
.review-options li.correct-option {
    background: #d1e7dd;
    border-color: #a3cfbb;
    font-weight: 600;
}
.review-options li.wrong-option {
    background: #f8d7da;
    border-color: #f1b0b7;
    text-decoration: line-through;
}

.explanation {
    margin-top: 1rem;
    padding: 1rem;
    border-top: 1px solid #eee;
    background-color: #f8f9fa;
    border-radius: 8px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* Mobile View Adjustments */
@media (max-width: 992px) {
    .test-container { grid-template-columns: 1fr; }
    .palette-area { order: -1; margin-bottom: 2rem; } /* Palette goes on top on mobile */
    .palette-grid { grid-template-columns: repeat(auto-fit, minmax(40px, 1fr)); }
}
/* Keyframes for the spinner animation */
@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}
/* --- Custom Confirmation Modal Styling --- */

.confirm-modal-content {
    background: #fff;
    border-radius: 16px;
    width: 90%;
    max-width: 400px;
    padding: 2rem;
    text-align: center;
    animation: slideUpIn 0.4s ease-out;
    border-top: 5px solid var(--primary-color);
}

.modal-icon {
    font-size: 3rem;
    color: #ffc107; /* Warning Yellow */
    margin-bottom: 1rem;
}

.confirm-modal-content h3 {
    font-size: 1.5rem;
    color: var(--text-color);
    margin: 0 0 0.5rem 0;
}

.confirm-modal-content p {
    color: #6c757d;
    margin-bottom: 2rem;
}

.modal-actions {
    display: flex;
    justify-content: center;
    gap: 1rem;
}

.modal-actions .btn {
    flex: 1;
}
.modal-actions .btn-danger {
    background-color: #DC3545;
}
/* For JEE Numerical Questions */
.numerical-input {
    width: 100%;
    max-width: 400px;
    padding: 1rem;
    font-size: 1.1rem;
    font-weight: 500;
    border: 2px solid #ccc;
    border-radius: 12px;
    outline: none;
    transition: border-color 0.3s, box-shadow 0.3s;
    text-align: center;
    margin: 1rem auto;
}
.numerical-input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(0, 119, 182, 0.2);
}
/* Subject Tabs Styling */
.subject-tabs {
    display: flex;
    background: #f1f3f5;
    padding: 10px;
    gap: 10px;
    border-bottom: 2px solid #e0e0e0;
}

.tab-btn {
    padding: 8px 20px;
    border: none;
    background: #fff;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s;
    border: 1px solid #ddd;
}

.tab-btn.active {
    background: var(--primary-color);
    color: #fff;
    border-color: var(--primary-color);
    box-shadow: 0 4px 10px rgba(0, 119, 182, 0.2);
}

.tab-btn:hover:not(.active) {
    background: #e9ecef;
}
/* --- 1. नवीन स्टेप ६ (Full Test Selection) साठी स्टाईलिंग --- */
#step-6-full-test .selection-grid {
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); /* ३ कार्ड्ससाठी बेस्ट लेआउट */
    gap: 1.5rem;
    margin-top: 2rem;
}

/* Full Test कार्ड्सना थोडे वेगळे दाखवण्यासाठी (Optional) */
#step-6-full-test .selection-card i {
    color: #ffc107; /* गोल्ड कलर - प्रीमियम फिलसाठी */
}

/* --- 2. स्टेप्समधील ट्रान्झिशन (Smooth Transition) --- */
.test-step {
    display: none;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.4s ease;
}

.test-step.active {
    display: block;
    opacity: 1;
    transform: translateY(0);
}

/* --- 3. चॅप्टर ग्रिड सुधारणा (Scrollable List) --- */
.chapter-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.8rem;
    max-width: 700px;
    margin: 2rem auto;
    max-height: 400px; /* जर चॅप्टर्स खूप असतील तर स्क्रोल येईल */
    overflow-y: auto;
    padding-right: 10px;
}

/* कस्टम स्क्रोलबार */
.chapter-grid::-webkit-scrollbar {
    width: 6px;
}
.chapter-grid::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 10px;
}

/* --- 4. रिझल्ट मधील ॲडव्हान्स ॲनालिटिक्स (Topic Bars) --- */
.topic-analysis-grid {
    margin-top: 2rem;
    text-align: left;
    background: #f8f9fa;
    padding: 1.5rem;
    border-radius: 12px;
}

.topic-bar-row {
    margin-bottom: 1.2rem;
}

.topic-label {
    display: flex;
    justify-content: space-between;
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 5px;
    color: var(--text-color);
}

.bar-bg {
    width: 100%;
    height: 10px;
    background: #e0e0e0;
    border-radius: 5px;
    overflow: hidden;
}

.bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #198754, #28a745);
    border-radius: 5px;
    transition: width 1s ease-in-out;
}

/* --- 5. फुल टेस्ट मधील विषय टॅब्स (Subject Tabs) --- */
.subject-tabs {
    display: flex;
    gap: 8px;
    background: #f0f4f8;
    padding: 5px;
    border-radius: 30px;
    margin-left: 20px;
}

.tab-btn {
    padding: 6px 15px;
    border: none;
    background: transparent;
    border-radius: 25px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.tab-btn.active {
    background: var(--primary-color);
    color: white;
    box-shadow: 0 4px 10px rgba(0, 119, 182, 0.2);
}

/* --- 6. प्रिंट आणि पीडीएफ साठी सुधारणा --- */
@media print {
    header, footer, .test-header, .palette-area, .btn, .back-btn-step {
        display: none !important;
    }
    .review-section, .analytics-view {
        display: block !important;
        width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
    }
    .review-card {
        page-break-inside: avoid;
        border: 1px solid #eee !important;
        margin-bottom: 20px !important;
    }
}
/* --- Result Dashboard Styling --- */
.result-dashboard {
    background: #f0f4f8;
    width: 95%;
    max-width: 800px;
    border-radius: 24px;
    padding: 2rem;
    box-shadow: 0 20px 50px rgba(0,0,0,0.15);
    max-height: 90vh;
    overflow-y: auto;
    animation: slideUpIn 0.5s ease;
}

.result-header-box {
    margin-bottom: 2rem;
}

.main-score-card {
    background: linear-gradient(135deg, var(--primary-color), #00b4d8);
    color: white;
    padding: 2rem;
    border-radius: 20px;
    text-align: center;
}

.score-circle h1 {
    font-size: 3.5rem;
    margin: 0;
}

.score-circle h1 span {
    font-size: 1.5rem;
    opacity: 0.8;
}

.percentile-badge {
    background: rgba(255,255,255,0.2);
    display: inline-block;
    padding: 8px 20px;
    border-radius: 30px;
    margin-top: 15px;
    font-weight: 600;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    margin-bottom: 2rem;
}

.stat-box {
    background: white;
    padding: 1.5rem;
    border-radius: 18px;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.05);
}

.stat-box i { font-size: 2rem; }
.stat-box.correct i { color: #198754; }
.stat-box.wrong i { color: #dc3545; }
.stat-box.skip i { color: #6c757d; }

.stat-info h3 { margin: 0; font-size: 1.5rem; }
.stat-info p { margin: 0; color: #6c757d; font-size: 0.9rem; }

/* Analysis Card */
.analysis-card {
    background: white;
    padding: 1.5rem;
    border-radius: 18px;
    text-align: left;
    box-shadow: 0 5px 15px rgba(0,0,0,0.05);
}

.topic-row { margin-bottom: 15px; }
.topic-meta {
    display: flex;
    justify-content: space-between;
    margin-bottom: 5px;
    font-weight: 600;
    font-size: 0.9rem;
}

.progress-bar-bg {
    background: #eee;
    height: 8px;
    border-radius: 10px;
}

.progress-fill {
    background: var(--primary-color);
    height: 100%;
    border-radius: 10px;
    transition: width 1s ease-in-out;
}

/* Actions Buttons */
.dashboard-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
    margin-top: 2rem;
}

.action-btn {
    border: none;
    padding: 12px;
    border-radius: 12px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: transform 0.2s;
}

.action-btn:hover { transform: translateY(-3px); }
.action-btn.review { background: #ffc107; color: #000; }
.action-btn.download { background: var(--primary-color); color: #fff; }
.action-btn.home { background: #6c757d; color: #fff; }

/* Responsive */
@media (max-width: 600px) {
    .stats-grid { grid-template-columns: 1fr; }
    .score-circle h1 { font-size: 2.5rem; }
}
