/* Стили для индивидуального раздела */
.individual-content {
    background: linear-gradient(to bottom, #fef9f5 0%, #f5eee6 100%);
    padding: 40px;
    border-radius: 8px;
    border: 1px solid #d7ccc8;
    line-height: 1.8;
    text-align: justify;
    box-shadow: 0 4px 20px rgba(93, 64, 55, 0.1);
    position: relative;
    font-family: 'Georgia', 'Times New Roman', serif;
}

.individual-content::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 5px;
   
}

.individual-content p {
    margin-bottom: 25px;
    text-indent: 1.5em;
    font-size: 1.1em;
    color: var(--text-medium);
    text-align: justify;
    line-height: 1.8;
}

.individual-content h2 {
    color: var(--primary-color);
    font-size: 1.8em;
    margin: 40px 0 25px 0;
    padding-bottom: 12px;
    text-align: center;
    position: relative;
    font-family: 'Palatino', 'Palatino Linotype', serif;
}

.individual-content h2::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 120px;
    height: 3px;
    background: linear-gradient(to right, transparent, var(--secondary-color), transparent);
}

.individual-content h3 {
    color: var(--accent-color);
    font-size: 1.4em;
    margin: 35px 0 20px 0;
    text-align: center;
    font-style: italic;
    font-weight: normal;
    letter-spacing: 0.5px;
}
.main-content h2 {
    color: #5d4037;
    font-size: 24px;
    margin: 30px 0 20px 0;
    text-align: center;
    font-weight: bold;
}

@media (max-width: 768px) {
    .main-content h2 {
        font-size: 20px;
        margin: 25px 0 15px 0;
    }
    
    .similar-materials {
        padding: 20px;
        margin: 30px 0;
    }
    
    .similar-title {
        font-size: 16px;
    }
}

/* Простые стили для раздела "Похожие материалы" */
.similar-materials {
    margin: 40px 0;
    padding: 25px;
    background-color: #f9f7f4;
    border-radius: 6px;
    border: 1px solid #e0d6d0;
}

.similar-item {
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #e0d6d0;
}

.similar-item:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.similar-title {
    font-size: 18px;
    font-weight: bold;
    margin-bottom: 8px;
    color: #5d4037;
}

.similar-title a {
    color: #5d4037;
    text-decoration: none;
}

.similar-title a:hover {
    color: #8d6e63;
    text-decoration: underline;
}

.similar-description {
    font-size: 14px;
    color: #666;
    line-height: 1.5;
}

.similar-description a {
    color: #8d6e63;
    text-decoration: none;
}

.similar-description a:hover {
    text-decoration: underline;
}

/* Стили для кликабельных названий книг */
.clickable-book {
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    display: inline-block;
    padding: 5px 10px;
    border-radius: 4px;
}

.clickable-book:hover {
    color: var(--primary-color);
    transform: translateY(-2px);
    background: rgba(141, 110, 99, 0.08);
}

.clickable-book::after {
    content: " 📖";
    font-size: 0.8em;
    opacity: 0.7;
    transition: opacity 0.3s ease;
}

.clickable-book:hover::after {
    opacity: 1;
}

/* Стили для модальных окон */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    backdrop-filter: blur(3px);
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background: linear-gradient(to bottom, #fef9f5 0%, #f5eee6 100%);
    border-radius: 12px;
    width: 90%;
    max-width: 900px;
    max-height: 90vh;
    overflow-y: auto;
    padding: 20px;
    position: relative;
    border: 2px solid #d7ccc8;
    box-shadow: 0 10px 40px rgba(93, 64, 55, 0.3);
    transform: translateY(-50px);
    transition: transform 0.4s ease;
}

.modal-overlay.active .modal-content {
    transform: translateY(0);
}

.modal-close {
    position: absolute;
    top: 15px;
    right: 20px;
    background: none;
    border: none;
    font-size: 28px;
    color: var(--primary-color);
    cursor: pointer;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s ease;
    z-index: 1001;
}

.modal-close:hover {
    background-color: rgba(141, 110, 99, 0.1);
    transform: rotate(90deg);
}

.modal-header {
    text-align: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid rgba(141, 110, 99, 0.2);
}

.modal-title {
    color: var(--primary-color);
    font-size: 2em;
    margin-bottom: 10px;
    font-family: 'Palatino', 'Palatino Linotype', serif;
}

.modal-subtitle {
    color: var(--accent-color);
    font-style: italic;
    font-size: 1.3em;
}



/* Стили для интерактивной книги в модальном окне */
.modal-interactive-book {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    perspective: 1500px;
}

.modal-book {
    perspective: 1500px;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.modal-pages {
    width: 600px;
    height: 400px;
    position: relative;
    transform-style: preserve-3d;
    backface-visibility: hidden;
    border-radius: 4px;
    
}

.modal-page {
    position: absolute;
    top: 0;
    width: 300px;
    height: 400px;
    transform-origin: 0 0;
    transition: transform 1.2s cubic-bezier(0.645, 0.045, 0.355, 1);
    backface-visibility: hidden;
    transform-style: preserve-3d;
    cursor: pointer;
    user-select: none;
    background-color: #fff;
    overflow: hidden;
    border: none;
    background-size: cover;
    background-position: center;
    display: flex;
    justify-content: center;
    align-items: center;
}

.modal-page-content {
    padding: 30px;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    box-sizing: border-box;
    text-align: center;
    position: relative;
    z-index: 2;
}

.modal-page-content h3 {
    color: var(--primary-color);
    font-size: 1.8em;
    margin-bottom: 20px;
    font-family: 'Palatino', 'Palatino Linotype', serif;
}

.modal-page-content p {
    color: var(--text-medium);
    font-size: 1.1em;
    line-height: 1.6;
    margin-bottom: 15px;
    font-family: 'Georgia', serif;
}

.modal-page-content .quote {
    font-style: italic;
    color: var(--accent-color);
    margin: 20px 0;
    padding: 15px;
    border-left: 3px solid var(--accent-color);
    background: rgba(141, 110, 99, 0.05);
    border-radius: 4px;
}

/* Нечетные страницы (правые) */
.modal-page:nth-child(odd) {
    pointer-events: all;
    transform: rotateY(0deg);
    right: 0;
    border-radius: 0 4px 4px 0;
    background-image: linear-gradient(to right, rgba(0, 0, 0, .08) 0%, rgba(0, 0, 0, 0) 8%);
    box-shadow: inset 1px 0 0 rgba(255, 255, 255, 0.5);
}

.modal-page:nth-child(odd):hover {
    transform: rotateY(-10deg);
}

/* Четные страницы (левые) */
.modal-page:nth-child(even) {
    pointer-events: none;
    transform: rotateY(180deg);
    transform-origin: 100% 0;
    left: 0;
    border-radius: 4px 0 0 4px;
    background-image: linear-gradient(to left, rgba(0, 0, 0, .1) 0%, rgba(0, 0, 0, 0) 8%);
    box-shadow: inset -1px 0 0 rgba(255, 255, 255, 0.5);
}

/* Перевернутые страницы */
.modal-page.flipped:nth-child(odd) {
    pointer-events: none;
    transform: rotateY(-180deg);
}

.modal-page.flipped:nth-child(even) {
    pointer-events: all;
    transform: rotateY(0deg);
}

.modal-page.flipped:nth-child(even):hover {
    transform: rotateY(10deg);
}

/* Декоративные элементы для страниц */
.modal-page::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, transparent 95%, rgba(0,0,0,0.03) 100%);
    pointer-events: none;
}

/* Информация о книге в модальном окне */
.modal-book-info {
    margin-top: 25px;
    padding: 20px;
    background: rgba(245, 238, 230, 0.6);
    border-radius: 8px;
    border: 1px solid #d7ccc8;
}

.modal-book-info h4 {
    color: var(--primary-color);
    font-size: 1.4em;
    margin-bottom: 15px;
    text-align: center;
    font-family: 'Palatino', serif;
}

.modal-book-features {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin: 15px 0;
}

.modal-book-feature {
    background: white;
    padding: 12px;
    border-radius: 6px;
    border: 1px solid #e0d6d0;
    text-align: center;
}

.modal-book-feature h5 {
    color: var(--accent-color);
    margin-bottom: 8px;
    font-size: 1em;
}

.modal-book-feature p {
    font-size: 0.95em;
    color: var(--text-medium);
    margin: 0;
}

.modal-book-footer {
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid rgba(141, 110, 99, 0.2);
    text-align: center;
    font-style: italic;
    color: var(--secondary-color);
    font-size: 0.9em;
}

/* Адаптивность для модальных окон */
@media (max-width: 768px) {
    .individual-content {
        padding: 25px 20px;
    }
    
    .book-section {
        padding: 20px;
        margin: 25px 0;
    }
    
    .book-illustration {
        padding: 12px;
        margin: 20px auto;
    }
    
    .highlight {
        padding: 20px 15px;
        font-size: 1.1em;
    }
    
    .modal-content {
        padding: 15px;
        width: 95%;
        max-height: 95vh;
    }
    
    .modal-title {
        font-size: 1.6em;
    }
    
    .modal-book-container {
        height: 300px;
        padding: 15px;
    }
    
    .modal-pages {
        width: 450px;
        height: 300px;
    }
    
    .modal-page {
        width: 225px;
        height: 300px;
    }
    
    .modal-page-content {
        padding: 15px;
    }
    
    .modal-page-content h3 {
        font-size: 1.4em;
    }
    
    .modal-page-content p {
        font-size: 1em;
    }
    
    .modal-book-features {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .individual-content {
        padding: 20px 15px;
    }
    
    .individual-content p {
        font-size: 1em;
    }
    
    .book-section {
        padding: 15px;
    }
    
    .book-title {
        font-size: 1.4em;
    }
    
    .highlight {
        padding: 15px 12px;
        font-size: 1em;
    }
    
    .modal-content {
        padding: 10px;
    }
    
    .modal-title {
        font-size: 1.3em;
    }
    
    .modal-book-container {
        height: 250px;
        padding: 10px;
    }
    
    .modal-pages {
        width: 350px;
        height: 250px;
    }
    
    .modal-page {
        width: 175px;
        height: 250px;
    }
    
    .modal-page-content {
        padding: 10px;
    }
    
    .modal-page-content h3 {
        font-size: 1.2em;
        margin-bottom: 10px;
    }
    
    .modal-page-content p {
        font-size: 0.9em;
    }
}

/* Блоки с книгами */
.book-title {
    color: #5d4037;
    font-size: 1.6em;
    font-weight: bold;
    margin-bottom: 10px;
    text-align: center; /* Уже есть, но оставляем */
    font-family: 'Palatino', 'Palatino Linotype', serif;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.1);
    position: relative;
    z-index: 1;
    width: 100%; /* Добавляем */
    display: block; /* Добавляем */
}


/* Убираем иконку книги из кликабельных заголовков */
.clickable-book::after {
    content: ""; /* Убираем эмодзи книги */
    font-size: 0.8em;
    opacity: 0.7;
    transition: opacity 0.3s ease;
}

/* Или полностью удалите этот блок, если не нужен эффект при наведении */
.clickable-book:hover::after {
    opacity: 1;
}

.book-author {
    color: var(--accent-color);
    font-size: 1.2em;
    font-style: italic;
    text-align: center;
    margin-bottom: 25px;
    position: relative;
    z-index: 1;
}

.book-description {
    color: var(--text-medium);
    line-height: 1.7;
    text-align: justify;
    font-size: 1.05em;
    position: relative;
    z-index: 1;
}

/* Стили для иллюстраций книг */
.book-illustration {
    background: rgba(245, 238, 230, 0.8);
    border: 1px solid #d7ccc8;
    border-radius: 6px;
    padding: 15px;
    margin: 25px auto;
    text-align: center;
    max-width: 600px;
    box-shadow: 0 3px 10px rgba(93, 64, 55, 0.1);
    position: relative;
}

.book-illustration::before {
    content: "";
    position: absolute;
    top: -5px;
    left: -5px;
    right: -5px;
    bottom: -5px;
    border: 1px dashed #bcaaa4;
    border-radius: 8px;
    pointer-events: none;
}

.book-image {
    max-width: 100%;
    height: auto;
    border-radius: 4px;
    border: 1px solid #bcaaa4;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    
}



.image-caption {
    color: var(--secondary-color);
    font-style: italic;
    margin-top: 10px;
    font-size: 0.95em;
    padding-top: 8px;
    border-top: 1px dashed #d7ccc8;
}

/* Цитаты и выделения */
.highlight {
    background: linear-gradient(135deg, rgba(141, 110, 99, 0.08), rgba(121, 85, 72, 0.08));
    padding: 25px;
    border-radius: 6px;
    margin: 30px 0;
    border-left: 4px solid var(--accent-color);
    border-right: 1px solid rgba(121, 85, 72, 0.2);
    font-style: italic;
    text-align: center;
    font-size: 1.15em;
    color: #5d4037;
    position: relative;
    box-shadow: 0 2px 10px rgba(93, 64, 55, 0.05);
}

.highlight::before {
    content: "❝";
    position: absolute;
    top: 10px;
    left: 15px;
    font-size: 2em;
    color: var(--accent-color);
    opacity: 0.3;
}

.highlight::after {
    content: "❞";
    position: absolute;
    bottom: 10px;
    right: 15px;
    font-size: 2em;
    color: var(--accent-color);
    opacity: 0.3;
}



/* Декоративные элементы */
.book-section:nth-child(odd) {
    border-left: 5px solid var(--primary-color);
}

.book-section:nth-child(even) {
    border-right: 5px solid var(--accent-color);
}

/* Адаптация для мобильных */
@media (max-width: 768px) {
    .individual-content {
        padding: 25px 20px;
    }
    
    .book-section {
        padding: 20px;
        margin: 25px 0;
    }
    
    .book-illustration {
        padding: 12px;
        margin: 20px auto;
    }
    
    .highlight {
        padding: 20px 15px;
        font-size: 1.1em;
    }
}

@media (max-width: 480px) {
    .individual-content {
        padding: 20px 15px;
    }
    
    .individual-content p {
        font-size: 1em;
    }
    
    .book-section {
        padding: 15px;
    }
    
    .book-title {
        font-size: 1.4em;
    }
    
    .highlight {
        padding: 15px 12px;
        font-size: 1em;
    }
}

/* Добавьте в конец ind.css */
/* Гарантируем, что обложка всегда видна первой */
.modal-pages .modal-page:first-child {
    z-index: 1000 !important;
}

/* Сбрасываем все трансформации при закрытии */
.modal-overlay:not(.active) .modal-page {
    transform: none !important;
    transition: none !important;
}

/* Принудительный сброс для нечетных страниц когда не активны */
.modal-overlay:not(.active) .modal-page:nth-child(odd) {
    transform: rotateY(0deg) !important;
    pointer-events: none;
}

/* Принудительный сброс для четных страниц когда не активны */
.modal-overlay:not(.active) .modal-page:nth-child(even) {
    transform: rotateY(180deg) !important;
    pointer-events: none;
}

/* Убираем все классы flipped когда модальное окно не активно */
.modal-overlay:not(.active) .modal-page.flipped {
    transform: none !important;
}

/* Анимация появления для правильной инициализации */
.modal-overlay.active .modal-page {
    transition: transform 1.2s cubic-bezier(0.645, 0.045, 0.355, 1), 
                z-index 0.3s ease !important;
}
