:root {
    --bg-main: #06070d;
    --bg-glass: rgba(13, 16, 27, 0.7);
    --border-glass: rgba(255, 255, 255, 0.08);
    --glow-color: rgba(99, 102, 241, 0.15);
    --accent-blue: #6366f1;
    --accent-purple: #a855f7;
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --msg-user: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
    --msg-agent: rgba(30, 41, 59, 0.7);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Outfit', sans-serif;
    -webkit-tap-highlight-color: transparent;
}

body {
    background-color: var(--bg-main);
    background-image: 
        radial-gradient(at 0% 0%, rgba(99, 102, 241, 0.1) 0px, transparent 50%),
        radial-gradient(at 100% 100%, rgba(168, 85, 247, 0.08) 0px, transparent 50%);
    color: var(--text-primary);
    height: 100vh;
    height: 100dvh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

/* Glassmorphism Panel helper */
.glass-panel {
    background: var(--bg-glass);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border-glass);
    border-radius: 24px;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
}

/* Login Page Styling */
#login-container {
    width: 90%;
    max-width: 400px;
    padding: 40px 32px;
    position: relative;
    overflow: hidden;
}

.logo-area {
    text-align: center;
    margin-bottom: 32px;
    position: relative;
}

.glow-orb {
    position: absolute;
    top: -20px;
    left: 50%;
    transform: translateX(-50%);
    width: 80px;
    height: 80px;
    background: radial-gradient(circle, var(--accent-blue) 0%, transparent 70%);
    opacity: 0.6;
    filter: blur(10px);
}

.logo-area h1 {
    font-size: 2.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, #fff 0%, #c7d2fe 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.logo-area p {
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin-top: 4px;
}

.input-group {
    margin-bottom: 20px;
}

.input-group label {
    display: block;
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.input-group input {
    width: 100%;
    padding: 14px 16px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-glass);
    border-radius: 12px;
    color: #fff;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.input-group input:focus {
    outline: none;
    border-color: var(--accent-blue);
    background: rgba(255, 255, 255, 0.05);
    box-shadow: 0 0 10px rgba(99, 102, 241, 0.25);
}

.btn-primary {
    width: 100%;
    padding: 14px;
    background: var(--msg-user);
    border: none;
    border-radius: 12px;
    color: #fff;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: transform 0.2s ease, opacity 0.2s ease;
}

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

.error-msg {
    color: #ef4444;
    font-size: 0.9rem;
    margin-top: 12px;
    text-align: center;
}

/* Chat App Page Styling */
#app-container {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.glass-header {
    background: var(--bg-glass);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-glass);
    padding: 16px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 10;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
}

.avatar-glow {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
    box-shadow: 0 0 12px rgba(99, 102, 241, 0.5);
}

.user-profile h2 {
    font-size: 1.1rem;
    font-weight: 600;
}

.status-indicator {
    font-size: 0.75rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 6px;
}

.status-indicator::before {
    content: '';
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #10b981;
    box-shadow: 0 0 6px #10b981;
}

.status-indicator.busy::before {
    background: #f59e0b;
    box-shadow: 0 0 8px #f59e0b;
    animation: statusPulse 1s infinite alternate;
}

@keyframes statusPulse {
    0% { transform: scale(0.9); opacity: 0.6; }
    100% { transform: scale(1.2); opacity: 1; }
}

.header-actions {
    display: flex;
    gap: 8px;
}

.icon-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-glass);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    color: #fff;
    font-size: 1.1rem;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: background 0.2s ease;
}

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

/* Chat Messages Layout */
.messages-area {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    background: rgba(0, 0, 0, 0.1);
}

.message-bubble {
    max-width: 80%;
    padding: 14px 18px;
    border-radius: 20px;
    font-size: 0.98rem;
    line-height: 1.45;
    position: relative;
    animation: slideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.message-bubble.user {
    align-self: flex-end;
    background: var(--msg-user);
    color: #fff;
    border-bottom-right-radius: 4px;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.2);
}

.message-bubble.agent {
    align-self: flex-start;
    background: var(--msg-agent);
    color: var(--text-primary);
    border-bottom-left-radius: 4px;
    border: 1px solid var(--border-glass);
}

.msg-meta {
    display: block;
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.5);
    margin-top: 6px;
    text-align: right;
}

.message-bubble.agent .msg-meta {
    color: var(--text-secondary);
}

/* Footer & Input Style */
.glass-footer {
    background: var(--bg-glass);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-top: 1px solid var(--border-glass);
    padding: 16px 20px;
    padding-bottom: calc(16px + env(safe-area-inset-bottom));
}

#chat-form {
    display: flex;
    gap: 12px;
}

#chat-input {
    flex: 1;
    padding: 14px 18px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-glass);
    border-radius: 24px;
    color: #fff;
    font-size: 1rem;
    transition: all 0.3s ease;
}

#chat-input:focus {
    outline: none;
    border-color: var(--accent-blue);
    background: rgba(255, 255, 255, 0.05);
}

.send-btn {
    background: var(--msg-user);
    border: none;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    color: #fff;
    font-size: 1.2rem;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: transform 0.2s ease;
}

.send-btn:active {
    transform: scale(0.92);
}

.hidden {
    display: none !important;
}

.voice-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-glass);
    width: 48px;
    height: 48px;
    border-radius: 50%;
    color: #fff;
    font-size: 1.2rem;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: all 0.3s ease;
}

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

.voice-btn.listening {
    background: #ef4444;
    border-color: #f87171;
    box-shadow: 0 0 12px rgba(239, 68, 68, 0.6);
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.08); }
    100% { transform: scale(1); }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
