:root {
    --oracle-gold: #d4af37;
    --oracle-gold-light: #f4d03f;
    --oracle-gold-dark: #b8941f;
    --oracle-purple: #4a148c;
    --oracle-purple-dark: #2d0a54;
    --oracle-blue: #1a1f3a;
    --oracle-blue-dark: #0f1323;
    --text-primary: #e8e6e3;
    --text-secondary: #b8b5b0;
    --text-tertiary: #8a8580;
    --background: #0a0e1a;
    --surface: #151922;
    --surface-hover: #1d222e;
    --border: rgba(212, 175, 55, 0.2);
    --shadow: rgba(0, 0, 0, 0.5);
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: linear-gradient(135deg, var(--background) 0%, var(--oracle-blue-dark) 50%, var(--oracle-purple-dark) 100%);
    background-attachment: fixed;
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background:
        radial-gradient(ellipse at 20% 30%, rgba(212, 175, 55, 0.05) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 70%, rgba(74, 20, 140, 0.05) 0%, transparent 50%);
    pointer-events: none;
    z-index: 0;
}

.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 2rem 1rem 0;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    position: relative;
    z-index: 1;
}

/* Header Styles */
.header {
    text-align: center;
    padding: 2rem 0 1.5rem;
    border-bottom: 1px solid var(--border);
    margin-bottom: 2rem;
    background: linear-gradient(180deg, rgba(21, 25, 34, 0.8) 0%, transparent 100%);
    backdrop-filter: blur(10px);
}

.logo-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 0.5rem;
}

.oracle-symbol {
    width: 50px;
    height: 50px;
    animation: rotate 20s linear infinite;
}

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

.logo-text {
    font-family: 'Cinzel', serif;
    font-size: 2.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--oracle-gold) 0%, var(--oracle-gold-light) 50%, var(--oracle-gold) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: 2px;
}

.tagline {
    font-family: 'Cinzel', serif;
    font-size: 0.95rem;
    color: var(--text-secondary);
    letter-spacing: 3px;
    text-transform: uppercase;
    font-weight: 400;
}

/* Chat Container */
.chat-container {
    flex: 1;
    overflow-y: auto;
    padding-bottom: 1rem;
    margin-bottom: 1rem;
}

.messages {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* Welcome Message */
.welcome-message {
    text-align: center;
    padding: 3rem 2rem;
    background: rgba(21, 25, 34, 0.6);
    border: 1px solid var(--border);
    border-radius: 16px;
    backdrop-filter: blur(10px);
}

.oracle-icon {
    width: 60px;
    height: 60px;
    margin: 0 auto 1.5rem;
}

.welcome-message h2 {
    font-family: 'Cinzel', serif;
    font-size: 1.8rem;
    color: var(--oracle-gold);
    margin-bottom: 1rem;
    font-weight: 600;
}

.welcome-message p {
    color: var(--text-secondary);
    font-size: 1.05rem;
    max-width: 500px;
    margin: 0 auto;
    line-height: 1.7;
}

/* Message Styles */
.message {
    display: flex;
    gap: 1rem;
    padding: 1.5rem;
    background: rgba(21, 25, 34, 0.6);
    border-radius: 12px;
    border: 1px solid transparent;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.message:hover {
    border-color: var(--border);
    background: rgba(21, 25, 34, 0.8);
}

.message-avatar {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
}

.message.user .message-avatar {
    background: linear-gradient(135deg, var(--oracle-blue) 0%, var(--oracle-purple) 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 1.1rem;
    color: var(--oracle-gold);
    border: 2px solid var(--border);
}

.message.assistant .message-avatar svg {
    width: 100%;
    height: 100%;
}

.message-content {
    flex: 1;
    color: var(--text-primary);
    font-size: 0.98rem;
    line-height: 1.7;
    overflow-wrap: break-word;
}

.message.user .message-content {
    font-weight: 400;
}

.message.assistant .message-content {
    color: var(--text-primary);
}

.message-content p {
    margin-bottom: 1rem;
}

.message-content p:last-child {
    margin-bottom: 0;
}

.message-content code {
    background: rgba(0, 0, 0, 0.3);
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    font-family: 'Monaco', 'Courier New', monospace;
    font-size: 0.9em;
    color: var(--oracle-gold-light);
}

.message-content pre {
    background: rgba(0, 0, 0, 0.4);
    padding: 1rem;
    border-radius: 8px;
    overflow-x: auto;
    margin: 1rem 0;
    border: 1px solid var(--border);
}

.message-content pre code {
    background: none;
    padding: 0;
    color: var(--text-primary);
}

/* Loading Animation */
.message.loading {
    border-color: var(--border);
}

.loading-dots {
    display: flex;
    gap: 0.5rem;
    padding: 0.5rem 0;
}

.loading-dots span {
    width: 8px;
    height: 8px;
    background: var(--oracle-gold);
    border-radius: 50%;
    animation: pulse 1.4s ease-in-out infinite;
}

.loading-dots span:nth-child(2) {
    animation-delay: 0.2s;
}

.loading-dots span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes pulse {
    0%, 80%, 100% {
        opacity: 0.3;
        transform: scale(0.8);
    }
    40% {
        opacity: 1;
        transform: scale(1.2);
    }
}

/* Input Container */
.input-container {
    padding: 1.5rem 0 2rem;
    border-top: 1px solid var(--border);
    background: linear-gradient(0deg, rgba(21, 25, 34, 0.95) 0%, transparent 100%);
    backdrop-filter: blur(10px);
}

.chat-form {
    width: 100%;
}

.input-wrapper {
    display: flex;
    gap: 0.75rem;
    align-items: flex-end;
    background: var(--surface);
    border: 2px solid var(--border);
    border-radius: 16px;
    padding: 0.75rem 1rem;
    transition: all 0.3s ease;
}

.input-wrapper:focus-within {
    border-color: var(--oracle-gold);
    box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.1);
}

#user-input {
    flex: 1;
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 1rem;
    font-family: inherit;
    resize: none;
    outline: none;
    max-height: 150px;
    min-height: 24px;
}

#user-input::placeholder {
    color: var(--text-tertiary);
}

.send-button {
    background: linear-gradient(135deg, var(--oracle-gold) 0%, var(--oracle-gold-light) 100%);
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    flex-shrink: 0;
    color: var(--oracle-blue-dark);
}

.send-button:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(212, 175, 55, 0.4);
}

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

.send-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.send-button svg {
    width: 20px;
    height: 20px;
}

.input-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 0.75rem;
    padding: 0 0.5rem;
    font-size: 0.85rem;
}

.character-count {
    color: var(--text-tertiary);
}

.disclaimer {
    color: var(--text-tertiary);
    font-style: italic;
}

/* Scrollbar Styles */
.chat-container::-webkit-scrollbar {
    width: 8px;
}

.chat-container::-webkit-scrollbar-track {
    background: transparent;
}

.chat-container::-webkit-scrollbar-thumb {
    background: var(--oracle-gold);
    border-radius: 4px;
}

.chat-container::-webkit-scrollbar-thumb:hover {
    background: var(--oracle-gold-light);
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 1rem 0.75rem 0;
    }

    .header {
        padding: 1.5rem 0 1rem;
    }

    .logo-text {
        font-size: 2rem;
    }

    .tagline {
        font-size: 0.8rem;
        letter-spacing: 2px;
    }

    .oracle-symbol {
        width: 40px;
        height: 40px;
    }

    .message {
        padding: 1rem;
        gap: 0.75rem;
    }

    .message-avatar {
        width: 32px;
        height: 32px;
    }

    .welcome-message {
        padding: 2rem 1rem;
    }

    .welcome-message h2 {
        font-size: 1.5rem;
    }

    .input-container {
        padding: 1rem 0 1.5rem;
    }
}

/* Fade-in animation for messages */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message {
    animation: fadeIn 0.4s ease-out;
}

/* Error message styling */
.error-message {
    background: rgba(220, 38, 38, 0.1);
    border: 1px solid rgba(220, 38, 38, 0.3);
    color: #fca5a5;
    padding: 1rem;
    border-radius: 8px;
    margin: 1rem 0;
}

/* Speaker Button Styles */
.speaker-button {
    background: rgba(212, 175, 55, 0.1);
    border: 1px solid var(--border);
    color: var(--oracle-gold);
    width: 36px;
    height: 36px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    margin-top: 0.75rem;
    padding: 0;
}

.speaker-button:hover {
    background: rgba(212, 175, 55, 0.2);
    border-color: var(--oracle-gold);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(212, 175, 55, 0.2);
}

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

.speaker-button svg {
    width: 18px;
    height: 18px;
}

/* Speaking animation */
.speaker-button.speaking {
    background: var(--oracle-gold);
    color: var(--oracle-blue-dark);
    border-color: var(--oracle-gold);
    animation: speakPulse 1s ease-in-out infinite;
}

@keyframes speakPulse {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(212, 175, 55, 0.7);
    }
    50% {
        box-shadow: 0 0 0 8px rgba(212, 175, 55, 0);
    }
}
