/* ========================================================
   SOLUTION BUDDY - UNIFIED STYLESHEET FOR SOLUTION PAGES
   Class 10 Science & Technology Part 1 (English Medium)
   ======================================================== */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Poppins', Arial, sans-serif;
}

body {
    background-color: #f8fafc;
    color: #0f172a;
    line-height: 1.65;
    transition: background-color 0.25s ease, color 0.25s ease;
}

/* ========================================================
   TOP STICKY HEADER BAR
   ======================================================== */
.site-header {
    background: #0f172a;
    color: #ffffff;
    padding: 8px 16px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
    position: sticky;
    top: 0;
    z-index: 1000;
    transition: background-color 0.25s ease;
}

.header-container {
    max-width: 860px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 40px;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 0;
}

.header-back-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    color: #ffffff;
    text-decoration: none;
    font-size: 26px;
    font-weight: 700;
    line-height: 1;
    padding: 2px 6px;
    cursor: pointer;
    transition: transform 0.2s ease, color 0.2s ease;
    flex-shrink: 0;
}

.header-back-btn:hover {
    color: #38bdf8;
    transform: translateX(-3px);
    background: transparent !important;
}

.header-title {
    font-size: 16px;
    font-weight: 700;
    color: #f8fafc;
    text-align: left;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
    flex: 1;
}

.unit-chap-short {
    color: #38bdf8;
    font-weight: 800;
    margin-right: 4px;
    white-space: nowrap;
}

.chap-name-full {
    color: #f1f5f9;
    font-weight: 600;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.header-icon-btn {
    background: transparent;
    border: 1px solid transparent;
    color: #f8fafc;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 18px;
    transition: all 0.2s ease;
    outline: none;
}

.header-icon-btn:hover {
    background: rgba(255, 255, 255, 0.12);
    color: #38bdf8;
}

/* ========================================================
   PAGE CONTAINER & WORKBOOK PAGE BOXES
   ======================================================== */
.page-container {
    max-width: 860px;
    margin: 22px auto 40px auto;
    padding: 0 14px;
}

.workbook-page {
    background: #ffffff;
    border: 1.5px solid #cbd5e1;
    border-radius: 8px;
    padding: 26px 28px;
    margin-bottom: 22px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    position: relative;
    transition: background-color 0.25s ease, border-color 0.25s ease;
}

.page-content {
    width: 100%;
}

/* CHAPTER HEADER IN FIRST BOX */
.page-header-box {
    border-bottom: 2px solid #0f172a;
    padding: 0 0 12px 0;
    text-align: center;
    margin-bottom: 20px;
    background: transparent;
}

.page-header-box h2 {
    font-size: 21px;
    font-weight: 800;
    color: #0f172a;
    margin-bottom: 4px;
    letter-spacing: 0.5px;
}

.page-header-box h3 {
    font-size: 16.5px;
    font-weight: 700;
    color: #b45309;
    display: inline-block;
}

/* MAIN QUESTION TITLE (Q1, Q2, etc.) */
.main-q-title {
    font-size: 17px;
    font-weight: 800;
    color: #0f172a;
    margin-bottom: 16px;
    display: flex;
    align-items: baseline;
    gap: 8px;
}

.main-q-num {
    background: #0284c7;
    color: #ffffff;
    padding: 2px 10px;
    border-radius: 6px;
    font-size: 14.5px;
    font-weight: 800;
    flex-shrink: 0;
    display: inline-block;
}

.main-q-text {
    flex: 1;
    line-height: 1.5;
}

/* SUB-QUESTION FIELD GROUPS */
.field-group {
    margin-bottom: 16px;
}

.field-group:last-child {
    margin-bottom: 0;
}

.field-title {
    font-size: 15px;
    font-weight: 700;
    color: #0f172a;
    margin-bottom: 6px;
    line-height: 1.5;
}

.field-answer {
    font-size: 14.5px;
    color: #0f172a;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    padding: 10px 14px;
    border-radius: 6px;
    line-height: 1.68;
    text-align: justify;
}

.ans-label {
    color: #1e3a8a;
    font-weight: 800;
    margin-right: 6px;
    display: inline-block;
}

.field-answer p {
    margin-bottom: 8px;
}

.field-answer p:last-child {
    margin-bottom: 0;
}

.field-answer ul, .field-answer ol {
    margin-left: 20px;
    margin-top: 6px;
    margin-bottom: 8px;
}

.field-answer li {
    margin-bottom: 4px;
}

/* TABLES */
.workbook-table, .data-table, .styled-table {
    width: 100%;
    border-collapse: collapse;
    margin: 14px 0;
    font-size: 13.5px;
    background: #ffffff;
    border: 1.5px solid #0f172a;
}

.workbook-table th, .workbook-table td,
.data-table th, .data-table td,
.styled-table th, .styled-table td {
    border: 1.5px solid #0f172a;
    padding: 8px 12px;
    text-align: left;
    vertical-align: top;
}

.workbook-table th, .data-table th, .styled-table th {
    background-color: #f1f5f9;
    color: #0f172a;
    font-weight: 700;
    text-align: center;
}

/* NUMERICAL STEP BOX */
.step-box {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 12px 14px;
    margin: 8px 0;
    font-size: 14px;
    line-height: 1.6;
}

.step-line {
    margin-bottom: 5px;
}

.step-result {
    font-weight: 700;
    color: #1e3a8a;
    margin-top: 6px;
    padding-top: 6px;
    border-top: 1px dashed #cbd5e1;
}

/* CHEMICAL FORMULA / CODE HIGHLIGHT */
.chem-eqn {
    background: #f1f5f9;
    border-left: 3px solid #0284c7;
    padding: 8px 12px;
    margin: 8px 0;
    font-family: 'Consolas', 'Courier New', monospace;
    font-size: 14px;
    font-weight: 600;
    color: #0f172a;
    border-radius: 0 6px 6px 0;
    overflow-x: auto;
}

.chem-structure-card {
    background: #f1f5f9;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    padding: 10px 14px;
    margin: 8px 0;
    font-family: 'Consolas', 'Courier New', monospace;
    font-size: 13.5px;
    font-weight: 600;
    color: #0f172a;
    white-space: pre-wrap;
    line-height: 1.45;
}

/* SVG DIAGRAM CARDS */
.image-box-wrapper, .svg-diagram-card {
    border: 1.5px dashed #94a3b8;
    border-radius: 6px;
    padding: 14px;
    margin: 14px 0;
    background: #f8fafc;
    text-align: center;
}

.image-box-wrapper svg, .svg-diagram-card svg {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 0 auto 8px auto;
    border-radius: 4px;
    background: #ffffff;
}

.image-box-title, .diagram-caption {
    font-size: 13px;
    font-weight: 700;
    color: #0f172a;
    margin-top: 6px;
}

/* BOTTOM BACK BUTTON */
.bottom-nav-container {
    text-align: center;
    margin: 28px 0 20px 0;
}

.bottom-back-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 24px;
    background-color: #1e293b;
    color: #ffffff;
    border-radius: 6px;
    text-decoration: none;
    font-size: 15px;
    font-weight: 600;
    transition: all 0.2s;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

.bottom-back-btn:hover {
    background-color: #334155;
    transform: translateY(-1px);
}

/* SEO CONTENT & FAQ SECTION */
.seo-section {
    background: #ffffff;
    border-radius: 8px;
    padding: 24px 28px;
    margin-top: 24px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    border: 1.5px solid #cbd5e1;
    text-align: left;
    line-height: 1.7;
    transition: background-color 0.25s ease, border-color 0.25s ease;
}

.seo-section h3 {
    color: #4B3D00;
    border-left: 4px solid #f59e0b;
    padding-left: 10px;
    font-size: 18px;
    font-weight: 700;
    margin-top: 22px;
    margin-bottom: 10px;
}

.seo-section h3:first-of-type {
    margin-top: 0;
}

.seo-section p {
    color: #334155;
    font-size: 14px;
    margin-bottom: 12px;
}

.seo-section ul {
    padding-left: 20px;
    color: #334155;
    font-size: 14px;
    margin-bottom: 14px;
}

.seo-section ul li {
    margin-bottom: 5px;
}

.faq-item {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 12px 14px;
    margin-bottom: 10px;
}

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

.faq-item h4 {
    margin: 0 0 5px 0;
    color: #0f172a;
    font-size: 14.5px;
    font-weight: 700;
}

.faq-item p {
    margin: 0;
    color: #475569;
    font-size: 13.5px;
}

.tags-container {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 14px;
}

.tag-pill {
    background: #f1f5f9;
    color: #1e293b;
    font-size: 12px;
    font-weight: 600;
    padding: 5px 12px;
    border-radius: 20px;
    text-decoration: none;
    border: 1px solid #cbd5e1;
    transition: all 0.2s;
}

.tag-pill:hover {
    background: #fde68a;
    border-color: #f59e0b;
}

/* TOAST NOTIFICATION */
.toast-popup {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: #0f172a;
    color: #ffffff;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
    z-index: 2000;
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    text-align: center;
    max-width: 90%;
    border: 1px solid rgba(255, 255, 255, 0.15);
}

.toast-popup.toast-show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
    pointer-events: auto;
}

/* ========================================================
   DARK MODE STYLES
   ======================================================== */
body.dark-mode {
    background-color: #0b1120;
    color: #e2e8f0;
}

body.dark-mode .site-header {
    background: #020617;
    border-bottom: 1px solid #1e293b;
}

body.dark-mode .header-back-btn {
    color: #ffffff;
}

body.dark-mode .header-back-btn:hover {
    color: #38bdf8;
}

body.dark-mode .header-title {
    color: #f8fafc;
}

body.dark-mode .unit-chap-short {
    color: #38bdf8;
}

body.dark-mode .chap-name-full {
    color: #cbd5e1;
}

body.dark-mode .workbook-page {
    background: #1e293b;
    border-color: #334155;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

body.dark-mode .page-header-box {
    border-bottom-color: #475569;
}

body.dark-mode .page-header-box h2 {
    color: #f8fafc;
}

body.dark-mode .page-header-box h3 {
    color: #fbbf24;
}

body.dark-mode .main-q-title {
    color: #f8fafc;
}

body.dark-mode .field-title {
    color: #f8fafc;
}

body.dark-mode .field-answer {
    background: #0f172a;
    border-color: #334155;
    color: #e2e8f0;
}

body.dark-mode .ans-label {
    color: #60a5fa;
}

body.dark-mode .workbook-table,
body.dark-mode .data-table,
body.dark-mode .styled-table {
    background: #1e293b;
    color: #e2e8f0;
    border-color: #475569;
}

body.dark-mode .workbook-table th,
body.dark-mode .data-table th,
body.dark-mode .styled-table th {
    background-color: #0f172a;
    color: #f8fafc;
    border-color: #475569;
}

body.dark-mode .workbook-table td,
body.dark-mode .data-table td,
body.dark-mode .styled-table td {
    border-color: #475569;
    color: #e2e8f0;
}

body.dark-mode .step-box {
    background: #0f172a;
    border-color: #334155;
    color: #e2e8f0;
}

body.dark-mode .step-result {
    color: #38bdf8;
    border-top-color: #334155;
}

body.dark-mode .chem-eqn,
body.dark-mode .chem-structure-card {
    background: #0f172a;
    border-color: #334155;
    color: #38bdf8;
}

body.dark-mode .image-box-wrapper,
body.dark-mode .svg-diagram-card {
    background: #0f172a;
    border-color: #475569;
}

body.dark-mode .image-box-wrapper svg,
body.dark-mode .svg-diagram-card svg {
    background: #1e293b;
}

body.dark-mode .image-box-title,
body.dark-mode .diagram-caption {
    color: #f8fafc;
}

body.dark-mode .bottom-back-btn {
    background-color: #334155;
    color: #f8fafc;
}

body.dark-mode .bottom-back-btn:hover {
    background-color: #475569;
}

body.dark-mode .seo-section {
    background: #1e293b;
    border-color: #334155;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

body.dark-mode .seo-section h3 {
    color: #fbbf24;
    border-left-color: #f59e0b;
}

body.dark-mode .seo-section p,
body.dark-mode .seo-section ul,
body.dark-mode .seo-section ul li {
    color: #cbd5e1;
}

body.dark-mode .faq-item {
    background: #0f172a;
    border-color: #334155;
}

body.dark-mode .faq-item h4 {
    color: #f8fafc;
}

body.dark-mode .faq-item p {
    color: #94a3b8;
}

body.dark-mode .tag-pill {
    background: #0f172a;
    color: #cbd5e1;
    border-color: #334155;
}

body.dark-mode .tag-pill:hover {
    background: #f59e0b;
    color: #0f172a;
    border-color: #f59e0b;
}

/* ========================================================
   RESPONSIVE (MOBILE OPTIMIZED)
   ======================================================== */
@media (max-width: 600px) {
    .site-header {
        padding: 6px 12px;
    }

    .header-title {
        font-size: 14.5px;
    }

    .page-container {
        margin: 14px auto 28px auto;
        padding: 0 8px;
    }

    .workbook-page {
        padding: 18px 16px;
        margin-bottom: 16px;
    }

    .page-header-box h2 {
        font-size: 18px;
    }

    .page-header-box h3 {
        font-size: 15px;
    }

    .main-q-title {
        font-size: 15.5px;
    }

    .field-title {
        font-size: 14px;
    }

    .field-answer {
        padding: 8px 10px;
        font-size: 13.5px;
    }

    .workbook-table, .data-table, .styled-table {
        font-size: 12px;
    }

    .workbook-table th, .workbook-table td,
    .data-table th, .data-table td,
    .styled-table th, .styled-table td {
        padding: 6px 8px;
    }

    .seo-section {
        padding: 18px 16px;
    }
}
