/* style-bio.css — палитра профиля (фон: #d1fae5, акцент: #10b981, текст: #065f46) */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
    display: flex;
    flex-direction: column;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: white;
    color: #1a1a1a;
    line-height: 1.6;
    overflow-y: hidden;
}

/* ===== HEADER ===== */
.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 24px;
    background: white;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-left h1 {
    font-size: 1rem;
    font-weight: 600;
    color: #065f46;
    cursor: pointer;
    line-height: 1.2;
}
.header-left a {
    text-decoration: none;
    color: inherit;
}
.header-left a:hover h1 {
    text-decoration: underline;
}

.mobile-menu-btn {
    display: none;
    flex-direction: column;
    justify-content: space-between;
    width: 22px;
    height: 16px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
}

.mobile-menu-btn span {
    width: 100%;
    height: 2px;
    background-color: #1a1a1a;
    border-radius: 2px;
    transition: 0.2s;
}

/* Переключатель Теория/Практика */
.header-center .mode-toggle {
    display: flex;
    gap: 6px;
    background: white;
    padding: 3px;
    border-radius: 6px;
    border: 1px solid #d1fae5;
}

.mode-btn {
    padding: 5px 16px;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: #1a1a1a;
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    transition: 0.2s;
}

.mode-btn.active {
    background: #10b981;
    color: white;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.header-right .account-link {
    text-decoration: none;
    color: #10b981;
    font-weight: 500;
    font-size: 0.85rem;
    padding: 4px 0;
    background: transparent;
    border-radius: 0;
    display: inline-block;
    transition: color 0.2s;
    border-bottom: 1px solid transparent;
    margin-left: 8px;
}

.header-right .account-link:hover {
    color: #065f46;
    border-bottom-color: #10b981;
}

/* ===== ДВУХРЯДНАЯ ШАПКА ДЛЯ МОБИЛЬНЫХ ===== */
.header-main-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
}

.header-auth-row {
    display: none;
    width: 100%;
    border-top: 1px solid #d1fae5;
    margin-top: 4px;
    padding-top: 4px;
    justify-content: center;
}

.auth-container {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
    justify-content: center;
}

@media (min-width: 769px) {
    .header-auth-row {
        display: none;
    }
    #auth-container-desktop {
        display: inline-flex;
        margin-left: 12px;
    }
}

/* ===== АВТОРИЗАЦИЯ ===== */
.auth-btn {
    background: transparent;
    border: 1px solid #10b981;
    color: #10b981;
    padding: 4px 14px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 500;
    transition: all 0.2s ease;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}
.auth-btn:hover {
    background: #10b981;
    color: white;
}

.user-link {
    text-decoration: none;
    color: #1a1a1a;
    font-weight: 600;
    font-size: 0.95rem;
    padding: 4px 10px;
    border-radius: 6px;
    transition: background 0.2s ease;
    display: inline-block;
}
.user-link:hover {
    background: #d1fae5;
}
.user-name {
    cursor: pointer;
}

.logout-btn {
    background: #e74c3c;
    color: white;
    border: none;
    padding: 6px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.85rem;
    transition: background 0.2s, transform 0.1s;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}
.logout-btn:hover {
    background: #c0392b;
    transform: scale(1.02);
}

/* ===== MAIN LAYOUT ===== */
.container {
    display: flex;
    flex: 1;
    min-height: 0;
    position: relative;
}

.mobile-overlay {
    display: none;
    position: fixed;
    top: 70px;
    left: 0;
    width: 100%;
    height: calc(100vh - 70px);
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 998;
}

.mobile-overlay.active {
    display: block;
}

/* ===== SIDEBAR ===== */
.sidebar {
    width: 300px;
    background-color: white;
    border-right: 1px solid #d1fae5;
    height: 100%;
    overflow-y: auto;
    position: sticky;
    top: 0;
    padding: 0 0 20px 0;
    z-index: 999;
    transition: transform 0.3s ease;
}

/* ===== ПЕРЕКЛЮЧАТЕЛЬ ЕГЭ/ОГЭ ===== */
.exam-toggle {
    display: flex;
    gap: 4px;
    padding: 16px 16px 12px 16px;
    background: white;
    border-bottom: 1px solid #d1fae5;
    position: sticky;
    top: 0;
    z-index: 10;
    margin-bottom: 8px;
}

.exam-btn {
    flex: 1;
    padding: 8px 0;
    border: none;
    border-radius: 6px;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: background 0.2s, color 0.2s, box-shadow 0.2s;
    text-align: center;
    background: transparent;
    color: #1a1a1a;
}

.exam-btn:hover {
    background: #d1fae5;
    color: #1a1a1a;
}

.exam-btn.active {
    background: #10b981;
    color: white;
    box-shadow: 0 2px 6px rgba(16, 185, 129, 0.2);
}

.exam-btn.active:hover {
    background: #065f46;
    color: white;
}

.topic-list {
    display: none;
}
.topic-list.active {
    display: block;
}

.toc-nav {
    padding: 0 15px;
}
.toc-list {
    list-style: none;
}

.toc-item {
    margin-bottom: 0;
    border-bottom: 1px solid #d1fae5;
}
.toc-item:last-child {
    border-bottom: none;
}

.toc-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    cursor: pointer;
    font-weight: 600;
    font-size: 1rem;
    color: #1a1a1a;
    background-color: transparent;
    border: none;
    border-radius: 6px;
    transition: all 0.2s ease;
    user-select: none;
    width: 100%;
}

.toc-title:hover {
    color: #10b981;
    background-color: transparent;
    transform: translateX(4px);
}

.toggle-icon {
    font-size: 0.8rem;
    color: #10b981;
    transition: transform 0.3s ease;
}

.toc-sublist {
    list-style: none;
    margin-top: 0;
    padding-left: 0;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}
.toc-sublist.expanded {
    max-height: 2000px;
}

.toc-subitem {
    margin: 0;
}
.toc-subitem a {
    display: block;
    padding: 9px 16px 9px 25px;
    text-decoration: none;
    color: #1a1a1a;
    border-radius: 6px;
    font-size: 0.95rem;
    transition: all 0.2s ease;
    border-left: 3px solid transparent;
}

/* ===== НАВЕДЕНИЕ (как в химии - светло-серый фон #f8fafc) ===== */
.toc-subitem a:hover {
    background-color: #f8fafc;
    border-left-color: #10b981;
    color: #10b981;
    transform: translateX(3px);
}

/* ===== АКТИВНОЕ СОСТОЯНИЕ ===== */
.toc-subitem a.active {
    background-color: #d1fae5;
    border-left: 4px solid #10b981;
    color: #065f46;
    font-weight: 600;
    transform: translateX(2px);
}

/* ===== MAIN CONTENT ===== */
.main-content {
    flex: 1;
    padding: 25px;
    background-color: white;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.content-wrapper {
    max-width: 1100px;
    margin: 0 auto;
    width: 100%;
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
}

#topic-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

/* ===== НОВЫЕ СТИЛИ ЗАГОЛОВКОВ ===== */
#topic-content h1 {
    color: #065f46;
    margin-bottom: 20px;
    font-size: 2rem;
    border-bottom: 2px solid #d1fae5;
    padding-bottom: 10px;
    font-weight: 600;
}

#topic-content h2 {
    color: #1a1a1a;
    margin-top: 30px; /* ДОБАВЛЕН ВЕРХНИЙ ОТСТУП */
    margin-bottom: 20px;
    font-size: 1.6rem;
    /* border-bottom УБРАН */
    padding-bottom: 10px;
    font-weight: 600;
}

#topic-content p {
    margin-bottom: 15px;
    font-size: 1.05rem;
    line-height: 1.6;
    color: #1a1a1a;
}

/* ===== SOLUBILITY TABLE MODAL ===== */
.solubility-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.7);
    z-index: 10000;
    overflow: auto;
}

.solubility-modal-content {
    position: relative;
    background-color: #fff;
    margin: 20px auto;
    padding: 0;
    width: 95%;
    height: 95%;
    border-radius: 6px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
    display: flex;
    flex-direction: column;
}

.solubility-modal-header {
    padding: 15px 20px;
    background: #065f46;
    color: white;
    border-top-left-radius: 6px;
    border-top-right-radius: 6px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.solubility-modal-title {
    font-size: 1.3rem;
    font-weight: 600;
}

.solubility-modal-close {
    cursor: pointer;
    font-size: 28px;
    font-weight: bold;
    color: white;
    background: none;
    border: none;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.solubility-modal-body {
    flex: 1;
    overflow: hidden;
    padding: 0;
}

#solubility-iframe {
    width: 100%;
    height: 100%;
    border: none;
    border-radius: 0 0 6px 6px;
}

.solubility-btn-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1000;
}

.solubility-table-btn {
    background-color: #ffffff;
    color: #1a1a1a;
    border: none;
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    font-size: 0.75rem;
    transition: all 0.2s ease;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12);
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 28px;
}

.solubility-table-btn:hover {
    background-color: #d1fae5;
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.solubility-btn-container.hidden {
    display: none;
}

/* ===== TEST IFRAME ===== */
.test-iframe-container {
    width: 100%;
    flex: 1;
    min-height: 0;
    border: none;
    margin: 0;
    padding: 0;
    overflow: hidden;
    border-radius: 6px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
    display: flex;
}

.test-iframe {
    width: 100%;
    height: 100%;
    border: none;
    border-radius: 6px;
    flex: 1;
}

/* ===== СТИЛИ ДЛЯ КОНТЕНТА УРОКОВ ===== */
.lesson-content {
    font-family: Arial, sans-serif;
    line-height: 1.6;
    color: #1a1a1a;
    padding: 20px;
}

.chemical-formula {
    background-color: #d1fae5;
    padding: 12px;
    border-left: 4px solid #10b981;
    margin: 15px 0;
    font-family: 'Courier New', monospace;
    color: #065f46;
    font-weight: bold;
    border-radius: 6px;
}

.task-block {
    background-color: #d1fae5;
    border-left: 4px solid #10b981;
    padding: 15px;
    margin: 20px 0;
    border-radius: 0 6px 6px 0;
}

.task-title {
    font-weight: bold;
    color: #065f46;
    margin-bottom: 10px;
}

.important-note {
    background-color: #d1fae5;
    border-left: 4px solid #10b981;
    padding: 12px;
    margin: 20px 0;
    border-radius: 6px;
}

.gas-box {
    border: 1px solid #10b981;
    border-radius: 6px;
    padding: 15px;
    margin: 20px 0;
    background-color: #d1fae5;
}

.gas-box h3 {
    margin-top: 0;
    color: #065f46;
}

.image-container {
    text-align: center;
    margin: 20px 0;
}

.image-container img {
    max-width: 100%;
    height: auto;
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.image-caption {
    font-style: italic;
    color: #1a1a1a;
    margin-top: 10px;
    font-size: 0.9rem;
}

.loading {
    text-align: center;
    padding: 50px;
    font-size: 1.2rem;
    color: #10b981;
}

.under-development {
    text-align: center;
    padding: 40px;
    background-color: #d1fae5;
    border-radius: 6px;
    margin: 20px 0;
    border: 1px solid #10b981;
}

.under-development h2 {
    color: #065f46;
    margin-bottom: 15px;
}

.under-development p {
    color: #1a1a1a;
    margin-bottom: 15px;
}

.under-development ul {
    text-align: left;
    max-width: 500px;
    margin: 20px auto;
    padding-left: 20px;
}

.under-development li {
    margin-bottom: 8px;
}

.under-development a {
    color: #10b981;
    text-decoration: none;
}

.under-development a:hover {
    text-decoration: underline;
}

/* ===== SUBJECT SELECTION MODAL ===== */
.subject-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.7);
    z-index: 10001;
    overflow: auto;
}

.subject-modal-content {
    position: relative;
    background-color: #fff;
    margin: 15% auto;
    padding: 0;
    width: 90%;
    max-width: 400px;
    border-radius: 6px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
    animation: modalFadeIn 0.3s;
}

@keyframes modalFadeIn {
    from { opacity: 0; transform: translateY(-30px); }
    to { opacity: 1; transform: translateY(0); }
}

.subject-modal-header {
    padding: 15px 20px;
    background: #065f46;
    color: white;
    border-top-left-radius: 6px;
    border-top-right-radius: 6px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.subject-modal-title {
    font-size: 1.3rem;
    font-weight: 600;
}

.subject-modal-close {
    cursor: pointer;
    font-size: 28px;
    font-weight: bold;
    color: white;
    background: none;
    border: none;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.subject-modal-body {
    padding: 20px;
}

.subject-list {
    list-style: none;
    padding: 0;
    margin: 0 0 15px 0;
}

.subject-list li {
    margin: 8px 0;
}

.subject-btn {
    width: 100%;
    padding: 12px;
    background-color: #d1fae5;
    border: 1px solid #10b981;
    border-radius: 6px;
    font-size: 1.1rem;
    color: #1a1a1a;
    cursor: pointer;
    transition: all 0.2s;
    text-align: left;
}

.subject-btn:hover {
    background-color: #d1fae5;
    border-color: #10b981;
}

.subject-btn.active {
    background-color: #10b981;
    border-color: #065f46;
    color: white;
    font-weight: 600;
}

.subject-note {
    font-style: italic;
    color: #1a1a1a;
    text-align: center;
    margin-top: 15px;
    font-size: 0.9rem;
}

/* ===== БАННЕР ПРИЛОЖЕНИЯ ===== */
.app-banner {
    background: linear-gradient(135deg, #065f46 0%, #10b981 100%);
    color: white;
    padding: 10px 20px;
    text-align: center;
    font-family: Arial, sans-serif;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
    width: 100%;
    box-sizing: border-box;
}

.app-banner-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    flex-wrap: wrap;
    max-width: 900px;
    margin: 0 auto;
}

.app-banner-text {
    font-size: 1rem;
    font-weight: 500;
}

.app-banner-link {
    background-color: white;
    color: #065f46;
    padding: 5px 15px;
    border-radius: 20px;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
    transition: background-color 0.2s;
}

.app-banner-link:hover {
    background-color: #d1fae5;
}

.app-banner-close {
    background: transparent;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    line-height: 1;
    padding: 0 5px;
    opacity: 0.8;
}

.app-banner-close:hover {
    opacity: 1;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 1024px) {
    .sidebar {
        width: 280px;
    }
    .main-content {
        padding: 20px;
    }
}

@media (max-width: 768px) {
    body {
        overflow-y: auto;
    }

    .header {
        flex-direction: column;
        align-items: stretch;
        padding: 6px 12px;
        position: sticky;
        z-index: 100;
    }

    .header-main-row {
        width: 100%;
    }

    .header-auth-row {
        display: flex;
        margin-top: 4px;
        padding-top: 4px;
        border-top: 1px solid #d1fae5;
    }

    #auth-container-desktop {
        display: none;
    }

    .mobile-menu-btn {
        display: flex;
    }

    .header-left h1 {
        font-size: 0.95rem;
    }

    .header-right .account-link {
        font-size: 0.8rem;
    }

    .container {
        flex: 1;
        min-height: 0;
        position: relative;
        overflow: hidden;
    }

    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        width: 300px;
        height: 100vh;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        border-right: 1px solid #d1fae5;
        box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
        padding-top: 0;
        z-index: 1001;
        background-color: white;
        overflow-y: auto;
    }

    .sidebar.active {
        transform: translateX(0);
    }

    .mobile-overlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100vh;
        background-color: rgba(0, 0, 0, 0.5);
        z-index: 1000;
        display: none;
    }

    .mobile-overlay.active {
        display: block;
    }

    .exam-toggle {
        padding: 15px 12px 10px 12px;
    }
    
    .exam-btn {
        padding: 6px 0;
        font-size: 0.85rem;
    }

    .main-content {
        padding: 15px;
        width: 100%;
        transition: filter 0.3s ease;
        overflow-y: auto;
    }

    .main-content.blurred {
        filter: blur(3px);
        pointer-events: none;
        user-select: none;
    }

    .toc-nav {
        max-height: calc(100vh - 60px);
    }

    .solubility-btn-container {
        bottom: 15px;
        right: 15px;
    }

    .solubility-table-btn {
        padding: 4px 8px;
        font-size: 0.65rem;
        min-height: 24px;
    }

    .test-iframe-container {
        height: auto;
    }

    .subject-modal-content {
        width: 95%;
        margin: 50px auto;
    }

    .auth-btn {
        font-size: 0.75rem;
        padding: 3px 10px;
    }
    .user-link {
        font-size: 0.85rem;
        padding: 3px 8px;
    }
    .logout-btn {
        font-size: 0.75rem;
        padding: 4px 12px;
        background: #e74c3c;
        color: white;
        border: none;
        border-radius: 6px;
        font-weight: 600;
    }
    .logout-btn:hover {
        background: #c0392b;
    }
}

@media (max-width: 480px) {
    .header {
        padding: 4px 8px;
    }

    .header-left h1 {
        font-size: 0.85rem;
    }

    .mode-btn {
        padding: 3px 10px;
        font-size: 0.7rem;
    }

    .header-right .account-link {
        font-size: 0.65rem;
        padding: 2px 0;
        white-space: nowrap;
    }

    .sidebar {
        width: 85%;
    }

    .exam-toggle {
        padding: 12px 10px 8px 10px;
    }
    
    .exam-btn {
        padding: 5px 0;
        font-size: 0.8rem;
    }
    
    .toc-title {
        padding: 8px 12px;
        font-size: 0.95rem;
    }
    
    .toc-subitem a {
        padding: 8px 12px 8px 20px;
        font-size: 0.9rem;
    }

    .app-banner-content {
        gap: 10px;
    }
    .app-banner-text {
        width: 100%;
    }

    .auth-btn {
        font-size: 0.65rem;
        padding: 2px 8px;
    }
    .user-link {
        font-size: 0.75rem;
        padding: 2px 6px;
    }
    .logout-btn {
        font-size: 0.65rem;
        padding: 3px 10px;
        background: #e74c3c;
        color: white;
        border: none;
        border-radius: 6px;
        font-weight: 600;
    }
    .logout-btn:hover {
        background: #c0392b;
    }
}

/* Кнопка скачивания для шпаргалок */
.download-btn {
    display: inline-block;
    padding: 10px 20px;
    background-color: #10b981;
    color: white;
    text-decoration: none;
    border-radius: 6px;
    font-weight: 600;
    transition: background-color 0.2s;
    margin-top: 5px;
    margin-bottom: 20px;
    border: none;
    cursor: pointer;
}

.download-btn:hover {
    background-color: #065f46;
}

/* ===== СТИЛИЗАЦИЯ СКРОЛЛБАРОВ ===== */
.sidebar::-webkit-scrollbar {
    width: 6px;
}
.sidebar::-webkit-scrollbar-track {
    background: #d1fae5;
}
.sidebar::-webkit-scrollbar-thumb {
    background: #10b981;
    border-radius: 4px;
}
.sidebar::-webkit-scrollbar-thumb:hover {
    background: #065f46;
}

.main-content::-webkit-scrollbar {
    width: 8px;
}
.main-content::-webkit-scrollbar-track {
    background: #d1fae5;
}
.main-content::-webkit-scrollbar-thumb {
    background: #10b981;
    border-radius: 4px;
}
.main-content::-webkit-scrollbar-thumb:hover {
    background: #065f46;
}

.sidebar, .main-content {
    scrollbar-width: thin;
    scrollbar-color: #10b981 #d1fae5;
}

/* ===== ДОПОЛНЕНИЕ: ТАБЛИЦЫ И ОПРЕДЕЛЕНИЯ ===== */
.content-table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
    background-color: white;
    border-radius: 6px;
    overflow: hidden;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}
.content-table thead {
    background-color: #065f46;
    color: white;
}
.content-table th,
.content-table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid #d1fae5;
}
.content-table tbody tr:last-child td {
    border-bottom: none;
}
.content-table td:first-child {
    font-weight: 500;
}

.definition {
    background: #d1fae5;
    border-left: 4px solid #10b981;
    padding: 12px 18px;
    margin: 20px 0;
    border-radius: 0 6px 6px 0;
}
.definition strong {
    color: #065f46;
}