:root {
    --bg-color: #0f0f13;
    --panel-bg: rgba(30, 30, 40, 0.7);
    --panel-border: 1px solid rgba(255, 255, 255, 0.1);
    --primary: #6c5ce7;
    --primary-hover: #5649c0;
    --accent: #00cec9;
    --text-main: #ffffff;
    --text-muted: #a4b0be;
    --msg-user: #6c5ce7;
    --msg-ai: #2d3436;
    --danger: #ff7675;
    --success: #55efc4;
    --font-stack: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    background: var(--bg-color);
    background-image: radial-gradient(circle at 10% 20%, rgba(108, 92, 231, 0.1) 0%, transparent 20%),
                      radial-gradient(circle at 90% 80%, rgba(0, 206, 201, 0.1) 0%, transparent 20%);
    color: var(--text-main);
    font-family: var(--font-stack);
    height: 100vh;
    overflow: hidden;
}

/* --- Common Layout --- */
.container {
    max-width: 1200px;
    margin: 0 auto;
    height: 100%;
    display: flex;
    flex-direction: column;
    padding: 20px;
}

.hidden { display: none !important; }

.glass-panel {
    background: var(--panel-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: var(--panel-border);
    border-radius: 16px;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
}

.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s;
    color: white;
}
.btn-primary { background: var(--primary); }
.btn-primary:hover { background: var(--primary-hover); transform: translateY(-1px); }
.btn-danger { background: var(--danger); }
.btn-secondary { background: rgba(255,255,255,0.1); }
.btn-icon {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    transition: 0.2s;
}
.btn-icon:hover { background: rgba(255,255,255,0.1); color: white; }

/* --- Auth Screen --- */
.auth-box {
    max-width: 400px;
    margin: auto;
    padding: 40px;
    text-align: center;
}
.auth-tabs { display: flex; margin-bottom: 20px; border-bottom: 1px solid rgba(255,255,255,0.1); }
.auth-tab { flex: 1; padding: 10px; cursor: pointer; color: var(--text-muted); }
.auth-tab.active { color: var(--primary); border-bottom: 2px solid var(--primary); }

input {
    width: 100%;
    padding: 12px;
    margin-bottom: 15px;
    background: rgba(0,0,0,0.2);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 8px;
    color: white;
}
input:focus { outline: none; border-color: var(--primary); }

/* --- Top Bar --- */
.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 25px;
    margin-bottom: 20px;
}
.logo { font-size: 1.5rem; font-weight: bold; background: linear-gradient(45deg, var(--primary), var(--accent)); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }

/* --- Mode Selection --- */
.mode-cards {
    display: flex;
    gap: 20px;
    justify-content: center;
    margin-top: 5vh;
}
.mode-card {
    padding: 40px;
    width: 300px;
    text-align: center;
    cursor: pointer;
    transition: 0.3s;
    border: 1px solid transparent;
}
.mode-card:hover { transform: translateY(-5px); border-color: var(--primary); background: rgba(108, 92, 231, 0.1); }
.mode-card i { color: var(--primary); margin-bottom: 20px; }

/* --- Chat Interface (Unified) --- */
.chat-layout {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 120px); /* Full height minus header */
    position: relative;
}

/* Header inside chat */
.chat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    background: rgba(0,0,0,0.2);
    border-radius: 16px 16px 0 0;
}

.messages-area {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

/* Bubbles */
.message {
    max-width: 75%;
    padding: 12px 18px;
    border-radius: 18px;
    position: relative;
    line-height: 1.5;
    animation: fadeIn 0.3s ease;
}
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

.message.sent {
    align-self: flex-end;
    background: var(--msg-user);
    border-bottom-right-radius: 4px;
}

.message.received {
    align-self: flex-start;
    background: var(--msg-ai);
    border-bottom-left-radius: 4px;
}

.message-meta {
    font-size: 0.7rem;
    opacity: 0.6;
    margin-top: 5px;
    display: block;
    text-align: right;
}

/* Input Area */
.input-area {
    padding: 15px;
    background: rgba(0,0,0,0.2);
    border-radius: 0 0 16px 16px;
    display: flex;
    align-items: center;
    gap: 10px;
}
.input-area input { margin-bottom: 0; background: rgba(255,255,255,0.05); border: none; }
.recording-active { color: var(--danger); animation: pulse 1.5s infinite; }
@keyframes pulse { 0% { opacity: 1; } 50% { opacity: 0.5; } 100% { opacity: 1; } }

/* --- Settings Modal (Hidden by default) --- */
.modal-overlay {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.8);
    backdrop-filter: blur(5px);
    z-index: 100;
    display: flex;
    justify-content: center;
    align-items: center;
    animation: fadeIn 0.2s;
}
.modal-content {
    background: #1e1e26;
    padding: 25px;
    border-radius: 16px;
    width: 90%;
    max-width: 400px;
    border: 1px solid rgba(255,255,255,0.1);
}
.modal-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 20px;
}
.close-modal { cursor: pointer; font-size: 1.5rem; }

/* Select styling */
select {
    width: 100%;
    padding: 10px;
    margin-bottom: 15px;
    background: #2d3436;
    border: 1px solid #444;
    color: white;
    border-radius: 8px;
}

.checkbox-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 10px;
    cursor: pointer;
}

/* --- Listeners Grid --- */
.listeners-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
    padding: 20px 0;
}
.listener-card {
    padding: 15px;
    text-align: center;
    transition: 0.2s;
}
.listener-card:hover { transform: translateY(-3px); background: rgba(255,255,255,0.05); }

/* --- Notifications --- */
.notification {
    position: fixed; top: 20px; right: 20px;
    padding: 15px 25px;
    border-radius: 8px;
    color: white;
    z-index: 9999;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
}
