/* Основные стили для Ramadan Guide */

@font-face {
    font-family: 'Unbounded';
    src: url('../fonts/Unbounded-VariableFont_wght.ttf') format('truetype');
    font-weight: 100 900;
    font-display: swap;
}

:root {
    --bg-color: #FFF1D9;
    --line-color: rgba(224, 132, 51, 0.07);
    --line-width: 1px;
    --ramadan-green: #E08433;
    --ramadan-green-hover: #F09443;
    --text-color: rgba(29, 43, 9, 0.95);
    --text-color-faded: rgba(29, 43, 9, 0.4);
}

body,
html {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    background-color: var(--bg-color);
    overflow: hidden;
    font-family: 'Unbounded', 'Playfair Display', serif;
}

.islamic-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    background-color: var(--bg-color);
}

.container {
    position: relative;
    width: 100%;
    height: 100%;
    z-index: 10;
    opacity: 0;
    animation: fadeIn 1.2s ease-out forwards;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.search-container {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 350px;
    z-index: 20;
    opacity: 0;
    animation: fadeInUp 1s ease-out 0.5s forwards;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translate(-50%, -40%);
    }

    to {
        opacity: 1;
        transform: translate(-50%, -50%);
    }
}

.search-box {
    width: 100%;
    background: transparent;
    border: none;
    outline: none;
    font-size: 20px;
    color: var(--text-color);
    text-align: center;
    text-transform: lowercase;
    letter-spacing: 2px;
    padding: 8px 0;
    caret-color: var(--ramadan-green);
    caret-width: 3px;
}

.search-box::placeholder {
    color: var(--text-color-faded);
}

.title-section {
    position: absolute;
    top: calc(50% - 150px);
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 25px;
    opacity: 0;
    animation: fadeIn 0.8s ease-out 0.3s forwards;
}

.play-button {
    width: 60px;
    height: 40px;
    border: none;
    background: transparent;
    cursor: pointer;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    border: none;
    outline: none;
}

.play-button .bar {
    width: 4px;
    height: 20px;
    background: var(--ramadan-green);
    border-radius: 2px;
    transition: all 0.3s ease;
}

.play-button .bar:nth-child(1) {
    animation: none;
}
.play-button .bar:nth-child(2) {
    animation: none;
}
.play-button .bar:nth-child(3) {
    animation: none;
}

.play-button:hover .bar {
    background: var(--ramadan-green-hover);
}

.play-button.playing .bar {
    background: linear-gradient(180deg, var(--ramadan-green) 0%, var(--ramadan-green-hover) 100%);
}

.play-button.playing .bar:nth-child(1) {
    animation: equalizer1 0.7s ease-in-out infinite;
}

.play-button.playing .bar:nth-child(2) {
    animation: equalizer2 0.7s ease-in-out infinite 0.175s;
}

.play-button.playing .bar:nth-child(3) {
    animation: equalizer3 0.7s ease-in-out infinite 0.35s;
}

@keyframes equalizer1 {
    0%, 100% { height: 20px; }
    50% { height: 10px; }
}

@keyframes equalizer2 {
    0%, 100% { height: 15px; }
    50% { height: 25px; }
}

@keyframes equalizer3 {
    0%, 100% { height: 20px; }
    50% { height: 8px; }
}

.title {
    font-size: 32px;
    font-weight: 300;
    color: var(--ramadan-green);
    letter-spacing: 2px;
    text-align: center;
}

.title span {
    font-weight: 300;
}

.radio-status {
    position: absolute;
    top: calc(50% - 220px);
    left: 50%;
    transform: translateX(-50%);
    font-size: 14px;
    color: var(--text-color-faded);
    text-align: center;
    width: 100%;
    opacity: 0;
    animation: fadeIn 0.8s ease-out 1s forwards;
    z-index: 20;
}

.radio-status .listeners {
    color: var(--ramadan-green);
    font-weight: bold;
}

.show-all-btn {
    position: absolute;
    top: calc(50% + 40px);
    left: 50%;
    transform: translateX(-50%);
    font-size: 16px;
    color: var(--text-color-faded);
    background: transparent;
    border: none;
    padding: 12px 24px;
    cursor: pointer;
    transition: all 0.3s ease;
    opacity: 0;
    animation: fadeIn 0.8s ease-out 0.8s forwards;
    z-index: 20;
    text-decoration: none;
    letter-spacing: 1px;
}

.show-all-btn:hover {
    color: var(--ramadan-green);
    letter-spacing: 2px;
}

.show-all-btn::after {
    content: '';
    position: absolute;
    bottom: 8px;
    left: 50%;
    width: 0;
    height: 1px;
    background-color: var(--ramadan-green);
    transition: all 0.3s ease;
    transform: translateX(-50%);
}

.show-all-btn:hover::after {
    width: 80%;
}

.content {
    position: absolute;
    top: calc(50% + 100px);
    width: 700px;
    left: 50%;
    transform: translateX(-50%);
    max-height: 0;
    overflow-y: auto;
    padding: 0 20px;
    box-sizing: border-box;
    transition: max-height 0.8s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 15;
    scrollbar-width: none;
}

.content::-webkit-scrollbar {
    display: none;
}

.content.show {
    max-height: 50vh;
}

.questions-container {
    display: flex;
    flex-direction: column;
    gap: 7.5px;
    padding: 20px 0 150px;
    opacity: 0;
    transition: opacity 0.5s ease;
}

.questions-container.show {
    opacity: 1;
}

.question-item {
    background: rgba(255, 255, 255, 0.008);
    padding: 12px 16px;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(2px);
    transform-origin: top;
    max-height: 55px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.01);
}

.question-item:hover {
    background: rgba(255, 255, 255, 0.012);
}

.question-item.expanded {
    max-height: 350px;
    background: rgba(255, 255, 255, 0.012);
}

.question-title {
    font-size: 17px;
    color: var(--text-color);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    text-align: center;
}

.question-title::after {
    display: none;
}

.question-answer {
    color: var(--text-color-faded);
    font-size: 14px;
    line-height: 1.5;
    padding-top: 5px;
    border-top: 1px solid rgba(255, 255, 255, 0.02);
    opacity: 0;
    transform: translateY(8px);
    transition: all 0.4s ease 0.1s;
    text-align: center;
}

.question-item.expanded .question-answer {
    opacity: 1;
    transform: translateY(0);
}

.fade-out {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 150px;
    background: linear-gradient(to top, var(--bg-color), transparent);
    pointer-events: none;
    z-index: 18;
}

/* Стили для контента книги */
.question-answer .arabic {
    font-family: 'Traditional Arabic', 'Scheherazade', serif !important;
    direction: rtl !important;
    text-align: center !important;
    font-size: 1.2em !important;
    line-height: 1.8 !important;
    margin: 10px 0 !important;
    padding: 10px !important;
    border-radius: 5px !important;
    background-color: rgba(224, 132, 51, 0.1) !important;
}

.question-answer .translation {
    font-style: italic !important;
    margin-bottom: 15px !important;
    text-align: justify !important;
}

.question-answer .footnote {
    font-size: 0.85em !important;
    color: rgba(29, 43, 9, 0.5) !important;
    margin-top: 10px !important;
    border-top: 1px solid rgba(255, 255, 255, 0.1) !important;
    padding-top: 5px !important;
}

.show-more-btn,
.show-less-btn {
    background: var(--ramadan-green) !important;
    color: #1D2B09 !important;
    border: none !important;
    padding: 6px 16px !important;
    border-radius: 4px !important;
    cursor: pointer !important;
    font-size: 13px !important;
    margin-top: 10px !important;
    transition: background 0.3s ease !important;
}

.show-more-btn:hover,
.show-less-btn:hover {
    background: var(--ramadan-green-hover) !important;
}

@media (max-width: 900px) {
    .search-container {
        width: 80%;
    }

    .content {
        width: 90%;
    }

    .title {
        font-size: 28px;
    }
}

@media (max-width: 600px) {
    .search-box {
        font-size: 18px;
    }

    .title {
        font-size: 24px;
    }

    .play-button {
        width: 45px;
        height: 45px;
    }

    .play-button::before {
        border-top: 9px solid transparent;
        border-bottom: 9px solid transparent;
        border-left: 14px solid var(--ramadan-green);
    }

    .question-item {
        padding: 15px;
    }

    .question-title {
        font-size: 15px;
    }

    .show-all-btn {
        font-size: 14px;
    }

    .content {
        top: calc(50% + 90px);
        width: 90%;
    }
}

/* Стили для модального окна */
@keyframes modalFadeIn {
    from {
        opacity: 0;
        backdrop-filter: blur(0px);
    }
    to {
        opacity: 1;
        backdrop-filter: blur(10px);
    }
}

/* Стили для кнопок в подразделах */
.show-full-btn {
    font-size: 16px;
    color: var(--text-color-faded);
    background: transparent;
    border: none;
    padding: 12px 24px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    letter-spacing: 1px;
    display: block;
    margin: -15px auto 5px auto;
    font-weight: normal;
    text-transform: none;
    position: relative;
}

/* Плавное исчезновение элементов при прокрутке */
.question-item {
    transition: opacity 0.5s ease, transform 0.5s ease;
}

.show-full-btn:hover {
    color: var(--ramadan-green);
    letter-spacing: 2px;
}

.show-full-btn::after {
    content: '';
    position: absolute;
    bottom: 8px;
    left: 50%;
    width: 0;
    height: 1px;
    background-color: var(--ramadan-green);
    transition: all 0.3s ease;
    transform: translateX(-50%);
}

.show-full-btn:hover::after {
    width: 80%;
}

/* Родительский раздел (h2) над подразделом */
.parent-section {
    color: rgba(224, 132, 51, 0.8) !important;
    font-size: 11px !important;
    margin-bottom: 5px !important;
    text-transform: uppercase !important;
    letter-spacing: 1.5px !important;
    font-weight: 700 !important;
    padding: 4px 10px !important;
    background: rgba(224, 132, 51, 0.1) !important;
    border-radius: 4px !important;
    display: inline-block !important;
    border: 1px solid rgba(224, 132, 51, 0.2) !important;
}

/* Модальное окно */
.subsection-modal .modal-content {
    scrollbar-width: thin;
    scrollbar-color: var(--ramadan-green) rgba(224, 132, 51, 0.05);
}

.subsection-modal .modal-content::-webkit-scrollbar {
    width: 12px;
}

.subsection-modal .modal-content::-webkit-scrollbar-track {
    background: rgba(224, 132, 51, 0.03);
    border-radius: 6px;
    margin: 10px 0;
    border: 1px solid rgba(224, 132, 51, 0.1);
}

.subsection-modal .modal-content::-webkit-scrollbar-thumb {
    background: linear-gradient(to bottom,
        var(--ramadan-green),
        #A05403,
        var(--ramadan-green));
    border-radius: 6px;
    border: 2px solid #FFF1D9;
}

.subsection-modal .modal-content::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(to bottom,
        var(--ramadan-green-hover),
        #B06413,
        var(--ramadan-green-hover));
}

/* Адаптивность */
@media (max-width: 1200px) {
    .subsection-modal .modal-content {
        width: 95% !important;
        max-width: 900px !important;
    }

    .modal-content h2 {
        font-size: 24px !important;
    }
}

@media (max-width: 768px) {
    .subsection-modal .modal-content {
        width: 98% !important;
        padding: 20px !important;
        max-height: 95vh !important;
        border-radius: 8px !important;
    }

    .modal-content h2 {
        font-size: 20px !important;
        margin-bottom: 20px !important;
    }

    .subsection-content .arabic {
        font-size: 1.5em !important;
        padding: 15px !important;
        margin: 20px 0 !important;
    }

    .modal-close-btn {
        width: 40px !important;
        height: 40px !important;
        font-size: 26px !important;
        top: 15px !important;
        right: 15px !important;
    }

    .show-full-btn {
        padding: 10px 20px !important;
        font-size: 14px !important;
        min-width: 180px !important;
    }
}

@media (max-width: 480px) {
    .subsection-modal .modal-content {
        padding: 15px !important;
        border-width: 1px !important;
    }

    .modal-content h2 {
        font-size: 18px !important;
        margin-bottom: 15px !important;
        padding-bottom: 10px !important;
    }

    .subsection-content .arabic {
        font-size: 1.3em !important;
        padding: 12px !important;
        margin: 15px 0 !important;
        line-height: 1.9 !important;
    }

    .subsection-content p {
        font-size: 15px !important;
        line-height: 1.6 !important;
    }

    .parent-section {
        font-size: 10px !important;
        padding: 3px 8px !important;
        letter-spacing: 1px !important;
    }

    .question-title {
        font-size: 16px !important;
    }
}

/* Особые стили для книги */
.book-subsection {
    font-family: 'Georgia', 'Times New Roman', serif;
}

.book-subsection h3:first-child {
    display: none; /* Скрываем дублирующий заголовок */
}

/* Подсветка поиска */
.highlight {
    background-color: rgba(224, 132, 51, 0.3);
    padding: 2px 4px;
    border-radius: 3px;
    color: #1D2B09;
    font-weight: bold;
}

/* Убираем выделение при клике на мобильных устройствах */
* {
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

/* Разрешаем выделение текста в определенных элементах */
input, textarea, .question-answer, .arabic, .translation {
    -webkit-tap-highlight-color: rgba(0, 0, 0, 0.1);
    -webkit-touch-callout: default;
    -webkit-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
    user-select: text;
}