:root {
    --bg-dark: #0F172A;
    --bg-card: rgba(30, 41, 59, 0.7);
    --primary: #8B5CF6; /* Violets */
    --primary-glow: rgba(139, 92, 246, 0.5);
    --secondary: #3B82F6; /* Blueish */
    --text-main: #F8FAFC;
    --text-muted: #94A3B8;
    --success: #10B981;
    --error: #EF4444;
}

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

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    font-family: 'Inter', sans-serif;
    height: 100vh;
    overflow: hidden;
    /* Soft mesh gradient background */
    background-image: 
        radial-gradient(at 0% 0%, hsla(253,16%,7%,1) 0, transparent 50%), 
        radial-gradient(at 50% 0%, hsla(225,39%,30%,0.2) 0, transparent 50%), 
        radial-gradient(at 100% 0%, hsla(339,49%,30%,0.2) 0, transparent 50%);
}

.blur-glass {
    background: var(--bg-card);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

.app-container {
    display: flex;
    flex-direction: column;
    height: 100%;
}

/* HEADER */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    z-index: 10;
}

.logo-text {
    font-family: 'Outfit', sans-serif;
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: -0.5px;
}

.gradient-text {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.pulse-dot {
    width: 8px;
    height: 8px;
    background-color: var(--error);
    border-radius: 50%;
    transition: background-color 0.3s;
}
.pulse-dot.connected {
    background-color: var(--success);
    box-shadow: 0 0 10px var(--success);
}

/* CHAT AREA */
.chat-container {
    flex: 1;
    overflow-y: auto;
    padding: 2rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    scroll-behavior: smooth;
}

.welcome-message {
    text-align: center;
    margin: auto;
    max-width: 300px;
}

.ai-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.1), rgba(59, 130, 246, 0.1));
    border: 2px solid rgba(139, 92, 246, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    color: var(--primary);
    margin: 0 auto 1.5rem auto;
    box-shadow: 0 0 30px var(--primary-glow);
}

.welcome-message h2 {
    font-family: 'Outfit', sans-serif;
    margin-bottom: 0.5rem;
}
.welcome-message p {
    color: var(--text-muted);
    font-size: 0.95rem;
    line-height: 1.5;
}

/* MESSAGES */
.message {
    max-width: 85%;
    padding: 1rem 1.2rem;
    border-radius: 1.2rem;
    animation: fadeIn 0.4s ease forwards;
    line-height: 1.5;
    font-size: 0.95rem;
}
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.msg-user {
    align-self: flex-end;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    border-bottom-right-radius: 0.3rem;
}

.msg-ai {
    align-self: flex-start;
    background: var(--bg-card);
    border: 1px solid rgba(255,255,255,0.05);
    border-bottom-left-radius: 0.3rem;
}

/* CONTROLS (MIC) */
.controls-container {
    padding: 2rem 0 3rem 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    border-top: 1px solid rgba(255,255,255,0.05);
    z-index: 10;
    position: relative;
}

.listening-feedback {
    position: absolute;
    top: -40px;
    background: var(--primary);
    padding: 0.4rem 1.2rem;
    border-radius: 2rem;
    font-size: 0.85rem;
    font-weight: 500;
    box-shadow: 0 4px 15px var(--primary-glow);
    animation: pulseObj 1.5s infinite alternate;
}
.hidden {
    opacity: 0;
    transform: translateY(10px);
    pointer-events: none;
    transition: all 0.3s;
}

.mic-button {
    background: transparent;
    border: none;
    cursor: pointer;
    position: relative;
    outline: none;
    -webkit-tap-highlight-color: transparent;
}

.mic-icon-wrapper {
    width: 76px;
    height: 76px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--bg-dark), #1E293B);
    border: 2px solid rgba(255,255,255,0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    color: white;
    position: relative;
    z-index: 2;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 10px 25px rgba(0,0,0,0.5);
}

.mic-button.active .mic-icon-wrapper {
    transform: scale(0.9);
    border-color: var(--primary);
    color: var(--primary);
    background: #110C1D; /* Darker tinted bg */
}

/* Listening Rings Animation */
.rings-container {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100%;
    height: 100%;
    z-index: 1;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s;
}

.mic-button.active .rings-container {
    opacity: 1;
}

.ring {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    border: 1px solid var(--primary);
    animation: ripple 2s linear infinite;
    width: 76px;
    height: 76px;
}

.ring-2 {
    animation-delay: 1s;
}

@keyframes ripple {
    0% { width: 76px; height: 76px; opacity: 1; }
    100% { width: 250px; height: 250px; opacity: 0; }
}
@keyframes pulseObj {
    from { transform: scale(1); opacity: 0.8; }
    to { transform: scale(1.05); opacity: 1; }
}

.instruction-text {
    margin-top: 1rem;
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* INPUT AREA */
.input-area {
    margin-top: 1.5rem;
    display: flex;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 100px;
    padding: 0.4rem;
    width: 90%;
    max-width: 400px;
    transition: all 0.3s;
}

.input-area:focus-within {
    border-color: var(--primary);
    background: rgba(255, 255, 255, 0.08);
}

#textInput {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: white;
    padding: 0 1rem;
    font-family: inherit;
    font-size: 0.95rem;
}

.send-button {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
}

.send-button:active {
    transform: scale(0.9);
}
