/* --- RBSE / CBSE MODE STYLES --- */
.mode-toggle-row {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.mode-btn {
    flex: 1;
    padding: 15px;
    border-radius: 12px;
    background: #f1f5f9;
    color: var(--txt-sec);
    font-weight: 800;
    font-size: 14px;
    text-transform: uppercase;
    transition: all 0.2s ease;
    border: 2px solid transparent;
}

.mode-btn.active {
    background: #000;
    color: #fff;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.section-label {
    text-align: center;
    font-size: 13px;
    font-weight: 800;
    color: var(--txt-ter);
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.class-grid {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.class-btn {
    width: 45px;
    height: 45px;
    border-radius: 12px;
    background: #f1f5f9;
    color: var(--txt);
    font-weight: 800;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.class-btn.active {
    background: #000;
    color: #fff;
    transform: scale(1.1);
    box-shadow: 0 4px 10px rgba(0,0,0,0.15);
}

.chapter-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 10px;
    max-height: 200px;
    overflow-y: auto;
    padding: 5px;
}

.chapter-btn {
    background: #f1f5f9;
    padding: 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 700;
    color: var(--txt-sec);
    text-align: center;
    transition: all 0.2s ease;
    min-height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1.3;
}

.chapter-btn.active {
    background: #eef6fb;
    color: var(--blue);
    border: 2px solid var(--blue);
    box-shadow: 0 4px 10px rgba(var(--blue-rgb), 0.1);
}

/* Scrollbar for chapter grid */
.chapter-grid::-webkit-scrollbar {
    width: 6px;
}
.chapter-grid::-webkit-scrollbar-track {
    background: #f1f5f9;
}
.chapter-grid::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

/* --- DOWNLOAD MODAL --- */
.dl-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(15px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    padding: 20px;
}

.dl-modal-box {
    background: var(--bg-card);
    border-radius: 32px;
    width: min(900px, 95%);
    max-height: calc(100vh - 170px); /* Fits between header (70px) and footer (80px) + some margin */
    box-shadow: 0 30px 70px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.1);
    overflow: hidden;
    animation: modalPop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    display: flex;
    flex-direction: column;
    border: 2px solid var(--blue);
}

.dl-poster-con {
    width: 100%;
    aspect-ratio: 16/9;
    overflow: hidden;
    background: #000;
    flex-shrink: 0;
    border-bottom: 4px solid var(--blue);
}

.dl-poster-con img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.dl-info-con {
    padding: 20px;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    background: linear-gradient(180deg, #fff, var(--bg));
}

.dl-title {
    font-size: clamp(18px, 3.5vw, 24px);
    font-weight: 900;
    color: var(--blue-d);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: -0.5px;
}

.dl-meta {
    display: flex;
    gap: 10px;
    margin-bottom: 12px;
}

.dl-meta-item {
    background: var(--main-accent-color);
    padding: 6px 12px;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 800;
    color: #fff;
    box-shadow: 0 4px 10px rgba(var(--main-accent-rgb), 0.2);
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

.dl-meta-item:nth-child(2) {
    background: var(--orange);
    box-shadow: 0 4px 10px rgba(255, 140, 50, 0.2);
}

.dl-desc {
    font-size: 14px;
    color: var(--txt-sec);
    line-height: 1.5;
    margin-bottom: 15px;
    font-weight: 500;
    white-space: pre-wrap;
}

.dl-actions {
    display: flex;
    gap: 10px;
    margin-top: auto;
}

.dl-btn-main {
    flex: 2;
    background: var(--main-accent-color);
    color: #fff;
    padding: 14px;
    border-radius: 16px;
    font-weight: 900;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    box-shadow: 0 8px 20px rgba(var(--main-accent-rgb), 0.3);
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.dl-btn-close {
    flex: 1;
    background: #fff;
    color: var(--txt-sec);
    padding: 14px;
    border-radius: 16px;
    font-weight: 800;
    border: 2px solid var(--border);
    font-size: 13px;
}

.dl-btn-main:hover { transform: translateY(-3px) scale(1.02); box-shadow: 0 15px 30px rgba(var(--main-accent-rgb), 0.5); }
.dl-btn-close:hover { background: var(--bg-ter); border-color: var(--border-d); }

/* Landscape Specific Layout */
@media (orientation: landscape) and (max-height: 600px) {
    .dl-modal-box {
        flex-direction: row;
        width: min(700px, 95%);
        height: min(320px, 90vh);
        max-height: none;
    }
    .dl-poster-con {
        width: 40%;
        height: 100%;
        aspect-ratio: auto;
        border-bottom: none;
        border-right: 4px solid var(--blue);
    }
    .dl-info-con {
        width: 60%;
        padding: 15px;
    }
    .dl-title {
        font-size: 18px;
        margin-bottom: 5px;
    }
    .dl-meta {
        margin-bottom: 8px;
    }
    .dl-desc {
        font-size: 12px;
        margin-bottom: 10px;
    }
    .dl-btn-main, .dl-btn-close {
        padding: 10px;
        font-size: 12px;
    }
}

/* === FORCE FULL ACCENT SYSTEM OVERRIDE === */
.btn-orange,.btn-cyan,.btn-red,
.db-e,.db-n,.db-h{
background:var(--accent) !important;
box-shadow:0 8px 20px rgba(var(--accent-rgb),0.3) !important;
}

.new-tag{
background:var(--accent) !important;
}

.gc-btn,
.btn-main,
.dl-btn-main{
background:var(--accent) !important;
}
