/* Reset & Global Styles */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

:root {
    --bg-gradient: radial-gradient(circle at center, #170d2e 0%, #060309 100%);
    --panel-bg: rgba(18, 10, 36, 0.7);
    --border-color: rgba(147, 112, 219, 0.2);
    --text-primary: #ffffff;
    --text-secondary: rgba(255, 255, 255, 0.6);
    --accent-purple: #8a2be2;
    --accent-glow: rgba(138, 43, 226, 0.5);
    --success-green: #39FF14;
    --warning-orange: #FF5F1F;
    --error-red: #FF3131;
    --font-outfit: 'Outfit', sans-serif;
    --header-height: 70px;
    --safe-area-top: env(safe-area-inset-top, 0px);
    --safe-area-bottom: env(safe-area-inset-bottom, 0px);
}

body {
    font-family: var(--font-outfit);
    background: #060309;
    color: var(--text-primary);
    overflow: hidden;
    height: 100vh;
    width: 100vw;
}

/* App Layout Container */
.app-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    width: 100%;
    background: var(--bg-gradient);
    position: relative;
    padding-top: var(--safe-area-top);
    padding-bottom: var(--safe-area-bottom);
}

/* Header Component */
.app-header {
    height: var(--header-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    border-bottom: 1px solid var(--border-color);
    z-index: 10;
}

.icon-button {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    border-radius: 50%;
    width: 42px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.icon-button:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: scale(1.05);
    border-color: rgba(255, 255, 255, 0.4);
}

.icon-button:active {
    transform: scale(0.95);
}

.header-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    font-size: 16px;
    letter-spacing: 0.5px;
    cursor: pointer;
    padding: 6px 12px;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.header-title .badge {
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 4px;
    background: rgba(138, 43, 226, 0.3);
    color: #c9a0ff;
    font-weight: 700;
    letter-spacing: 1px;
}

/* Main Voice Screen Layout */
.voice-chat-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    padding: 40px 24px 60px 24px;
    position: relative;
}

/* 3D-Like Glassmorphic Orb Container */
.orb-container {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
}

.voice-orb {
    width: 180px;
    height: 180px;
    border-radius: 50%;
    position: relative;
    cursor: pointer;
    background: radial-gradient(circle at 35% 35%, #ff80b5, #8a2be2 50%, #090317);
    box-shadow: 0 0 45px rgba(138, 43, 226, 0.4), 
                inset 0 0 25px rgba(255, 255, 255, 0.3),
                inset -10px -10px 30px rgba(0, 0, 0, 0.8);
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    animation: breathe 5s infinite ease-in-out;
}

.orb-core {
    position: absolute;
    top: 15%;
    left: 15%;
    width: 70%;
    height: 70%;
    border-radius: 50%;
    background: radial-gradient(circle at center, rgba(255, 255, 255, 0.15) 0%, transparent 80%);
    filter: blur(5px);
}

.orb-glow {
    position: absolute;
    top: -5px;
    left: -5px;
    right: -5px;
    bottom: -5px;
    border-radius: 50%;
    background: radial-gradient(circle at center, transparent 60%, rgba(255, 128, 181, 0.3) 100%);
    opacity: 0.6;
    animation: glow-rotate 8s infinite linear;
}

/* Pulse states for speaking/listening */
.voice-orb.connecting {
    background: radial-gradient(circle at 35% 35%, #ffd27f, #ff5f1f 50%, #170701);
    box-shadow: 0 0 45px rgba(255, 95, 31, 0.4), 
                inset 0 0 25px rgba(255, 255, 255, 0.2);
    animation: connecting-pulse 1.5s infinite ease-in-out;
}

.voice-orb.listening {
    background: radial-gradient(circle at 35% 35%, #7ffdff, #1f9aff 50%, #010c17);
    box-shadow: 0 0 50px rgba(31, 154, 255, 0.5), 
                inset 0 0 30px rgba(255, 255, 255, 0.4);
    animation: listening-wave 2s infinite ease-in-out;
}

.voice-orb.speaking {
    background: radial-gradient(circle at 35% 35%, #ff7ffd, #e11fff 50%, #130117);
    box-shadow: 0 0 65px rgba(225, 31, 255, 0.6), 
                inset 0 0 30px rgba(255, 255, 255, 0.4);
    animation: speaking-dynamic 0.8s infinite ease-in-out;
}

/* Animations Definitions */
@keyframes breathe {
    0%, 100% { transform: scale(1); filter: brightness(1); }
    50% { transform: scale(1.05); filter: brightness(1.1); box-shadow: 0 0 55px rgba(138, 43, 226, 0.6), inset 0 0 25px rgba(255, 255, 255, 0.35); }
}

@keyframes glow-rotate {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes connecting-pulse {
    0%, 100% { transform: scale(1); opacity: 0.9; }
    50% { transform: scale(1.08); opacity: 1; box-shadow: 0 0 60px rgba(255, 95, 31, 0.7); }
}

@keyframes listening-wave {
    0%, 100% { transform: scale(1) translateY(0); }
    50% { transform: scale(1.06) translateY(-4px); box-shadow: 0 0 65px rgba(31, 154, 255, 0.7); }
}

@keyframes speaking-dynamic {
    0%, 100% { transform: scale(1.02); }
    50% { transform: scale(1.12); box-shadow: 0 0 75px rgba(225, 31, 255, 0.8); }
}

/* Live Transcription Panel */
.transcription-container {
    width: 100%;
    max-width: 500px;
    min-height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 0 10px;
    margin: 20px 0;
}

.transcription-text {
    font-size: 18px;
    line-height: 1.5;
    font-weight: 300;
    color: var(--text-secondary);
    letter-spacing: 0.3px;
    max-height: 120px;
    overflow-y: auto;
    transition: color 0.3s ease;
}

.transcription-text.active {
    color: var(--text-primary);
    font-weight: 400;
}

/* Dotted Oval Status Indicator Box */
.status-wrapper {
    margin-bottom: 30px;
}

.status-indicator-box {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 24px;
    border-radius: 30px;
    border: 1px dashed var(--border-color);
    background: rgba(18, 10, 36, 0.3);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--text-secondary);
    box-shadow: 0 0 8px var(--text-secondary);
    transition: all 0.3s ease;
}

.status-dot.connecting {
    background-color: var(--warning-orange);
    box-shadow: 0 0 12px var(--warning-orange);
}

.status-dot.connected {
    background-color: var(--success-green);
    box-shadow: 0 0 12px var(--success-green);
}

.status-dot.disconnected {
    background-color: var(--error-red);
    box-shadow: 0 0 12px var(--error-red);
}

.status-label {
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: var(--text-secondary);
}

/* Dynamic Purple Mic Button in Control Actions */
.control-actions {
    display: flex;
    justify-content: center;
    width: 100%;
}

.mic-button {
    background: radial-gradient(circle at center, #8a2be2 0%, #591ab3 100%);
    border: none;
    border-radius: 50%;
    width: 76px;
    height: 76px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-primary);
    cursor: pointer;
    box-shadow: 0 0 30px rgba(138, 43, 226, 0.4),
                inset 0 4px 8px rgba(255, 255, 255, 0.3);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.mic-button::before {
    content: '';
    position: absolute;
    top: -6px;
    left: -6px;
    right: -6px;
    bottom: -6px;
    border-radius: 50%;
    border: 1px solid rgba(138, 43, 226, 0.25);
    opacity: 0;
    transform: scale(0.9);
    transition: all 0.3s ease;
}

.mic-button:hover {
    transform: scale(1.05);
    box-shadow: 0 0 40px rgba(138, 43, 226, 0.6);
}

.mic-button.active {
    background: radial-gradient(circle at center, #ea005a 0%, #a3003b 100%);
    box-shadow: 0 0 45px rgba(234, 0, 90, 0.6);
}

.mic-button.active::before {
    opacity: 1;
    transform: scale(1);
    border-color: rgba(234, 0, 90, 0.4);
    animation: ripple 2s infinite ease-out;
}

.mic-button:active {
    transform: scale(0.95);
}

@keyframes ripple {
    0% { transform: scale(1); opacity: 1; }
    100% { transform: scale(1.3); opacity: 0; }
}

/* Settings Drawer Sliding Component */
.settings-drawer {
    position: absolute;
    top: 0;
    right: -360px;
    width: 360px;
    height: 100%;
    background: #0c0817;
    border-left: 1px solid var(--border-color);
    box-shadow: -10px 0 30px rgba(0, 0, 0, 0.5);
    z-index: 100;
    display: flex;
    flex-direction: column;
    transition: right 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.settings-drawer.open {
    right: 0;
}

.drawer-header {
    height: var(--header-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    border-bottom: 1px solid var(--border-color);
}

.drawer-header h2 {
    font-size: 18px;
    font-weight: 600;
    letter-spacing: 0.5px;
    color: var(--text-primary);
}

.drawer-body {
    flex: 1;
    overflow-y: auto;
    padding: 24px 20px;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.input-group label {
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
}

.input-group input[type="text"],
.input-group input[type="password"],
.input-group textarea {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    padding: 12px 14px;
    font-family: var(--font-outfit);
    font-size: 14px;
    transition: all 0.3s ease;
}

.input-group input:focus,
.input-group textarea:focus {
    outline: none;
    border-color: var(--accent-purple);
    box-shadow: 0 0 8px rgba(138, 43, 226, 0.25);
    background: rgba(255, 255, 255, 0.05);
}

.input-group small {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.3);
}

.action-row {
    display: flex;
    gap: 12px;
    margin-top: 10px;
}

.btn {
    flex: 1;
    padding: 14px;
    border-radius: 8px;
    font-family: var(--font-outfit);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    border: none;
    text-align: center;
}

.btn-primary {
    background: var(--accent-purple);
    color: var(--text-primary);
    box-shadow: 0 4px 12px rgba(138, 43, 226, 0.3);
}

.btn-primary:hover {
    background: #9d42f5;
    box-shadow: 0 4px 16px rgba(138, 43, 226, 0.5);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
}

.btn:active {
    transform: scale(0.98);
}

/* Drawer Backdrop Overlay */
.overlay-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 50;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s ease;
}

.overlay-backdrop.open {
    opacity: 1;
    pointer-events: auto;
}

/* Mobile responsive adaptations */
@media (max-width: 480px) {
    .settings-drawer {
        width: 85%;
        right: -85%;
    }
    
    .voice-orb {
        width: 150px;
        height: 150px;
    }
}
