:root {
    --bg-color: #f4f6f9;
    --text-color: #333333;
    --card-bg: #ffffff;
    --btn-inactive: #e0e0e0;
    --btn-active: #000000;
    --btn-active-text: #ffffff;
    --border-color: #000000;
    --summary-bg: #e0e0e0;
    --summary-text: #000000;
    --navbar-bg: #000000;
    --navbar-text: #ffffff;
    --logo-icon-bg: #ffffff;
    --logo-icon-text: #000000;
}
[data-theme="dark"] {
    --bg-color: #121212;
    --text-color: #e0e0e0;
    --card-bg: #1e1e1e;
    --btn-inactive: #2d2d2d;
    --btn-active: #ffffff;
    --btn-active-text: #000000; 
    --border-color: #ffffff;
    --summary-bg: #2d2d2d;
    --summary-text: #f0e7e7;
    --navbar-bg: #15007c;
    --navbar-text: #ffffff; 
    --logo-icon-bg: #ffffff; 
    --logo-icon-text: #15007c; 
}
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}
body {
    background-color: var(--bg-color);
    color: var(--text-color);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}
.navbar {
    background-color: var(--navbar-bg); 
    padding: 15px 0;
    box-shadow: 0 4px 15px rgba(0,0,0,0.15);
    width: 100%;
}
.navbar-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.logo-wrapper {
    display: flex;
    align-items: center;
    gap: 14px;
}
.logo-icon {
    width: 45px;
    height: 45px;
    background-color: var(--logo-icon-bg);
    color: var(--logo-icon-text);
    font-size: 20px;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    letter-spacing: 0.5px;
}
.logo {
    color: var(--navbar-text); 
    font-size: 26px;
    font-weight: 800;
    letter-spacing: 1px;
}
.theme-btn {
    background: var(--btn-inactive);
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}
.theme-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: scale(1.05);
}
.container {
    max-width: 1200px;
    width: 100%;
    margin: 30px auto;
    padding: 0 24px;
}
.toggle-container {
    display: flex;
    width: 100%;
    gap: 15px;
    margin-bottom: 30px;
}
.toggle-btn {
    flex: 1;
    background-color: var(--btn-inactive);
    color: var(--text-color);
    border: none;
    padding: 20px 0; 
    font-size: 24px;
    font-weight: 700;
    cursor: pointer;
    border-radius: 16px;
}
.toggle-btn.active {
    background-color: var(--btn-active); 
    color: var(--btn-active-text);
}
.columns-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 25px;
    margin-bottom: 40px;
    width: 100%;
}
.column h3 {
    margin-bottom: 15px;
    font-size: 22px;
    font-weight: 700;
    border-bottom: 3px solid var(--text-color); 
    padding-bottom: 8px;
    color: var(--text-color);
}
.select-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.option {
    padding: 20px 15px;
    background-color: var(--card-bg);
    color: var(--text-color);
    border: none;
    border-radius: 12px;
    cursor: pointer;
    font-size: 18px;
    font-weight: 600;
    text-align: center;
    box-shadow: 0 2px 6px rgba(0,0,0,0.04);
}
.option:hover {
    filter: brightness(0.9);
    transform: translateY(-1px);
}

.option.active {
    background-color: var(--btn-active);
    color: var(--btn-active-text);
}

.results-section {
    margin-top: 40px;
    padding-top: 25px;
    border-top: 3px dashed #000000;
}
.results-section h2 {
    margin-bottom: 15px;
    font-size: 26px;
    font-weight: 800;
}
.selection-info {
    font-size: 16px;
    font-weight: 600;
    color: var(--summary-text);
    margin-bottom: 30px;
    background: var(--summary-bg);
    padding: 10px 20px;
    border-radius: 10px;
    display: inline-block;
}

.results-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); 
    gap: 20px;
    width: 100%;
}

.result-item {
    background: var(--btn-inactive);
    color: var(--text-color);
    border: 1px solid transparent;
    padding: 15px 18px;
    border-radius: 12px;
    text-align: center;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 60px;
    transition: transform 0.15s ease, background-color 0.15s ease;
    margin-bottom: 10px;
}
.result-item:last-child {
    margin-bottom: 0;
}
 
.result-item:hover {
    transform: translateX(4px);
    background-color: var(--btn-active);
    color: var(--btn-active-text);
    box-shadow: 0 4px 12px rgba(0,0,0,0.12);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
}
.modal-content {
    position: relative;
    background-color: var(--card-bg);
    margin: 2% auto;
    width: 85%;
    max-width: 1100px;
    height: 85%;
    border-radius: 16px;
    overflow: hidden;
}
.close-btn {
    position: absolute;
    top: 10px;
    right: 20px;
    color: var(--text-color);
    font-size: 36px;
    font-weight: bold;
    cursor: pointer;
    z-index: 1001;
}
.close-btn:hover {
    color: #ff0000;
}
#pdf-viewer {
    width: 100%;
    height: 100%;
    border: none;
}
.result-item.disabled-card {
    opacity: 0.4; 
    background-color: var(--btn-inactive) !important;
    color: var(--text-color) !important;
    border: 2px solid var(--btn-inactive) !important;
    cursor: not-allowed !important; 
    transform: none !important; 
    box-shadow: none !important;
}
.site-footer {
    width: 100%;
    padding: 40px 0 50px;
    margin-top: 80px;
    border-top: 3px solid var(--border-color);
    text-align: center;
    background: var(--btn-inactive);
}
[data-theme="dark"] .site-footer {
    background: #1a1a2e;
    border-top-color: #4a4a6a;
}
.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
}
.footer-title {
    font-size: 20px;
    font-weight: 800;
    margin-bottom: 4px;
}
.footer-desc {
    font-size: 14px;
    opacity: 0.7;
    margin-bottom: 12px;
}
.footer-links {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-bottom: 12px;
    font-size: 14px;
    font-weight: 600;
}
.footer-links span {
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.2s ease;
}
.footer-links span:hover {
    opacity: 1;
}
.footer-small {
    font-size: 12px;
    opacity: 0.5;
}
.footer-info {
    font-size: 13px;
    opacity: 0.7;
    margin-bottom: 8px;
    min-height: 18px;
    font-style: italic;
}

/* Floating tooltip */
.tooltip {
    position: fixed;
    background: var(--btn-active);
    color: var(--btn-active-text);
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.15s ease;
    z-index: 9999;
    max-width: 280px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    white-space: normal;
    line-height: 1.3;
}
.tooltip.visible {
    opacity: 1;
}
.hidden-btn {
    display: none !important;
}

/* Hexagon background on home */
.hex-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 50%;
    overflow: visible;
    pointer-events: none;
    z-index: 0;
    opacity: 0.225;
}
[data-theme="dark"] .hex-bg {
    opacity: 0.36;
}
.hex-cell {
    position: absolute;
    width: 60px;
    height: 69px;
    clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
    background: linear-gradient(135deg, #4a90d9 0%, #2c5aa0 100%);
    box-shadow: 0 0 20px rgba(74, 144, 217, 0.4), inset 0 0 10px rgba(255,255,255,0.1);
    transition: transform 0.3s ease;
}
[data-theme="dark"] .hex-cell {
    background: linear-gradient(135deg, #1a3a6e 0%, #0d1f3c 100%);
    box-shadow: 0 0 25px rgba(74, 144, 217, 0.6), 0 0 50px rgba(74, 144, 217, 0.2), inset 0 0 15px rgba(74,144,217,0.3);
}
.hex-cell.neon-purple {
    background: linear-gradient(135deg, #7b5ea7 0%, #4a2d6b 100%);
    box-shadow: 0 0 20px rgba(123, 94, 167, 0.4), inset 0 0 10px rgba(255,255,255,0.1);
}
[data-theme="dark"] .hex-cell.neon-purple {
    background: linear-gradient(135deg, #2a1a4e 0%, #1a0d30 100%);
    box-shadow: 0 0 25px rgba(123, 94, 167, 0.6), 0 0 50px rgba(123, 94, 167, 0.2), inset 0 0 15px rgba(123,94,167,0.3);
}
.hex-cell.neon-cyan {
    background: linear-gradient(135deg, #3aada8 0%, #1e6b68 100%);
    box-shadow: 0 0 20px rgba(58, 173, 168, 0.4), inset 0 0 10px rgba(255,255,255,0.1);
}
[data-theme="dark"] .hex-cell.neon-cyan {
    background: linear-gradient(135deg, #0d3a38 0%, #062020 100%);
    box-shadow: 0 0 25px rgba(58, 173, 168, 0.6), 0 0 50px rgba(58, 173, 168, 0.2), inset 0 0 15px rgba(58,173,168,0.3);
}
.hex-cell.neon-pink {
    background: linear-gradient(135deg, #c75a8a 0%, #8a2d5a 100%);
    box-shadow: 0 0 20px rgba(199, 90, 138, 0.4), inset 0 0 10px rgba(255,255,255,0.1);
}
[data-theme="dark"] .hex-cell.neon-pink {
    background: linear-gradient(135deg, #3a1028 0%, #200818 100%);
    box-shadow: 0 0 25px rgba(199, 90, 138, 0.6), 0 0 50px rgba(199, 90, 138, 0.2), inset 0 0 15px rgba(199,90,138,0.3);
}

/* Home section needs relative positioning for hex-bg */
#section-home {
    position: relative;
    overflow: visible;
}
body {
    overflow-x: hidden;
}
#section-home > *:not(.hex-bg):not(.float-particles) {
    position: relative;
    z-index: 1;
}

/* Floating particles */
.float-particles {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    overflow: visible;
}
.float-particle {
    position: absolute;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(74, 144, 217, 0.4) 0%, transparent 70%);
    animation: floatDrift 20s infinite ease-in-out;
}
[data-theme="dark"] .float-particle {
    background: radial-gradient(circle, rgba(74, 144, 217, 0.3) 0%, transparent 70%);
}
@keyframes floatDrift {
    0%, 100% { transform: translate(0, 0) scale(1); opacity: 0.3; }
    25% { transform: translate(30px, -20px) scale(1.1); opacity: 0.5; }
    50% { transform: translate(-20px, 30px) scale(0.9); opacity: 0.4; }
    75% { transform: translate(15px, 10px) scale(1.05); opacity: 0.6; }
}

/* Home section styles */
.home-hero {
    text-align: center;
    padding: 40px 20px 30px;
    margin-bottom: 20px;
}
.home-title {
    font-size: 48px;
    font-weight: 800;
    margin-bottom: 10px;
    letter-spacing: 1px;
}
.home-subtitle {
    font-size: 18px;
    opacity: 0.7;
    font-weight: 500;
}
.home-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 25px;
    margin-bottom: 40px;
}
.home-card {
    background: var(--card-bg);
    border-radius: 20px;
    padding: 40px 25px;
    text-align: center;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    box-shadow: 0 4px 12px rgba(0,0,0,0.06);
    border: 2px solid transparent;
}
.home-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
}
.home-card-icon {
    font-size: 48px;
    margin-bottom: 15px;
}
.home-card h2 {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 8px;
}
.home-card p {
    font-size: 15px;
    opacity: 0.7;
    font-weight: 400;
}
.home-card-exams {
    border-top: 4px solid #4a90d9;
}
.home-card-olympiads {
    border-top: 4px solid #e6a23c;
}
.home-card-books {
    border-top: 4px solid #67c23a;
}

/* Frequent items on home */
.home-frequent {
    margin-top: 30px;
}
.home-frequent h3 {
    margin-bottom: 15px;
    font-size: 20px;
    font-weight: 700;
    border-bottom: 2px solid var(--text-color);
    padding-bottom: 8px;
}
.home-frequent-list {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 12px;
}
.home-frequent-item {
    background: linear-gradient(135deg, var(--card-bg) 0%, var(--btn-inactive) 100%);
    padding: 14px 20px;
    border-radius: 14px;
    cursor: pointer;
    font-size: 15px;
    font-weight: 600;
    border: none;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    position: relative;
    overflow: hidden;
}
.home-frequent-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: linear-gradient(180deg, #4a90d9, #67c23a);
    border-radius: 14px 0 0 14px;
}
.home-frequent-item:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 16px rgba(0,0,0,0.15);
}
.home-frequent-count {
    font-size: 12px;
    opacity: 0.7;
    font-weight: 500;
    background: var(--btn-inactive);
    padding: 2px 8px;
    border-radius: 10px;
    white-space: nowrap;
}
.home-frequent-empty {
    color: #999;
    font-size: 16px;
    padding: 20px;
    text-align: center;
}
.home-frequent-clear {
    margin-top: 12px;
    background: var(--btn-inactive);
    color: var(--text-color);
    border: none;
    padding: 8px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
}
.home-frequent-clear:hover {
    filter: brightness(0.9);
}

/* Home stats */
.home-stats {
    display: flex;
    justify-content: center;
    gap: 30px;
    margin: 20px 0 30px;
    flex-wrap: wrap;
}
.home-stat {
    text-align: center;
    min-width: 80px;
}
.home-stat-num {
    display: block;
    font-size: 32px;
    font-weight: 800;
    line-height: 1;
}
.home-stat-label {
    display: block;
    font-size: 13px;
    opacity: 0.6;
    margin-top: 4px;
}

/* Home search */
.home-search {
    margin-bottom: 30px;
}
.home-search input {
    width: 100%;
    padding: 14px 20px;
    font-size: 16px;
    border: 2px solid var(--border-color);
    border-radius: 14px;
    background: var(--card-bg);
    color: var(--text-color);
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.home-search input:focus {
    border-color: #4a90d9;
    box-shadow: 0 0 0 3px rgba(74, 144, 217, 0.15);
}
.home-search-results {
    margin-top: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 300px;
    overflow-y: auto;
}
.home-search-item {
    background: var(--card-bg);
    padding: 12px 18px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 15px;
    font-weight: 500;
    border: 1px solid var(--btn-inactive);
    transition: transform 0.15s ease, background-color 0.15s ease;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.home-search-item:hover {
    transform: translateX(4px);
    background-color: var(--btn-active);
    color: var(--btn-active-text);
}
.home-search-empty {
    color: #999;
    font-size: 15px;
    padding: 15px;
    text-align: center;
}

/* Mobile responsiveness */
@media (max-width: 768px) {
    .container {
        margin: 15px auto;
        padding: 0 12px;
    }
    .navbar-content {
        padding: 0 12px;
    }
    .logo {
        font-size: 20px;
    }
    .logo-icon {
        width: 36px;
        height: 36px;
        font-size: 16px;
    }
    .theme-btn {
        width: 36px;
        height: 36px;
        font-size: 16px;
    }
    .toggle-container {
        gap: 8px;
        margin-bottom: 20px;
    }
    .toggle-btn {
        padding: 12px 0;
        font-size: 16px;
        border-radius: 12px;
    }
    .home-title {
        font-size: 32px;
    }
    .home-subtitle {
        font-size: 15px;
    }
    .home-cards {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    .home-card {
        padding: 25px 20px;
    }
    .home-card-icon {
        font-size: 36px;
    }
    .home-card h2 {
        font-size: 20px;
    }
    .home-frequent-item {
        font-size: 14px;
        padding: 10px 14px;
    }
    .home-stats {
        gap: 15px;
    }
    .home-stat-num {
        font-size: 24px;
    }
    .home-stat-label {
        font-size: 11px;
    }
    .books-layout {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    .exams-layout {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    .exam-selectors {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    .columns-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    .option {
        padding: 14px 12px;
        font-size: 16px;
    }
    .result-item {
        padding: 18px 14px;
        font-size: 16px;
        min-height: 70px;
    }
    .results-container {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    .home-search input {
        font-size: 15px;
        padding: 12px 16px;
    }
}

@media (max-width: 480px) {
    .home-title {
        font-size: 28px;
    }
    .toggle-btn {
        padding: 10px 0;
        font-size: 14px;
    }
    .home-card {
        padding: 20px 16px;
    }
}

/* Exams: two selectors side by side */
.exams-layout {
    display: grid;
    grid-template-columns: 420px 1fr;
    gap: 30px;
    margin-bottom: 40px;
    align-items: start;
}
.exam-selectors {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}
.exams-selectors-col {
    min-width: 0;
}
.exam-selector-col h3 {
    margin-bottom: 10px;
    font-size: 18px;
    font-weight: 700;
    border-bottom: 2px solid var(--text-color);
    padding-bottom: 6px;
    color: var(--text-color);
}

/* Books tab: subjects left, panel right */
.books-layout {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 30px;
    margin-bottom: 40px;
    align-items: start;
}
.books-subjects-col h3 {
    margin-bottom: 15px;
    font-size: 22px;
    font-weight: 700;
    border-bottom: 3px solid var(--text-color);
    padding-bottom: 8px;
    color: var(--text-color);
}
.books-panel-col {
    position: relative;
    min-height: 200px;
}
.books-panel {
    background: var(--card-bg);
    border-radius: 16px;
    padding: 25px;
    min-height: 200px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.06);
    border: 2px dashed var(--border-color);
    transition: transform 0.3s ease, opacity 0.3s ease;
    transform-origin: left center;
}
.books-panel.animating {
    animation: booksSlideIn 0.35s ease-out;
}
@keyframes booksSlideIn {
    0% {
        opacity: 0;
        transform: translateX(-30px) scaleX(0.95);
    }
    100% {
        opacity: 1;
        transform: translateX(0) scaleX(1);
    }
}
.books-panel-hint {
    color: #999;
    font-size: 18px;
    text-align: center;
    padding: 40px 20px;
}
.books-panel-title {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 15px;
    border-bottom: 2px solid var(--text-color);
    padding-bottom: 8px;
}
.books-panel-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.books-panel-item {
    background: var(--btn-inactive);
    color: var(--text-color);
    padding: 15px 18px;
    border-radius: 12px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    transition: transform 0.15s ease, background-color 0.15s ease;
    border: 1px solid transparent;
}
.books-panel-item:hover {
    transform: translateX(4px);
    background-color: var(--btn-active);
    color: var(--btn-active-text);
}
.books-subject-locked {
    outline: 2px solid var(--btn-active);
    outline-offset: -2px;
}
