/* دستیار قرآنی — تم شیعه ایرانی */

body.quran-theme {
    --bg-deep: #1a0e0e;
    --bg-mid: #0f1a12;
    --bg-warm: #1a1210;
    --green-primary: #2d6b4a;
    --green-light: #4a9d6e;
    --green-deep: #1b4d32;
    --red-accent: #8b1c2e;
    --red-light: #a52a3a;
    --gold-warm: #c9a84c;
    --gold-light: #e8d5a3;
    --text-warm: #f5f0e8;
    --text-muted: #c4b8a8;
    --glass-bg: rgba(26, 14, 14, 0.45);
    --glass-border: rgba(201, 168, 76, 0.3);
}

body.quran-theme {
    margin: 0;
    font-family: 'Vazirmatn', sans-serif;
    color: var(--text-warm);
    overflow: hidden;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    background:
        radial-gradient(ellipse at 30% 20%, rgba(139, 28, 46, 0.35) 0%, transparent 50%),
        radial-gradient(ellipse at 70% 80%, rgba(45, 107, 74, 0.3) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 50%, rgba(201, 168, 76, 0.08) 0%, transparent 60%),
        linear-gradient(160deg, var(--bg-deep) 0%, var(--bg-mid) 45%, var(--bg-warm) 100%);
    position: relative;
}

body.quran-theme::before {
    content: '';
    position: fixed;
    inset: 0;
    background:
        repeating-linear-gradient(
            45deg,
            transparent,
            transparent 28px,
            rgba(201, 168, 76, 0.025) 28px,
            rgba(201, 168, 76, 0.025) 29px
        ),
        repeating-linear-gradient(
            -45deg,
            transparent,
            transparent 28px,
            rgba(45, 107, 74, 0.02) 28px,
            rgba(45, 107, 74, 0.02) 29px
        );
    pointer-events: none;
    z-index: 0;
}

body.quran-theme p#hint {
    margin: 2px auto 0;
    font-size: 0.9rem;
    color: var(--text-muted);
}

body.quran-theme #particles-js {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    background: transparent;
    z-index: -1;
    pointer-events: none;
}

body.quran-theme .container {
    position: relative;
    width: 100%;
    max-width: 800px;
    height: 90%;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    box-sizing: border-box;
    z-index: 1;
}

/* --- Shared Styles --- */
body.quran-theme .header-icon {
    position: absolute;
    width: fit-content;
    height: 30px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.2em;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

body.quran-theme .header-icon:hover {
    background-color: rgba(201, 168, 76, 0.15);
}

body.quran-theme .top-right {
    top: 20px;
    right: 20px;
}

/* --- Landing Page --- */
body.quran-theme .landing-page {
    display: none;
    flex-direction: column;
    align-items: center;
    text-align: center;
    width: 100%;
    opacity: 0;
    transition: opacity 0.5s ease-in-out;
}

body.quran-theme .landing-page.active {
    display: flex;
    opacity: 1;
}

body.quran-theme .title {
    font-family: 'Lalezar', 'Vazirmatn', sans-serif;
    font-size: 3.5em;
    font-weight: 400;
    color: var(--green-light);
    text-shadow:
        0 0 20px rgba(74, 157, 110, 0.4),
        0 2px 8px rgba(201, 168, 76, 0.3);
    margin-bottom: 4px;
    position: relative;
    padding-bottom: 16px;
}

body.quran-theme .title::after {
    content: '✦';
    display: block;
    font-size: 0.25em;
    color: var(--gold-warm);
    margin-top: 8px;
    letter-spacing: 0.5em;
    text-shadow: 0 0 12px rgba(201, 168, 76, 0.5);
}

body.quran-theme .subtitle {
    font-size: 1.15em;
    color: var(--text-muted);
    margin-bottom: 40px;
    font-style: normal;
    letter-spacing: 0.02em;
}

body.quran-theme #audioVisualizer {
    margin-bottom: 50px;
    filter: drop-shadow(0 0 12px rgba(201, 168, 76, 0.4));
}

body.quran-theme .cta-button {
    background: linear-gradient(90deg, var(--red-accent), var(--green-primary));
    border: 1px solid rgba(201, 168, 76, 0.45);
    border-radius: 30px;
    color: var(--text-warm);
    padding: 15px 40px;
    font-size: 1.3em;
    font-weight: 700;
    font-family: 'Vazirmatn', sans-serif;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow:
        0 5px 20px rgba(139, 28, 46, 0.35),
        0 0 15px rgba(201, 168, 76, 0.15);
}

body.quran-theme .cta-button:hover {
    transform: translateY(-3px);
    box-shadow:
        0 8px 28px rgba(139, 28, 46, 0.45),
        0 0 25px rgba(201, 168, 76, 0.25);
    border-color: var(--gold-warm);
}

body.quran-theme .footer-icons {
    position: absolute;
    bottom: 20px;
    width: 100%;
    display: flex;
    justify-content: center;
    gap: 40px;
    color: var(--text-muted);
    font-size: 0.85em;
}

body.quran-theme .footer-icon {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background-color: rgba(201, 168, 76, 0.1);
    border: 1px solid rgba(201, 168, 76, 0.2);
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.8em;
    cursor: pointer;
    transition: background-color 0.3s ease;
    box-shadow: 0 0 10px rgba(201, 168, 76, 0.1);
}

body.quran-theme .footer-icon:hover {
    background-color: rgba(201, 168, 76, 0.2);
    box-shadow: 0 0 15px rgba(201, 168, 76, 0.25);
}

/* --- Chat Page --- */
body.quran-theme .chat-page {
    display: none;
    flex-direction: column;
    width: 100%;
    height: 100%;
    border-radius: 20px;
    margin-top: 20px;
    padding: 20px;
    opacity: 0;
    position: relative;
}

body.quran-theme .chat-page.active {
    display: flex;
    opacity: 1;
}

body.quran-theme .chat-header {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 20px;
    position: relative;
}

body.quran-theme .chat-header h2 {
    font-family: 'Lalezar', 'Vazirmatn', sans-serif;
    font-size: 2em;
    font-weight: 400;
    color: var(--green-light);
    margin: 0;
    text-shadow:
        0 0 15px rgba(74, 157, 110, 0.35),
        0 1px 4px rgba(201, 168, 76, 0.25);
    position: relative;
    padding-bottom: 10px;
}

body.quran-theme .chat-header h2::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--gold-warm), transparent);
    border-radius: 1px;
}

body.quran-theme .voice-switch-bar {
    position: fixed;
    top: 14px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 20;
    display: flex;
    justify-content: center;
    pointer-events: none;
}

body.quran-theme .voice-switch-bar .voice-switch {
    pointer-events: auto;
}

body.quran-theme .voice-switch {
    position: absolute;
    inset-inline-start: 0;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    user-select: none;
    padding: 7px 12px 7px 10px;
    border-radius: 30px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(8px);
    transition: background 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
    z-index: 5;
}

body.quran-theme .voice-switch-bar .voice-switch {
    position: static;
    inset-inline-start: unset;
    top: unset;
    transform: none;
}

body.quran-theme .voice-switch:hover {
    background: rgba(26, 14, 14, 0.6);
    border-color: rgba(201, 168, 76, 0.5);
    box-shadow: 0 0 16px rgba(201, 168, 76, 0.15);
}

body.quran-theme .voice-switch.voice-on {
    border-color: rgba(74, 157, 110, 0.45);
}

body.quran-theme .voice-switch.voice-off {
    border-color: rgba(165, 42, 58, 0.45);
}

body.quran-theme .voice-switch-text {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85em;
    font-weight: 600;
    color: var(--text-warm);
    white-space: nowrap;
}

body.quran-theme .voice-switch-icon {
    flex-shrink: 0;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

body.quran-theme .voice-switch-icon-on {
    color: var(--green-light);
}

body.quran-theme .voice-switch-icon-off {
    color: var(--red-light);
    display: none;
}

body.quran-theme .voice-switch.voice-off .voice-switch-icon-on {
    display: none;
}

body.quran-theme .voice-switch.voice-off .voice-switch-icon-off {
    display: block;
}

body.quran-theme .voice-switch.voice-off .voice-switch-text {
    color: #e8c4c4;
}

body.quran-theme .voice-switch input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    pointer-events: none;
}

body.quran-theme .voice-switch-track {
    width: 42px;
    height: 22px;
    border-radius: 11px;
    background: rgba(139, 28, 46, 0.4);
    position: relative;
    transition: background 0.3s ease, box-shadow 0.3s ease;
    flex-shrink: 0;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.25);
}

body.quran-theme .voice-switch input:checked + .voice-switch-track {
    background: linear-gradient(135deg, var(--green-primary), var(--green-light));
    box-shadow: 0 0 10px rgba(74, 157, 110, 0.35);
}

body.quran-theme .voice-switch-thumb {
    position: absolute;
    top: 2px;
    inset-inline-start: 2px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--gold-light);
    transition: inset-inline-start 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
}

body.quran-theme .voice-switch input:checked + .voice-switch-track .voice-switch-thumb {
    inset-inline-start: calc(100% - 20px);
}

body.quran-theme .text-chat {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    box-shadow:
        0 4px 24px rgba(0, 0, 0, 0.35),
        inset 0 1px 0 rgba(201, 168, 76, 0.12),
        inset 0 0 30px rgba(45, 107, 74, 0.08);
    border-radius: 20px;
    backdrop-filter: blur(10px);
    width: 100%;
    height: 60%;
    display: flex;
    align-items: center;
    justify-content: center;
}

body.quran-theme .chat-box {
    height: 100%;
    flex-grow: 1;
    overflow-y: auto;
    padding: 10px;
    margin: 0 10px;
    scrollbar-width: thin;
    scrollbar-color: rgba(201, 168, 76, 0.5) rgba(26, 14, 14, 0.4);
    animation: popup 0.5s forwards;
}

body.quran-theme .chat-box::-webkit-scrollbar {
    width: 8px;
}

body.quran-theme .chat-box::-webkit-scrollbar-track {
    background: rgba(26, 14, 14, 0.5);
    border-radius: 10px;
}

body.quran-theme .chat-box::-webkit-scrollbar-thumb {
    background-color: var(--gold-warm);
    border-radius: 10px;
    border: 2px solid rgba(26, 14, 14, 0.5);
}

body.quran-theme .message {
    max-width: 50%;
    width: fit-content;
    padding: 12px 18px;
    border-radius: 20px;
    margin-bottom: 15px;
    line-height: 1.6;
    word-wrap: break-word;
}

body.quran-theme .message.user {
    background: linear-gradient(135deg, var(--red-accent), var(--red-light));
    color: var(--text-warm);
    margin-left: auto;
    border-bottom-right-radius: 5px;
    border: 1px solid rgba(201, 168, 76, 0.2);
    box-shadow: 0 2px 12px rgba(139, 28, 46, 0.25);
}

body.quran-theme .message.ai {
    background: linear-gradient(135deg, var(--green-deep), var(--green-primary));
    color: var(--text-warm);
    margin-right: auto;
    border-bottom-left-radius: 5px;
    border: 1px solid rgba(74, 157, 110, 0.25);
    box-shadow: 0 2px 12px rgba(45, 107, 74, 0.25);
}

body.quran-theme #chatVisualizer {
    display: block;
    margin: 10px auto;
    filter: drop-shadow(0 0 8px rgba(201, 168, 76, 0.3));
}

body.quran-theme .chat-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 16px;
    margin: 5px auto;
}

body.quran-theme .mute-button {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: solid var(--red-light);
    background: rgba(139, 28, 46, 0.2);
    display: none;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    box-shadow:
        0 0 15px rgba(165, 42, 58, 0.4),
        inset 0 0 12px rgba(139, 28, 46, 0.2);
    transition: all 0.3s ease;
    position: relative;
    z-index: 10;
}

body.quran-theme .mute-button:hover {
    transform: scale(1.05);
    box-shadow: 0 0 25px rgba(165, 42, 58, 0.6);
}

body.quran-theme .mic-button {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    border: solid var(--green-light);
    background: rgba(45, 107, 74, 0.15);
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    margin: 0;
    box-shadow:
        0 0 20px rgba(74, 157, 110, 0.45),
        inset 0 0 18px rgba(201, 168, 76, 0.15);
    transition: all 0.3s ease;
    position: relative;
    z-index: 10;
}

body.quran-theme .mic-button:hover {
    transform: scale(1.05);
    box-shadow:
        0 0 30px rgba(74, 157, 110, 0.6),
        inset 0 0 22px rgba(201, 168, 76, 0.2);
    border-color: var(--gold-warm);
}

body.quran-theme .mic-button.active {
    animation: quran-pulse 1.5s infinite ease-out;
}

body.quran-theme .mic-icon {
    width: 30px;
    height: 30px;
    background-color: var(--green-deep);
    border-radius: 50%;
    position: relative;
}

body.quran-theme .mic-icon::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 15px;
    height: 25px;
    background-color: var(--text-warm);
    border-radius: 5px;
}

body.quran-theme .mic-icon::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 25px;
    height: 5px;
    background-color: var(--text-warm);
    border-radius: 3px;
}

body.quran-theme footer {
    height: 10px;
    direction: ltr;
    color: var(--text-muted);
    font-size: 0.8em;
    z-index: 1;
}

@keyframes quran-pulse {
    0% {
        transform: scale(1);
        box-shadow:
            0 0 20px rgba(74, 157, 110, 0.45),
            inset 0 0 18px rgba(201, 168, 76, 0.15);
    }
    50% {
        transform: scale(1.08);
        box-shadow:
            0 0 40px rgba(74, 157, 110, 0.65),
            inset 0 0 28px rgba(201, 168, 76, 0.25);
    }
    100% {
        transform: scale(1);
        box-shadow:
            0 0 20px rgba(74, 157, 110, 0.45),
            inset 0 0 18px rgba(201, 168, 76, 0.15);
    }
}

@keyframes popup {
    0% {
        height: 50%;
        opacity: 0;
    }
    100% {
        height: 90%;
        opacity: 1;
    }
}

/* Responsive adjustments */
@media (max-width: 768px) {
    body.quran-theme .title {
        font-size: 2.5em;
    }

    body.quran-theme .subtitle {
        font-size: 1em;
    }

    body.quran-theme .cta-button {
        padding: 12px 30px;
        font-size: 1.1em;
    }

    body.quran-theme .footer-icon {
        width: 40px;
        height: 40px;
        font-size: 1.5em;
    }

    body.quran-theme .top-right {
        top: 10px;
        right: 10px;
    }

    body.quran-theme .chat-header h2 {
        font-size: 1.5em;
    }

    body.quran-theme .voice-switch-bar {
        top: 10px;
        max-width: calc(100% - 24px);
    }

    body.quran-theme .voice-switch-bar .voice-switch {
        padding: 6px 10px;
    }

    body.quran-theme .voice-switch-text span {
        font-size: 0.9em;
    }
}
