/* ==========================================================================
   📚 NEXTEDU - PYQ (PREVIOUS YEAR QUESTIONS) MODAL & VIEWER STYLES
   Supports Light/Dark Mode & Seamless 4-World Theme Engine (Gamify, Minimalist, Duolingo, Standard)
   ========================================================================== */

/* --- 1. PYQ MODAL OVERLAY & CONTAINER --- */
#pyqModal.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 100005;
    background: rgba(2, 6, 23, 0.75);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 16px;
    opacity: 0;
    transition: opacity 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

#pyqModal.modal-overlay.active {
    display: flex !important;
    opacity: 1;
}

.pyq-modal-content {
    width: min(94vw, 920px);
    max-height: 88vh;
    background: var(--bg-card, #0f172a);
    border: 1px solid var(--border-color, rgba(255, 255, 255, 0.12));
    border-radius: 24px;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
    transform: translateY(15px) scale(0.98);
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

[data-theme="light"] .pyq-modal-content {
    background: #ffffff !important;
    border-color: #e2e8f0 !important;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.15) !important;
}

#pyqModal.modal-overlay.active .pyq-modal-content {
    transform: translateY(0) scale(1);
}

/* --- 2. MODAL HEADER --- */
.pyq-modal-header {
    padding: 18px 24px 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(15, 23, 42, 0.95);
    gap: 14px;
    flex-shrink: 0;
}

[data-theme="light"] .pyq-modal-header {
    background: #f8fafc !important;
    border-bottom-color: #e2e8f0 !important;
}

.pyq-brand-wrap {
    display: flex;
    align-items: center;
    gap: 12px;
}

.pyq-brand-orb {
    width: 44px;
    height: 44px;
    border-radius: 14px;
    background: linear-gradient(135deg, #8b5cf6 0%, #ec4899 100%);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    box-shadow: 0 6px 18px rgba(139, 92, 246, 0.35);
    flex-shrink: 0;
}

.pyq-title-group h2 {
    font-size: 1.2rem;
    font-weight: 800;
    margin: 0;
    color: var(--text-main, #f8fafc);
    letter-spacing: -0.3px;
    display: flex;
    align-items: center;
    gap: 8px;
}

[data-theme="light"] .pyq-title-group h2 {
    color: #0f172a !important;
}

.pyq-title-group p {
    font-size: 0.78rem;
    color: var(--text-muted, #94a3b8);
    margin: 2px 0 0;
}

.pyq-close-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-muted, #94a3b8);
    font-size: 1.2rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

[data-theme="light"] .pyq-close-btn {
    background: #f1f5f9 !important;
    border-color: #e2e8f0 !important;
    color: #475569 !important;
}

.pyq-close-btn:hover {
    background: #ef4444 !important;
    color: #ffffff !important;
    transform: rotate(90deg) scale(1.08);
}

/* --- 3. SEARCH & FILTER SECTION --- */
.pyq-search-filter-bar {
    padding: 12px 24px;
    background: rgba(0, 0, 0, 0.15);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    display: flex;
    flex-direction: column;
    gap: 10px;
    flex-shrink: 0;
}

[data-theme="light"] .pyq-search-filter-bar {
    background: #ffffff !important;
    border-bottom-color: #e2e8f0 !important;
}

.pyq-search-box {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(255, 255, 255, 0.05);
    border: 1.5px solid rgba(255, 255, 255, 0.1);
    border-radius: 14px;
    padding: 8px 14px;
    transition: all 0.2s ease;
}

[data-theme="light"] .pyq-search-box {
    background: #f8fafc !important;
    border-color: #cbd5e1 !important;
}

.pyq-search-box:focus-within {
    border-color: #8b5cf6 !important;
    box-shadow: 0 0 15px rgba(139, 92, 246, 0.25);
}

.pyq-search-box i {
    color: #8b5cf6;
    font-size: 1rem;
}

.pyq-search-box input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-main, #f8fafc);
    font-size: 0.92rem;
}

[data-theme="light"] .pyq-search-box input {
    color: #0f172a !important;
}

.pyq-filter-chips {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 4px;
    scrollbar-width: none;
}
.pyq-filter-chips::-webkit-scrollbar { display: none; }

.pyq-filter-chip {
    padding: 5px 12px;
    border-radius: 99px;
    font-size: 0.78rem;
    font-weight: 600;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-muted, #94a3b8);
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s ease;
}

[data-theme="light"] .pyq-filter-chip {
    background: #f1f5f9 !important;
    border-color: #e2e8f0 !important;
    color: #64748b !important;
}

.pyq-filter-chip.active,
.pyq-filter-chip:hover {
    background: #8b5cf6 !important;
    border-color: #8b5cf6 !important;
    color: #ffffff !important;
    transform: translateY(-1px);
}

/* --- 4. EXAM LIST GRID --- */
.pyq-modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px 24px;
}

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

.pyq-exam-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 14px;
    cursor: pointer;
    transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
    overflow: hidden;
}

[data-theme="light"] .pyq-exam-card {
    background: #ffffff !important;
    border-color: #e2e8f0 !important;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.04) !important;
}

.pyq-exam-card:hover {
    transform: translateY(-3px) scale(1.01);
    border-color: #8b5cf6 !important;
    box-shadow: 0 10px 25px rgba(139, 92, 246, 0.18) !important;
}

/* 🔒 ADMIN LOCKED (UNDER MAINTENANCE) - BLUR & CLEAN LOCK SVG ONLY */
.pyq-exam-card.is-admin-locked {
    cursor: not-allowed !important;
    pointer-events: auto !important;
}

.pyq-exam-card.is-admin-locked:hover {
    transform: none !important;
    border-color: rgba(255, 255, 255, 0.12) !important;
    box-shadow: none !important;
}

[data-theme="light"] .pyq-exam-card.is-admin-locked:hover {
    border-color: #cbd5e1 !important;
    box-shadow: none !important;
}

.pyq-exam-card.is-admin-locked .pyq-exam-card-inner {
    filter: blur(5px);
    -webkit-filter: blur(5px);
    opacity: 0.38;
    pointer-events: none;
    user-select: none;
    -webkit-user-select: none;
    transition: filter 0.25s ease, opacity 0.25s ease;
}

.pyq-locked-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    pointer-events: none;
    background: rgba(0, 0, 0, 0.25);
    backdrop-filter: blur(2.5px);
    -webkit-backdrop-filter: blur(2.5px);
}

[data-theme="light"] .pyq-locked-overlay {
    background: rgba(248, 250, 252, 0.45);
}

.pyq-lock-svg {
    width: 38px;
    height: 38px;
    color: #f59e0b;
    filter: drop-shadow(0 4px 14px rgba(0, 0, 0, 0.7)) drop-shadow(0 0 12px rgba(245, 158, 11, 0.45));
    animation: pyqLockPulse 2.8s ease-in-out infinite;
    pointer-events: none;
}

[data-theme="light"] .pyq-lock-svg {
    color: #d97706;
    filter: drop-shadow(0 4px 12px rgba(217, 119, 6, 0.35));
}

@keyframes pyqLockPulse {
    0%, 100% {
        transform: scale(1);
        opacity: 0.92;
    }
    50% {
        transform: scale(1.08);
        opacity: 1;
    }
}

.pyq-exam-top {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.pyq-exam-icon-wrap {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    font-size: 1.15rem;
    flex-shrink: 0;
}

.pyq-exam-info h4 {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-main, #f8fafc);
    line-height: 1.35;
}

[data-theme="light"] .pyq-exam-info h4 {
    color: #0f172a !important;
}

.pyq-exam-category-tag {
    font-size: 0.72rem;
    color: var(--text-muted, #94a3b8);
    margin-top: 2px;
}

.pyq-exam-bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-top: 1px dashed rgba(255, 255, 255, 0.08);
    padding-top: 10px;
}

[data-theme="light"] .pyq-exam-bottom {
    border-top-color: #e2e8f0 !important;
}

.pyq-years-count-pill {
    font-size: 0.72rem;
    color: var(--text-muted, #94a3b8);
    font-weight: 600;
}

.pyq-access-status-pill {
    font-size: 0.72rem;
    font-weight: 800;
    padding: 3px 8px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.pyq-access-status-pill.unlocked {
    background: rgba(16, 185, 129, 0.15);
    color: #10b981;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.pyq-access-status-pill.active {
    background: rgba(56, 189, 248, 0.15);
    color: #38bdf8;
    border: 1px solid rgba(56, 189, 248, 0.3);
}

.pyq-access-status-pill.locked {
    background: rgba(245, 158, 11, 0.15);
    color: #f59e0b;
    border: 1px solid rgba(245, 158, 11, 0.3);
}

/* --- 5. YEARS SELECTION VIEW --- */
.pyq-years-view {
    display: flex;
    flex-direction: column;
    gap: 20px;
    animation: fadeIn 0.25s ease;
}

.pyq-view-nav-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

[data-theme="light"] .pyq-view-nav-header {
    border-bottom-color: #e2e8f0 !important;
}

.btn-back-link {
    background: transparent;
    border: none;
    color: #8b5cf6;
    font-weight: 700;
    font-size: 0.88rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: transform 0.15s ease;
}
.btn-back-link:hover {
    transform: translateX(-3px);
}

.pyq-selected-exam-bar {
    display: flex;
    align-items: center;
    gap: 14px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    padding: 14px 18px;
}

[data-theme="light"] .pyq-selected-exam-bar {
    background: #f8fafc !important;
    border-color: #e2e8f0 !important;
}

.pyq-years-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 14px;
}

.pyq-year-card {
    background: rgba(255, 255, 255, 0.04);
    border: 1.5px solid rgba(255, 255, 255, 0.1);
    border-radius: 18px;
    padding: 20px 14px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

[data-theme="light"] .pyq-year-card {
    background: #ffffff !important;
    border-color: #cbd5e1 !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.04) !important;
}

.pyq-year-card:hover {
    transform: translateY(-4px) scale(1.02);
    border-color: #8b5cf6 !important;
    box-shadow: 0 10px 24px rgba(139, 92, 246, 0.25) !important;
}

.pyq-year-number {
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--text-main, #f8fafc);
    letter-spacing: -0.5px;
}

[data-theme="light"] .pyq-year-number {
    color: #0f172a !important;
}

.pyq-year-status {
    font-size: 0.72rem;
    color: #10b981;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 4px;
}

.pyq-year-action-btn {
    margin-top: 4px;
    font-size: 0.75rem;
    font-weight: 800;
    color: #ffffff;
    background: linear-gradient(135deg, #8b5cf6, #6d28d9);
    padding: 5px 12px;
    border-radius: 99px;
    border: none;
    cursor: pointer;
}

/* --- 6. UNLOCK DIALOG VIEW --- */
.pyq-unlock-view {
    max-width: 520px;
    margin: 10px auto;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    animation: fadeIn 0.25s ease;
}

.pyq-lock-orb {
    width: 68px;
    height: 68px;
    border-radius: 20px;
    background: linear-gradient(135deg, #f59e0b, #ef4444);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    box-shadow: 0 8px 25px rgba(245, 158, 11, 0.35);
}

.pyq-price-card {
    width: 100%;
    background: rgba(255, 255, 255, 0.04);
    border: 1.5px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    padding: 20px;
    text-align: left;
}

[data-theme="light"] .pyq-price-card {
    background: #f8fafc !important;
    border-color: #cbd5e1 !important;
}

.pyq-price-row {
    display: flex;
    align-items: baseline;
    gap: 8px;
    margin-bottom: 12px;
}

.pyq-price-val {
    font-size: 2.2rem;
    font-weight: 800;
    color: var(--text-main, #f8fafc);
}

[data-theme="light"] .pyq-price-val {
    color: #0f172a !important;
}

.pyq-price-validity {
    font-size: 0.88rem;
    color: #8b5cf6;
    font-weight: 700;
}

.pyq-features-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
    font-size: 0.84rem;
    color: var(--text-muted, #94a3b8);
}

.pyq-features-list li {
    display: flex;
    align-items: center;
    gap: 8px;
}
.pyq-features-list li i {
    color: #10b981;
}

.pyq-wallet-balance-pill {
    width: 100%;
    background: rgba(139, 92, 246, 0.1);
    border: 1px solid rgba(139, 92, 246, 0.3);
    border-radius: 12px;
    padding: 10px 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.85rem;
    font-weight: 600;
}

.btn-pay-pyq-wallet {
    width: 100%;
    padding: 14px;
    border-radius: 14px;
    background: linear-gradient(135deg, #8b5cf6, #6d28d9);
    color: #ffffff;
    font-size: 1rem;
    font-weight: 800;
    border: none;
    cursor: pointer;
    box-shadow: 0 8px 24px rgba(139, 92, 246, 0.35);
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}
.btn-pay-pyq-wallet:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 28px rgba(139, 92, 246, 0.5);
}

/* ==========================================================================
   🎮 THEME COMPATIBILITY: Gamify, Minimalist, Duolingo
   ========================================================================== */

/* Gamify Theme Override */
[data-ui-theme="gamify"] .pyq-modal-content,
[data-ui-theme="gamify"] .pyq-exam-card,
[data-ui-theme="gamify"] .pyq-year-card,
[data-ui-theme="gamify"] .pyq-price-card {
    border-radius: 4px !important;
    border: 1.5px solid var(--border, #00f0ff) !important;
    box-shadow: 0 0 18px var(--cyber-glow, rgba(0, 240, 255, 0.25)) !important;
}

[data-ui-theme="gamify"] .btn-pay-pyq-wallet,
[data-ui-theme="gamify"] .pyq-year-action-btn,
[data-ui-theme="gamify"] .pyq-filter-chip {
    border-radius: 4px !important;
    transform: skewX(-3deg) !important;
    text-transform: uppercase !important;
    letter-spacing: 0.8px !important;
}

/* Minimalist Theme Override */
[data-ui-theme="minimalistic"] .pyq-modal-content,
[data-ui-theme="minimalistic"] .pyq-exam-card,
[data-ui-theme="minimalistic"] .pyq-year-card,
[data-ui-theme="minimalistic"] .pyq-price-card {
    border-radius: 8px !important;
    border: 1px solid var(--border, #e4e4e7) !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04) !important;
}

[data-ui-theme="minimalistic"] .btn-pay-pyq-wallet,
[data-ui-theme="minimalistic"] .pyq-year-action-btn {
    border-radius: 6px !important;
    transform: none !important;
    border: 1.5px solid var(--border-strong, #09090b) !important;
}

/* Duolingo Theme Override - 3D Push-Down Physics */
[data-ui-theme="duolingo"] .pyq-modal-content,
[data-ui-theme="duolingo"] .pyq-exam-card,
[data-ui-theme="duolingo"] .pyq-year-card,
[data-ui-theme="duolingo"] .pyq-price-card {
    border-radius: 24px !important;
    border: 2.5px solid var(--border, #e5e7eb) !important;
    border-bottom: 5px solid var(--duo-card-ext, #d1d5db) !important;
}

[data-ui-theme="duolingo"] .btn-pay-pyq-wallet,
[data-ui-theme="duolingo"] .pyq-year-action-btn {
    border-radius: 18px !important;
    border-bottom: 5px solid #46a302 !important;
    box-shadow: 0 4px 0 rgba(0,0,0,0.08) !important;
}

[data-ui-theme="duolingo"] .btn-pay-pyq-wallet:active,
[data-ui-theme="duolingo"] .pyq-year-action-btn:active {
    transform: translateY(4px) !important;
    border-bottom-width: 2px !important;
    box-shadow: none !important;
}

@keyframes fadeIn {
    0% { opacity: 0; transform: translateY(8px); }
    100% { opacity: 1; transform: translateY(0); }
}
