:root {
    --bg-color: #0f172a;
    --card-bg: rgba(30, 41, 59, 0.7);
    --primary: #3b82f6;
    --primary-hover: #2563eb;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --border-color: rgba(255, 255, 255, 0.1);
    --danger: #ef4444;
    --success: #10b981;
    --orb-size: 120px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background-image: radial-gradient(circle at 50% 0%, #1e293b 0%, #0f172a 70%);
}

.app-container {
    width: 100%;
    max-width: 600px;
    height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--card-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    overflow: hidden;
}

@media (min-width: 640px) {
    .app-container {
        height: 90vh;
        border-radius: 24px;
        border: 1px solid var(--border-color);
    }
}

/* Header */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
}

.header-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--primary);
    font-family: 'Outfit', sans-serif;
}

.header-logo i {
    font-size: 24px;
}

.header-logo h1 {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-main);
    letter-spacing: -0.5px;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.language-dropdown {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-main);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 8px 12px;
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    outline: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

.language-dropdown:hover {
    background: rgba(255, 255, 255, 0.1);
}

.language-dropdown option {
    background: var(--bg-color);
    color: var(--text-main);
}

.icon-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 18px;
    cursor: pointer;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.icon-btn:hover {
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.05);
}

.icon-btn.active {
    color: var(--primary);
}

/* Voice Interface Area */
.voice-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
    position: relative;
}

/* The Orb */
.orb-container {
    position: relative;
    width: var(--orb-size);
    height: var(--orb-size);
    margin-bottom: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.voice-orb {
    width: var(--orb-size);
    height: var(--orb-size);
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), #8b5cf6);
    border: none;
    color: white;
    font-size: 40px;
    cursor: pointer;
    z-index: 10;
    box-shadow: 0 10px 25px rgba(59, 130, 246, 0.5);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.voice-orb:hover {
    transform: scale(1.05);
    box-shadow: 0 15px 35px rgba(59, 130, 246, 0.6);
}

.voice-orb:active {
    transform: scale(0.95);
}

.voice-orb.listening {
    background: linear-gradient(135deg, var(--danger), #f43f5e);
    box-shadow: 0 10px 25px rgba(239, 68, 68, 0.5);
    animation: pulse-orb 1.5s infinite alternate;
}

.voice-orb.speaking {
    background: linear-gradient(135deg, var(--success), #34d399);
    box-shadow: 0 10px 25px rgba(16, 185, 129, 0.5);
    animation: pulse-orb 1s infinite alternate;
}

/* Pulse Rings */
.pulse-ring {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 2px solid var(--primary);
    opacity: 0;
    z-index: 1;
}

.voice-orb.listening ~ .pulse-1 {
    border-color: var(--danger);
    animation: ripple 2s infinite linear;
}

.voice-orb.listening ~ .pulse-2 {
    border-color: var(--danger);
    animation: ripple 2s infinite linear;
    animation-delay: 1s;
}

.voice-orb.speaking ~ .pulse-1 {
    border-color: var(--success);
    animation: ripple 1.5s infinite linear;
}

.voice-orb.speaking ~ .pulse-2 {
    border-color: var(--success);
    animation: ripple 1.5s infinite linear;
    animation-delay: 0.75s;
}

/* Transcripts */
.listening-status {
    font-size: 16px;
    color: var(--text-muted);
    margin-bottom: 30px;
    text-align: center;
    height: 24px;
    font-weight: 500;
    transition: color 0.3s;
}

.listening-status.listening {
    color: var(--danger);
}

.transcript-box {
    width: 100%;
    max-width: 450px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    text-align: center;
}

.user-text {
    font-size: 18px;
    color: var(--text-muted);
    font-style: italic;
    min-height: 27px;
}

.ai-text {
    font-size: 22px;
    color: var(--text-main);
    font-weight: 500;
    line-height: 1.4;
    min-height: 30px;
}

/* Fallback Keyboard Input */
.fallback-input {
    padding: 0 20px 10px 20px;
}

.chat-input-wrapper {
    display: flex;
    align-items: center;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-color);
    border-radius: 24px;
    padding: 5px 5px 5px 20px;
}

.text-prompt-input {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-main);
    font-size: 15px;
    outline: none;
}

.text-prompt-input::placeholder {
    color: var(--text-muted);
}

.send-btn {
    background: var(--primary);
    color: white;
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.send-btn:hover {
    background: var(--primary-hover);
}

.keyboard-toggle {
    display: flex;
    justify-content: center;
    padding: 10px;
}

.text-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 14px;
    cursor: pointer;
    padding: 8px 16px;
    border-radius: 16px;
    transition: all 0.2s;
}

.text-btn:hover {
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.05);
}

.footer-text {
    text-align: center;
    font-size: 11px;
    color: var(--text-muted);
    padding: 15px;
    opacity: 0.7;
}

/* Thinking dots animation */
.thinking-dots span {
    display: inline-block;
    animation: bounce-dot 1.2s infinite;
    font-size: 28px;
    font-weight: bold;
    color: var(--primary);
}
.thinking-dots span:nth-child(2) { animation-delay: 0.2s; }
.thinking-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes bounce-dot {
    0%, 80%, 100% { transform: translateY(0); opacity: 0.3; }
    40%            { transform: translateY(-8px); opacity: 1; }
}

/* Language optgroup styling */
.language-dropdown optgroup {
    background: #1e293b;
    color: var(--text-muted);
    font-size: 12px;
}

/* Animations */
@keyframes pulse-orb {
    0% { transform: scale(0.95); }
    100% { transform: scale(1.05); }
}

@keyframes ripple {
    0% {
        transform: scale(1);
        opacity: 0.8;
    }
    100% {
        transform: scale(2);
        opacity: 0;
    }
}
