@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:ital,wght@0,400;0,600;0,700;1,400&family=Cinzel:wght@400;600;700&display=swap');

:root {
    --parchment-bg: #faf6f0;
    --parchment-light: #fdfbf7;
    --parchment-dark: #d4c5a9;
    --ink-black: #2c1810;
    --ink-brown: #5c3d2e;
    --royal-gold: #b8860b;
    --gold-light: #d4a843;
    --gold-pale: #f0e6c8;
    --cathedral-dark: #1a1a2e;
    --cathedral-purple: #2d2347;
    --ivory: #fffff0;
    --shadow-gold: rgba(184, 134, 11, 0.25);
    --shadow-warm: rgba(44, 24, 16, 0.15);
}

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

html, body {
    overflow-x: hidden;
    max-width: 100vw;
}

body {
    font-family: 'Cormorant Garamond', serif;
    background:
        radial-gradient(ellipse at top, #2d2347 0%, #1a1a2e 50%, #0f0f1e 100%);
    min-height: 100vh;
    padding: 20px;
    color: var(--ink-black);
    line-height: 1.8;
}

.sacred-container {
    max-width: 900px;
    margin: 0 auto;
}

.sacred-header {
    text-align: center;
    margin-bottom: 0;
    padding: 25px 30px;
    background:
        linear-gradient(180deg, var(--parchment-light) 0%, var(--parchment-bg) 100%);
    border-radius: 15px 15px 15px 15px;
    box-shadow:
        0 10px 30px var(--shadow-warm),
        inset 0 1px 0 rgba(255, 255, 255, 0.8),
        0 0 60px rgba(184, 134, 11, 0.15);
    border: 2px solid var(--parchment-dark);
    position: relative;
    overflow: hidden;
}

.sacred-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg,
        transparent 0%,
        var(--royal-gold) 20%,
        var(--gold-light) 50%,
        var(--royal-gold) 80%,
        transparent 100%
    );
}

.sacred-header::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg,
        transparent 0%,
        var(--royal-gold) 20%,
        var(--gold-light) 50%,
        var(--royal-gold) 80%,
        transparent 100%
    );
}

.cross-symbol {
    font-size: min(56px, 10vw);
    color: var(--royal-gold);
    text-shadow:
        0 0 20px rgba(184, 134, 11, 0.4),
        1px 1px 3px var(--shadow-gold);
    margin: 0;
    line-height: 1.2;
    filter: drop-shadow(0 0 10px rgba(184, 134, 11, 0.3));
}

.title {
    font-family: 'Cinzel', serif;
    font-size: 42px;
    font-weight: 700;
    color: var(--ink-black);
    margin: 5px 0 10px 0;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.08);
    letter-spacing: 2px;
}

.tagline {
    font-size: 20px;
    color: var(--ink-brown);
    font-style: italic;
    font-weight: 600;
    margin: 0;
}

.chat-container {
    background: var(--parchment-bg);
    border-radius: 15px;
    box-shadow:
        0 15px 40px var(--shadow-warm),
        0 0 80px rgba(184, 134, 11, 0.08),
        inset 0 0 100px rgba(184, 134, 11, 0.03);
    border: 2px solid var(--parchment-dark);
    margin-top: 20px;
    position: relative;
}

.chat-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image:
        radial-gradient(circle at 20% 50%, transparent 0%, rgba(184, 134, 11, 0.01) 100%),
        radial-gradient(circle at 80% 80%, transparent 0%, rgba(184, 134, 11, 0.01) 100%);
    pointer-events: none;
    border-radius: 12px;
}

.scripture-paper {
    padding: 40px;
    min-height: 500px;
    background:
        repeating-linear-gradient(
            0deg,
            transparent,
            transparent 35px,
            rgba(184, 134, 11, 0.04) 35px,
            rgba(184, 134, 11, 0.04) 36px
        ),
        linear-gradient(90deg,
            transparent 0%,
            transparent 50px,
            rgba(184, 134, 11, 0.02) 50px,
            rgba(184, 134, 11, 0.02) 52px,
            transparent 52px
        );
    position: relative;
}

.scripture-paper::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAMAAAADCAYAAABWKLW/AAAAIElEQVQYV2NkYGD4z8DAwMgABXABZEFGBgYGRiYGBgYABHgBMdVOYCIAAAAASUVORK5CYII=');
    opacity: 0.015;
    pointer-events: none;
}

.welcome-message {
    margin-bottom: 30px;
    padding: 30px;
    background: rgba(255, 255, 255, 0.45);
    border-radius: 10px;
    border: 2px solid var(--parchment-dark);
    box-shadow:
        0 5px 15px rgba(0, 0, 0, 0.06),
        inset 0 0 30px rgba(184, 134, 11, 0.03);
}

.welcome-message h2 {
    font-family: 'Cinzel', serif;
    font-size: 28px;
    color: var(--ink-black);
    margin-bottom: 20px;
    text-align: center;
}

.scripture-verse {
    font-size: 20px;
    text-align: center;
    color: var(--ink-brown);
    margin: 15px 0;
    font-weight: 600;
    font-style: italic;
    line-height: 1.6;
}

.translation {
    text-align: center;
    color: var(--royal-gold);
    font-size: 16px;
    margin-bottom: 20px;
    font-weight: 600;
}

.welcome-text {
    font-size: 18px;
    margin-bottom: 15px;
    text-align: justify;
    line-height: 1.9;
    color: var(--ink-black);
}

.load-previous-btn {
    display: block;
    margin: 20px auto;
    padding: 12px 30px;
    font-family: 'Cormorant Garamond', serif;
    font-size: 16px;
    font-weight: 600;
    color: white;
    background: linear-gradient(135deg, var(--royal-gold) 0%, var(--gold-light) 100%);
    border: 2px solid var(--royal-gold);
    border-radius: 25px;
    cursor: pointer;
    box-shadow: 0 4px 15px var(--shadow-gold);
    transition: all 0.3s ease;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.2);
}

.load-previous-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(184, 134, 11, 0.4);
}

.load-previous-btn:active {
    transform: translateY(0);
}

.messages {
    margin-bottom: 30px;
}

.message {
    margin-bottom: 25px;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.06);
    position: relative;
}

.message.user {
    background: rgba(184, 134, 11, 0.06);
    border-left: 4px solid var(--royal-gold);
    margin-left: 40px;
}

.message.assistant {
    background: rgba(255, 255, 255, 0.5);
    border-left: 4px solid var(--parchment-dark);
    margin-right: 40px;
}

.message-label {
    font-size: 14px;
    font-weight: 600;
    color: var(--ink-brown);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.message-content {
    font-size: 17px;
    line-height: 1.8;
    color: var(--ink-black);
}

.verse-citation {
    margin-top: 20px;
    padding: 15px;
    background: rgba(184, 134, 11, 0.05);
    border-radius: 5px;
    border-left: 3px solid var(--royal-gold);
}

.verse-arabic {
    font-size: 18px;
    color: var(--ink-brown);
    margin-bottom: 8px;
    font-weight: 600;
    font-style: italic;
}

.verse-transliteration {
    font-style: italic;
    color: var(--ink-brown);
    margin-bottom: 8px;
    font-size: 16px;
}

.verse-translation {
    color: var(--ink-black);
    margin-bottom: 8px;
    font-size: 16px;
}

.verse-reference {
    font-size: 14px;
    color: var(--royal-gold);
    font-weight: 600;
    margin-top: 10px;
}

.input-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

#userInput {
    width: 100%;
    padding: 15px;
    font-family: 'Cormorant Garamond', serif;
    font-size: 17px;
    border: 2px solid var(--parchment-dark);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.7);
    color: var(--ink-black);
    resize: vertical;
    min-height: 80px;
    box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.06);
    transition: all 0.3s ease;
}

#userInput:focus {
    outline: none;
    border-color: var(--royal-gold);
    box-shadow:
        inset 0 2px 5px rgba(0, 0, 0, 0.06),
        0 0 0 3px rgba(184, 134, 11, 0.15);
}

.send-button {
    align-self: flex-end;
    padding: 12px 30px;
    font-family: 'Cormorant Garamond', serif;
    font-size: 18px;
    font-weight: 600;
    color: white;
    background: linear-gradient(135deg, var(--royal-gold) 0%, var(--gold-light) 100%);
    border: 2px solid var(--royal-gold);
    border-radius: 25px;
    cursor: pointer;
    box-shadow: 0 4px 15px var(--shadow-gold);
    transition: all 0.3s ease;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.2);
}

.send-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(184, 134, 11, 0.4);
}

.send-button:active {
    transform: translateY(0);
}

.send-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.loading {
    text-align: center;
    padding: 30px;
}

.cross-spinner {
    font-size: 48px;
    color: var(--royal-gold);
    animation: spin 3s linear infinite, pulse 1.5s ease-in-out infinite;
    display: inline-block;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

@keyframes pulse {
    0%, 100% { opacity: 0.6; transform: scale(1); }
    50% { opacity: 1; transform: scale(1.1); }
}

.loading p {
    margin-top: 15px;
    color: var(--ink-brown);
    font-style: italic;
    font-size: 16px;
}

.sacred-footer {
    text-align: center;
    padding: 30px;
    margin-top: 30px;
    background:
        linear-gradient(180deg, var(--parchment-bg) 0%, var(--parchment-light) 100%);
    border-radius: 10px;
    border: 2px solid var(--parchment-dark);
    box-shadow:
        0 5px 20px var(--shadow-warm),
        0 0 40px rgba(184, 134, 11, 0.08);
    position: relative;
    overflow: hidden;
}

.sacred-footer::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg,
        transparent 0%,
        var(--royal-gold) 20%,
        var(--gold-light) 50%,
        var(--royal-gold) 80%,
        transparent 100%
    );
}

.footer-text {
    font-size: 16px;
    color: var(--ink-brown);
    margin-bottom: 15px;
    font-style: italic;
}

.copyright {
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid var(--parchment-dark);
    font-size: 12px;
    color: var(--ink-brown);
    font-weight: 600;
    letter-spacing: 0.5px;
}

@media (max-width: 768px) {
    body {
        padding: 10px;
    }

    .sacred-header {
        padding: 15px 15px;
    }

    .title {
        font-size: 28px;
        letter-spacing: 1px;
    }

    .tagline {
        font-size: 16px;
    }

    .scripture-paper {
        padding: 15px;
    }

    .welcome-message {
        padding: 20px 15px;
    }

    .scripture-verse {
        font-size: 17px;
    }

    .message.user {
        margin-left: 10px;
    }

    .message.assistant {
        margin-right: 10px;
    }

    .welcome-message h2 {
        font-size: 24px;
    }
}

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 10px;
}

::-webkit-scrollbar-track {
    background: var(--parchment-dark);
}

::-webkit-scrollbar-thumb {
    background: var(--royal-gold);
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--ink-brown);
}
