:root {
    --bg-color: #0b0c10;
    --glass-bg: rgba(255, 255, 255, 0.03);
    --glass-border: rgba(255, 255, 255, 0.08);
    --primary-color: #d4af37; /* Gold accent */
    --text-primary: #e0e0e0;
    --text-secondary: #9e9e9e;
    --user-msg: rgba(212, 175, 55, 0.15);
    --ruth-msg: rgba(255, 255, 255, 0.05);
}

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

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    position: relative;
}

/* Dynamic Orbs for Premium feel */
.background-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(100px);
    z-index: -1;
    animation: float 20s infinite ease-in-out alternate;
}

.orb-1 {
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(212, 175, 55, 0.15) 0%, transparent 70%);
    top: -100px;
    left: -100px;
}

.orb-2 {
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(46, 125, 50, 0.1) 0%, transparent 70%); /* Subtle golf green */
    bottom: -150px;
    right: -100px;
    animation-delay: -5s;
}

@keyframes float {
    0% { transform: translate(0, 0); }
    100% { transform: translate(50px, 50px); }
}

.chat-container {
    width: 100%;
    max-width: 480px;
    height: 85vh;
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    display: flex;
    flex-direction: column;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    overflow: hidden;
}

/* Header */
.chat-header {
    display: flex;
    align-items: center;
    padding: 20px 24px;
    background: rgba(0, 0, 0, 0.2);
    border-bottom: 1px solid var(--glass-border);
}

.avatar-container {
    position: relative;
    margin-right: 16px;
}

.avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--primary-color);
}

.online-indicator {
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 12px;
    height: 12px;
    background-color: #4caf50;
    border-radius: 50%;
    border: 2px solid var(--bg-color);
}

.header-info h1 {
    font-size: 1.1rem;
    font-weight: 500;
    margin-bottom: 2px;
    letter-spacing: 0.5px;
}

.header-info p {
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-weight: 300;
}

/* Chat Area */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    scroll-behavior: smooth;
}

.chat-messages::-webkit-scrollbar {
    width: 6px;
}
.chat-messages::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}

.message {
    display: flex;
    max-width: 85%;
    opacity: 0;
    transform: translateY(10px);
    animation: fadeInUp 0.4s forwards ease-out;
}

@keyframes fadeInUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message.user {
    align-self: flex-end;
}

.message.ruth {
    align-self: flex-start;
}

.message-content {
    padding: 14px 18px;
    border-radius: 18px;
    font-size: 0.95rem;
    line-height: 1.5;
    letter-spacing: 0.2px;
}

.message.user .message-content {
    background: var(--user-msg);
    border-bottom-right-radius: 4px;
    color: #fff;
    border: 1px solid rgba(212, 175, 55, 0.2);
}

.message.ruth .message-content, .system-greeting .message-content {
    background: var(--ruth-msg);
    border-bottom-left-radius: 4px;
    color: #e0e0e0;
    border: 1px solid var(--glass-border);
}

/* Typing Indicator */
.typing-indicator {
    padding: 0 24px 16px;
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-style: italic;
}

.typing-indicator.hidden {
    display: none;
}

.dot {
    animation: blink 1.4s infinite reverse;
}
.dot:nth-child(2) { animation-delay: 0.2s; }
.dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes blink {
    0% { opacity: 0; }
    50% { opacity: 1; }
    100% { opacity: 0; }
}

/* Input Area */
.chat-input-area {
    display: flex;
    padding: 16px 24px;
    background: rgba(0, 0, 0, 0.3);
    border-top: 1px solid var(--glass-border);
    gap: 12px;
}

#userInput {
    flex: 1;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 100px;
    padding: 12px 16px;
    color: #fff;
    font-size: 0.95rem;
    font-family: 'Outfit', sans-serif;
    outline: none;
    transition: all 0.3s ease;
    width: 100%;
}

#userInput:focus {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(212, 175, 55, 0.5);
    box-shadow: 0 0 15px rgba(212, 175, 55, 0.1);
}

#userInput::placeholder {
    color: var(--text-secondary);
}

.mic-btn, #sendBtn {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid rgba(255, 255, 255, 0.1);
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

#sendBtn {
    background: var(--primary-color);
    color: #000;
    border: none;
}

.mic-btn:hover {
    background: rgba(255,255,255,0.1);
    color: #fff;
}

#sendBtn:hover {
    transform: scale(1.05);
    box-shadow: 0 0 15px rgba(212, 175, 55, 0.4);
}

.mic-btn:active, #sendBtn:active {
    transform: scale(0.95);
}

/* Listening Pulse Animation */
.mic-btn.listening {
    background: rgba(244, 67, 54, 0.2);
    color: #f44336;
    border-color: #f44336;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(244, 67, 54, 0.4); }
    70% { box-shadow: 0 0 0 10px rgba(244, 67, 54, 0); }
    100% { box-shadow: 0 0 0 0 rgba(244, 67, 54, 0); }
}

/* Speaking Animation for Avatar */
.avatar.speaking {
    animation: glow-pulse 1.5s infinite alternate;
}

@keyframes glow-pulse {
    0% { box-shadow: 0 0 5px rgba(212, 175, 55, 0.2); border-color: rgba(212, 175, 55, 0.5); }
    100% { box-shadow: 0 0 20px rgba(212, 175, 55, 0.8), 0 0 40px rgba(212, 175, 55, 0.4); border-color: rgba(212, 175, 55, 1); }
}

/* Responsiveness */
@media (max-width: 500px) {
    .chat-container {
        height: 100vh;
        border-radius: 0;
        border: none;
    }
}
