/* ==========================================================================
   Mebha TalkZ - Minimal, Classy & Ultra-Rich UI Design System
   Includes 3D Rotating Splash Screen Intro, Login / Signup / Google Auth Screen,
   and Dashboard Navigation System.
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Outfit:wght@400;500;600;700;800;900&family=Plus+Jakarta+Sans:wght@500;600;700;800&display=swap');

/* Default Rich Light Theme: Porcelain Alabaster & Royal Sapphire */
:root {
    --bg-main: #f8fafc;
    --bg-gradient: radial-gradient(at 0% 0%, rgba(30, 58, 138, 0.06) 0px, transparent 50%),
                    radial-gradient(at 100% 100%, rgba(13, 148, 136, 0.05) 0px, transparent 50%);
    
    --app-frame-bg: #ffffff;
    --header-bg: rgba(255, 255, 255, 0.94);
    --card-bg: #ffffff;
    --card-hover-bg: #f1f5f9;
    --input-bg: #f8fafc;
    --nav-bg: rgba(255, 255, 255, 0.96);

    --primary-color: #1e3a8a;
    --primary-gradient: linear-gradient(135deg, #0f172a 0%, #1e3a8a 50%, #2563eb 100%);
    --primary-glow: rgba(30, 58, 138, 0.25);

    --accent-gold: #d4af37;
    --accent-teal: #0d9488;
    --accent-rose: #e11d48;

    --text-main: #0f172a;
    --text-muted: #64748b;
    --text-on-primary: #ffffff;

    --border-subtle: rgba(15, 23, 42, 0.08);
    --border-accent: rgba(212, 175, 55, 0.3);

    --radius-sm: 12px;
    --radius-md: 18px;
    --radius-lg: 26px;
    --radius-full: 9999px;

    --shadow-sm: 0 2px 8px rgba(15, 23, 42, 0.04);
    --shadow-md: 0 10px 30px -5px rgba(15, 23, 42, 0.08);
    --shadow-lg: 0 20px 40px -10px rgba(15, 23, 42, 0.12);
    --shadow-gold: 0 4px 20px rgba(212, 175, 55, 0.3);

    --font-heading: 'Outfit', 'Plus Jakarta Sans', sans-serif;
    --font-body: 'Inter', sans-serif;
}

/* Ultra-Rich Dark Theme: Obsidian Black & Royal Champagne Gold */
[data-theme="dark"] {
    --bg-main: #07090e;
    --bg-gradient: radial-gradient(at 0% 0%, rgba(212, 175, 55, 0.08) 0px, transparent 50%),
                    radial-gradient(at 100% 100%, rgba(6, 182, 212, 0.05) 0px, transparent 50%);
    
    --app-frame-bg: #0d1117;
    --header-bg: rgba(13, 17, 23, 0.94);
    --card-bg: #161b22;
    --card-hover-bg: #1f242d;
    --input-bg: #0d1117;
    --nav-bg: rgba(13, 17, 23, 0.96);

    --primary-color: #d4af37;
    --primary-gradient: linear-gradient(135deg, #d4af37 0%, #aa771c 50%, #fcf6ba 100%);
    --primary-glow: rgba(212, 175, 55, 0.35);

    --accent-gold: #f3e5ab;
    --accent-teal: #06b6d4;
    --accent-rose: #f43f5e;

    --text-main: #f8fafc;
    --text-muted: #8b949e;
    --text-on-primary: #07090e;

    --border-subtle: rgba(255, 255, 255, 0.08);
    --border-accent: rgba(212, 175, 55, 0.4);

    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 12px 35px rgba(0, 0, 0, 0.6);
    --shadow-lg: 0 24px 50px rgba(0, 0, 0, 0.8);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: var(--font-body);
    -webkit-font-smoothing: antialiased;
    transition: background-color 0.3s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.3s ease, color 0.2s ease, box-shadow 0.3s ease, transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

body {
    background: var(--bg-main);
    background-image: var(--bg-gradient);
    background-attachment: fixed;
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 0;
    overflow-x: hidden;
}

/* App Container Frame */
.app-container {
    width: 100%;
    max-width: 480px;
    height: 100vh;
    max-height: 920px;
    background: var(--app-frame-bg);
    border: 1px solid var(--border-subtle);
    border-radius: 0;
    display: flex;
    flex-direction: column;
    position: relative;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

@media (min-width: 600px) {
    .app-container {
        border-radius: var(--radius-lg);
        height: 92vh;
        margin: 20px 0;
        border-color: var(--border-accent);
    }
}

/* ==========================================================================
   1. 3D ROTATING SPLASH SCREEN INTRO
   ========================================================================== */

.splash-screen {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: var(--app-frame-bg);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 30px;
    text-align: center;
    animation: splashFadeIn 0.5s ease-out;
}

.splash-screen.fade-out {
    animation: splashFadeOut 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes splashFadeIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

@keyframes splashFadeOut {
    to { opacity: 0; transform: scale(1.05); pointer-events: none; visibility: hidden; }
}

/* 3D Rotating Logo Frame */
.splash-logo-container {
    position: relative;
    width: 110px;
    height: 110px;
    margin-bottom: 24px;
    perspective: 800px;
}

.splash-logo-ring {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    border: 3px solid transparent;
    border-top-color: var(--primary-color);
    border-bottom-color: var(--accent-gold);
    border-radius: 50%;
    animation: rotate3DRing 3s linear infinite;
}

@keyframes rotate3DRing {
    0% { transform: rotateX(0deg) rotateY(0deg) rotateZ(0deg); }
    100% { transform: rotateX(360deg) rotateY(180deg) rotateZ(360deg); }
}

.splash-logo-core {
    position: absolute;
    top: 15px; left: 15px; right: 15px; bottom: 15px;
    background: var(--primary-gradient);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 38px;
    color: var(--text-on-primary);
    box-shadow: var(--shadow-gold);
    animation: pulseLogoCore 2s ease-in-out infinite alternate;
}

@keyframes pulseLogoCore {
    0% { transform: scale(0.95); box-shadow: 0 0 15px var(--primary-glow); }
    100% { transform: scale(1.05); box-shadow: 0 0 35px var(--primary-glow); }
}

.splash-title {
    font-family: var(--font-heading);
    font-size: 32px;
    font-weight: 900;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 6px;
    letter-spacing: -0.5px;
}

.splash-tagline {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 30px;
    max-width: 280px;
    line-height: 1.4;
}

.splash-loader-bar {
    width: 180px;
    height: 4px;
    background: var(--border-subtle);
    border-radius: var(--radius-full);
    overflow: hidden;
    position: relative;
}

.splash-loader-progress {
    width: 0%;
    height: 100%;
    background: var(--primary-gradient);
    border-radius: var(--radius-full);
    animation: loadProgress 2.2s ease-in-out forwards;
}

@keyframes loadProgress {
    0% { width: 0%; }
    50% { width: 65%; }
    100% { width: 100%; }
}

/* ==========================================================================
   2. AUTHENTICATION SCREEN (LOGIN / CREATE ACCOUNT / GOOGLE AUTH)
   ========================================================================== */

.auth-screen {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: var(--app-frame-bg);
    z-index: 900;
    display: none;
    flex-direction: column;
    padding: 24px;
    overflow-y: auto;
}

.auth-screen.active {
    display: flex;
    animation: authSlideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

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

.auth-header-card {
    text-align: center;
    margin-bottom: 24px;
    margin-top: 10px;
}

.auth-brand-logo {
    width: 60px;
    height: 60px;
    background: var(--primary-gradient);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 30px;
    color: var(--text-on-primary);
    margin: 0 auto 12px auto;
    box-shadow: var(--shadow-sm);
}

.auth-title {
    font-family: var(--font-heading);
    font-size: 26px;
    font-weight: 900;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 4px;
}

.auth-subtitle {
    font-size: 13px;
    color: var(--text-muted);
}

.auth-tabs-nav {
    display: flex;
    background: var(--card-bg);
    border-radius: var(--radius-md);
    padding: 4px;
    margin-bottom: 20px;
    border: 1px solid var(--border-subtle);
}

.auth-tab-btn {
    flex: 1;
    background: none;
    border: none;
    color: var(--text-muted);
    padding: 10px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: all 0.2s;
}

.auth-tab-btn.active {
    background: var(--primary-gradient);
    color: var(--text-on-primary);
    box-shadow: var(--shadow-sm);
}

.auth-form {
    display: none;
    flex-direction: column;
    gap: 14px;
}

.auth-form.active {
    display: flex;
}

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

.input-label {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.auth-input {
    background: var(--input-bg);
    border: 1px solid var(--border-subtle);
    color: var(--text-main);
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    outline: none;
}

.auth-input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 12px var(--primary-glow);
}

.auth-divider {
    display: flex;
    align-items: center;
    margin: 16px 0;
    color: var(--text-muted);
    font-size: 11px;
}

.auth-divider::before, .auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border-subtle);
}

.auth-divider span {
    padding: 0 10px;
}

/* Google Auth Button */
.google-auth-btn {
    background: var(--card-bg);
    border: 1px solid var(--border-subtle);
    color: var(--text-main);
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    cursor: pointer;
    box-shadow: var(--shadow-sm);
    transition: transform 0.2s, box-shadow 0.2s;
}

.google-auth-btn:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
    border-color: var(--primary-color);
}

.google-icon {
    width: 20px;
    height: 20px;
}

/* Quick Demo Switcher Section in Auth */
.demo-auth-box {
    margin-top: 20px;
    background: var(--card-bg);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 14px;
    text-align: center;
}

.demo-auth-box h5 {
    font-size: 12px;
    color: var(--primary-color);
    margin-bottom: 8px;
    font-weight: 800;
}

/* ==========================================================================
   MAIN DASHBOARD NAVBAR & VIEWS
   ========================================================================== */

.app-header {
    height: 72px;
    padding: 12px 22px;
    background: var(--header-bg);
    backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    justify-content: space-between;
    z-index: 10;
}

.brand-section { display: flex; align-items: center; gap: 12px; }

.brand-logo-icon {
    width: 42px;
    height: 42px;
    background: var(--primary-gradient);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: var(--text-on-primary);
    box-shadow: var(--shadow-sm);
    position: relative;
    overflow: hidden;
}

.brand-logo-icon::after {
    content: '';
    position: absolute;
    top: -50%; left: -50%;
    width: 200%; height: 200%;
    background: linear-gradient(60deg, transparent 30%, rgba(255, 255, 255, 0.25) 50%, transparent 70%);
    transform: rotate(25deg);
    animation: shineSheen 5s infinite;
}

@keyframes shineSheen {
    0% { transform: translateX(-100%) rotate(25deg); }
    20%, 100% { transform: translateX(100%) rotate(25deg); }
}

.brand-name {
    font-family: var(--font-heading);
    font-size: 23px;
    font-weight: 900;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -0.5px;
}

.header-controls { display: flex; align-items: center; gap: 10px; }

.theme-toggle-btn {
    background: var(--card-bg);
    border: 1px solid var(--border-subtle);
    color: var(--text-main);
    width: 38px;
    height: 38px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 16px;
    box-shadow: var(--shadow-sm);
}

.theme-toggle-btn:hover {
    transform: rotate(15deg) scale(1.08);
    border-color: var(--primary-color);
}

.header-user-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--card-bg);
    padding: 4px 12px 4px 4px;
    border-radius: var(--radius-full);
    border: 1px solid var(--border-subtle);
    box-shadow: var(--shadow-sm);
    cursor: pointer;
}

.header-avatar {
    width: 34px;
    height: 34px;
    border-radius: var(--radius-full);
    object-fit: cover;
}

.header-user-meta h4 { font-size: 12px; font-weight: 700; line-height: 1.2; }
.header-user-meta p { font-size: 10px; color: var(--text-muted); }

/* Demo Switcher Bar */
.demo-switcher-bar {
    background: var(--card-bg);
    padding: 8px 20px;
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 12px;
}

.demo-label { color: var(--primary-color); font-weight: 700; font-family: var(--font-heading); }

.demo-select {
    background: var(--input-bg);
    color: var(--text-main);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    padding: 5px 12px;
    font-size: 12px;
    outline: none;
    cursor: pointer;
    font-weight: 600;
}

/* Main App Content Container */
.app-content {
    flex: 1;
    overflow-y: auto;
    position: relative;
    padding-bottom: 75px;
}

.app-view {
    display: none;
    padding: 20px;
    animation: elegantFade 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.app-view.active { display: block; }

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

/* Bottom Navigation Bar */
.bottom-nav {
    position: absolute;
    bottom: 0; left: 0; right: 0;
    height: 70px;
    background: var(--nav-bg);
    backdrop-filter: blur(16px);
    border-top: 1px solid var(--border-subtle);
    display: flex;
    justify-content: space-around;
    align-items: center;
    z-index: 10;
}

.nav-item {
    background: none;
    border: none;
    color: var(--text-muted);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
    padding: 8px 18px;
    border-radius: var(--radius-md);
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.nav-icon { font-size: 20px; transition: transform 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275); }

.nav-item.active { color: var(--primary-color); background: rgba(30, 58, 138, 0.08); }
[data-theme="dark"] .nav-item.active { background: rgba(212, 175, 55, 0.1); }
.nav-item.active .nav-icon { transform: translateY(-3px) scale(1.18); }

/* Chats View */
.chat-item-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    background: var(--card-bg);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    margin-bottom: 12px;
    cursor: pointer;
    box-shadow: var(--shadow-sm);
}

.chat-item-card:hover {
    background: var(--card-hover-bg);
    border-color: var(--border-accent);
    transform: translateY(-3px) scale(1.01);
    box-shadow: var(--shadow-md);
}

.avatar-container { position: relative; }

.user-avatar {
    width: 50px;
    height: 50px;
    border-radius: var(--radius-full);
    object-fit: cover;
    border: 2px solid var(--border-subtle);
}

.online-badge {
    width: 12px; height: 12px;
    border-radius: 50%;
    position: absolute; bottom: 2px; right: 2px;
    border: 2px solid var(--card-bg);
}

.online-badge.online { background: #10b981; }
.online-badge.offline { background: #94a3b8; }

.chat-item-info { flex: 1; }

.chat-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}

.chat-user-name { font-size: 15px; font-weight: 800; }
.country-flag { font-size: 14px; }
.chat-time { font-size: 11px; color: var(--text-muted); }

.chat-item-sub { display: flex; align-items: center; gap: 8px; }

.language-pill {
    background: rgba(30, 58, 138, 0.08);
    color: var(--primary-color);
    font-size: 10px;
    padding: 3px 8px;
    border-radius: var(--radius-full);
    font-weight: 800;
}

[data-theme="dark"] .language-pill {
    background: rgba(212, 175, 55, 0.15);
    color: var(--accent-gold);
}

.chat-preview-text {
    font-size: 13px;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 200px;
}

/* Chat Room View */
#chat-room-view {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: var(--app-frame-bg);
    z-index: 20;
    display: none;
    flex-direction: column;
    padding: 0;
}

#chat-room-view.active {
    display: flex;
    animation: roomSlideIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes roomSlideIn {
    from { opacity: 0; transform: translateX(20px); }
    to { opacity: 1; transform: translateX(0); }
}

.chat-room-header {
    height: 72px;
    padding: 10px 18px;
    background: var(--header-bg);
    backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.back-btn {
    background: var(--card-bg);
    border: 1px solid var(--border-subtle);
    color: var(--text-main);
    width: 36px; height: 36px;
    border-radius: var(--radius-full);
    display: flex; align-items: center; justify-content: center;
    font-size: 18px; cursor: pointer;
    box-shadow: var(--shadow-sm);
}

.back-btn:hover { transform: translateX(-2px); }

.room-user-profile { display: flex; align-items: center; gap: 10px; flex: 1; margin-left: 8px; }

.room-avatar-img {
    width: 42px; height: 42px;
    border-radius: var(--radius-full);
    object-fit: cover;
}

.room-info h4 { font-size: 15px; font-weight: 800; }
.room-info p { font-size: 11px; color: var(--text-muted); }

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

.icon-btn {
    background: var(--card-bg);
    border: 1px solid var(--border-subtle);
    color: var(--text-main);
    width: 38px; height: 38px;
    border-radius: var(--radius-full);
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    box-shadow: var(--shadow-sm);
}

.icon-btn:hover {
    background: var(--primary-color);
    color: var(--text-on-primary);
    border-color: var(--primary-color);
    transform: scale(1.08);
}

/* Chat Messages Stream */
.messages-container {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.chat-welcome-banner {
    text-align: center;
    padding: 22px 16px;
    background: var(--card-bg);
    border-radius: var(--radius-md);
    margin-bottom: 16px;
    border: 1px solid var(--border-subtle);
    box-shadow: var(--shadow-sm);
}

.banner-avatar {
    width: 64px; height: 64px;
    border-radius: 50%;
    margin-bottom: 10px;
    border: 2px solid var(--border-accent);
}

.translation-notice-badge {
    margin-top: 12px;
    font-size: 12px;
    background: rgba(13, 148, 136, 0.08);
    color: var(--accent-teal);
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    border: 1px solid rgba(13, 148, 136, 0.25);
    line-height: 1.4;
}

.message-bubble-wrapper {
    display: flex;
    align-items: flex-end;
    gap: 6px;
    max-width: 85%;
    animation: bubbleFade 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

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

.message-bubble-wrapper.me { align-self: flex-end; flex-direction: row-reverse; }
.message-bubble-wrapper.partner { align-self: flex-start; }

.message-bubble {
    padding: 14px 18px;
    border-radius: 20px;
    font-size: 14px;
    line-height: 1.5;
    cursor: pointer;
    position: relative;
    box-shadow: var(--shadow-sm);
}

.message-bubble-wrapper.me .message-bubble {
    background: var(--primary-gradient);
    color: var(--text-on-primary);
    border-bottom-right-radius: 4px;
}

.message-bubble-wrapper.partner .message-bubble {
    background: var(--card-bg);
    border: 1px solid var(--border-subtle);
    color: var(--text-main);
    border-bottom-left-radius: 4px;
}

.message-meta-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 6px;
    gap: 10px;
    font-size: 10px;
    opacity: 0.85;
}

.translation-hint-pill {
    background: rgba(255, 255, 255, 0.2);
    padding: 2px 7px;
    border-radius: 6px;
    font-weight: 700;
}

.msg-action-trigger {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 16px;
    opacity: 0;
}

.message-bubble-wrapper:hover .msg-action-trigger { opacity: 1; }

.message-media-img {
    max-width: 220px;
    border-radius: var(--radius-sm);
    margin-bottom: 6px;
    cursor: pointer;
    box-shadow: var(--shadow-sm);
}

.voice-player {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 170px;
}

.voice-play-btn {
    width: 34px; height: 34px;
    border-radius: 50%;
    background: #ffffff;
    color: #0f172a;
    border: none;
    font-weight: bold;
    cursor: pointer;
    box-shadow: var(--shadow-sm);
}

.voice-waveform {
    display: flex;
    align-items: center;
    gap: 3px;
    height: 20px;
}

.voice-waveform span {
    width: 3px; height: 100%;
    background: rgba(255, 255, 255, 0.8);
    border-radius: 3px;
    animation: wave 1s infinite ease-in-out;
}

@keyframes wave {
    0%, 100% { height: 4px; }
    50% { height: 18px; }
}

/* Chat Input Bar */
.chat-input-bar {
    padding: 12px 18px;
    background: var(--header-bg);
    backdrop-filter: blur(16px);
    border-top: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    gap: 8px;
}

.input-action-btn {
    background: var(--card-bg);
    border: 1px solid var(--border-subtle);
    color: var(--text-muted);
    width: 38px; height: 38px;
    border-radius: var(--radius-full);
    display: flex; align-items: center; justify-content: center;
    font-size: 18px; cursor: pointer;
    box-shadow: var(--shadow-sm);
}

.input-action-btn:hover { color: var(--primary-color); border-color: var(--primary-color); }
.input-action-btn.recording { color: var(--accent-rose); animation: pulse 1s infinite; }

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

.chat-input-field {
    flex: 1;
    background: var(--input-bg);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-full);
    padding: 11px 18px;
    color: var(--text-main);
    font-size: 14px;
    outline: none;
}

.chat-input-field:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 12px var(--primary-glow);
}

.chat-send-btn {
    background: var(--primary-gradient);
    border: none;
    color: var(--text-on-primary);
    width: 42px; height: 42px;
    border-radius: var(--radius-full);
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; font-size: 18px;
    box-shadow: var(--shadow-sm);
}

.chat-send-btn:hover { transform: scale(1.06); }

/* Virtual Soft Native Keyboard Drawer */
.virtual-keyboard-drawer {
    display: none;
    background: var(--card-bg);
    border-top: 1px solid var(--border-subtle);
    padding: 12px 14px;
    flex-direction: column;
    gap: 10px;
    animation: slideUpKeyboard 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.virtual-keyboard-drawer.open { display: flex; }

@keyframes slideUpKeyboard {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}

.keyboard-top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.keyboard-title {
    font-size: 12px;
    font-weight: 700;
    color: var(--primary-color);
    font-family: var(--font-heading);
}

.keyboard-lang-select {
    background: var(--input-bg);
    color: var(--text-main);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    padding: 4px 10px;
    font-size: 12px;
    outline: none;
    font-weight: 600;
}

.keyboard-keys-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    max-height: 170px;
    overflow-y: auto;
    padding-right: 4px;
}

.v-key-btn {
    background: var(--input-bg);
    border: 1px solid var(--border-subtle);
    color: var(--text-main);
    min-width: 32px;
    height: 36px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: var(--shadow-sm);
    user-select: none;
}

.v-key-btn:hover {
    background: var(--primary-color);
    color: var(--text-on-primary);
    border-color: var(--primary-color);
    transform: scale(1.1);
}

.v-key-space { flex: 2; font-size: 12px; }
.v-key-backspace { background: rgba(225, 29, 72, 0.1); color: var(--accent-rose); border-color: rgba(225, 29, 72, 0.2); font-size: 12px; }

/* Explore View */
.explore-filter-bar {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 18px;
}

.filter-row { display: flex; gap: 8px; flex-wrap: wrap; }

.filter-select, .search-input {
    background: var(--input-bg);
    border: 1px solid var(--border-subtle);
    color: var(--text-main);
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    outline: none;
    flex: 1;
    min-width: 130px;
    font-weight: 500;
}

.filter-select:focus, .search-input:focus { border-color: var(--primary-color); }
.search-input { width: 100%; }

.explore-user-grid { display: flex; flex-direction: column; gap: 16px; }

.user-explore-card {
    background: var(--card-bg);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 18px;
    display: flex;
    gap: 16px;
    box-shadow: var(--shadow-sm);
}

.user-explore-card:hover {
    border-color: var(--border-accent);
    transform: translateY(-3px) scale(1.01);
    box-shadow: var(--shadow-md);
}

.explore-avatar {
    width: 64px; height: 64px;
    border-radius: var(--radius-full);
    object-fit: cover;
    border: 2px solid var(--border-subtle);
}

.user-card-body { flex: 1; }

.user-card-name { font-size: 16px; font-weight: 800; }
.user-card-location { font-size: 12px; color: var(--text-muted); margin-bottom: 8px; }

.language-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }

.tag {
    font-size: 11px;
    padding: 4px 10px;
    border-radius: var(--radius-full);
    font-weight: 700;
}

.tag-native { background: rgba(13, 148, 136, 0.1); color: var(--accent-teal); }
.tag-learning { background: rgba(30, 58, 138, 0.08); color: var(--primary-color); }
[data-theme="dark"] .tag-learning { background: rgba(212, 175, 55, 0.15); color: var(--accent-gold); }

.user-card-bio { font-size: 13px; color: var(--text-main); line-height: 1.4; margin-bottom: 12px; }
.user-badges-row { display: flex; gap: 4px; margin-bottom: 12px; }

.user-badge-pill {
    background: rgba(212, 175, 55, 0.15);
    padding: 2px 8px;
    border-radius: 6px;
    font-size: 14px;
}

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

/* Friends View */
.friends-subtabs-nav {
    display: flex;
    background: var(--card-bg);
    border-radius: var(--radius-md);
    padding: 5px;
    margin-bottom: 18px;
    border: 1px solid var(--border-subtle);
}

.friends-subtab-btn {
    flex: 1;
    background: none;
    border: none;
    color: var(--text-muted);
    padding: 9px;
    font-size: 13px;
    font-weight: 800;
    cursor: pointer;
    border-radius: var(--radius-sm);
    position: relative;
}

.friends-subtab-btn.active {
    background: var(--primary-gradient);
    color: var(--text-on-primary);
    box-shadow: var(--shadow-sm);
}

.subtab-badge {
    background: var(--accent-rose);
    color: #ffffff;
    font-size: 10px;
    padding: 2px 7px;
    border-radius: 10px;
    margin-left: 4px;
}

.friend-item-card {
    background: var(--card-bg);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 14px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    box-shadow: var(--shadow-sm);
}

.friend-user-info { display: flex; align-items: center; gap: 12px; }
.friend-avatar { width: 46px; height: 46px; border-radius: 50%; object-fit: cover; }
.friend-user-info h4 { font-size: 14px; font-weight: 800; }
.friend-user-info p { font-size: 11px; color: var(--text-muted); }

.friend-actions { display: flex; gap: 6px; }

/* Profile View & Badges Shelf */
.profile-hero-card {
    background: var(--card-bg);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 24px;
    text-align: center;
    margin-bottom: 20px;
    position: relative;
    box-shadow: var(--shadow-sm);
}

.profile-avatar-wrapper { position: relative; display: inline-block; margin-bottom: 12px; }

.profile-hero-avatar {
    width: 96px; height: 96px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--border-accent);
    box-shadow: var(--shadow-gold);
}

.profile-hero-name { font-size: 22px; font-weight: 900; }
.profile-hero-username { font-size: 13px; color: var(--text-muted); margin-bottom: 6px; }
.profile-hero-location { font-size: 12px; color: var(--accent-teal); font-weight: 700; margin-bottom: 10px; }
.profile-hero-bio { font-size: 13px; line-height: 1.4; margin-bottom: 16px; }

.profile-stats-row {
    display: flex;
    justify-content: space-around;
    padding-top: 16px;
    border-top: 1px solid var(--border-subtle);
}

.stat-item h3 { font-size: 22px; font-weight: 900; color: var(--primary-color); }
.stat-item p { font-size: 11px; color: var(--text-muted); }

.section-title {
    font-family: var(--font-heading);
    font-size: 17px;
    font-weight: 800;
    margin-bottom: 12px;
}

.badges-shelf { display: flex; flex-direction: column; gap: 12px; }

.profile-badge-card {
    background: var(--card-bg);
    border: 1px solid var(--border-accent);
    border-radius: var(--radius-md);
    padding: 14px 18px;
    display: flex;
    align-items: center;
    gap: 14px;
    box-shadow: var(--shadow-sm);
}

.badge-icon-large { font-size: 34px; }
.badge-card-info h4 { font-size: 15px; font-weight: 800; color: var(--accent-gold); }
.badge-card-info p { font-size: 11px; color: var(--text-muted); }

/* Buttons & Utilities */
.btn {
    padding: 10px 18px;
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-weight: 800;
    border: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    box-shadow: var(--shadow-sm);
}

.btn:hover { transform: translateY(-1px); box-shadow: var(--shadow-md); }
.btn-primary { background: var(--primary-gradient); color: var(--text-on-primary); }
.btn-secondary { background: var(--card-bg); color: var(--text-main); border: 1px solid var(--border-subtle); }
.btn-success { background: #10b981; color: #ffffff; }
.btn-outline { border: 1px solid var(--border-subtle); background: var(--card-bg); color: var(--text-main); }
.btn-danger-outline { border: 1px solid var(--accent-rose); background: var(--card-bg); color: var(--accent-rose); }

.empty-state { text-align: center; padding: 40px 20px; color: var(--text-muted); }
.empty-icon { font-size: 48px; margin-bottom: 10px; }

/* Modals */
.modal-container {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    z-index: 100;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.modal-container.open { display: flex; }

.modal-backdrop {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
}

.modal-content {
    background: var(--app-frame-bg);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 420px;
    padding: 22px;
    position: relative;
    z-index: 101;
    box-shadow: var(--shadow-lg);
    animation: modalPop 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalPop {
    from { opacity: 0; transform: scale(0.94) translateY(10px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }

.modal-close {
    background: var(--card-bg);
    border: 1px solid var(--border-subtle);
    color: var(--text-muted);
    width: 32px; height: 32px;
    border-radius: 50%;
    cursor: pointer;
}

.translation-inspect-box {
    background: var(--card-bg);
    padding: 14px 16px;
    border-radius: var(--radius-md);
    margin-bottom: 12px;
    border: 1px solid var(--border-subtle);
    box-shadow: var(--shadow-sm);
}

.inspect-label { font-size: 11px; color: var(--text-muted); margin-bottom: 4px; }
.inspect-text { font-size: 15px; font-weight: 800; }

.audio-play-btn {
    margin-top: 8px;
    background: rgba(30, 58, 138, 0.08);
    color: var(--primary-color);
    border: 1px solid var(--primary-color);
    padding: 6px 14px;
    border-radius: var(--radius-sm);
    font-size: 11px;
    font-weight: 800;
    cursor: pointer;
}

[data-theme="dark"] .audio-play-btn { background: rgba(212, 175, 55, 0.12); }

/* Toast Notifications */
#toast-container {
    position: fixed;
    top: 20px; left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    background: var(--header-bg);
    border: 1px solid var(--border-accent);
    color: var(--text-main);
    padding: 12px 20px;
    border-radius: var(--radius-full);
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: var(--shadow-lg);
    opacity: 0;
    transform: translateY(-12px);
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.toast.show { opacity: 1; transform: translateY(0); }
