:root {
    --primary: #0f172a;
    --accent: #0ea5e9;
    --accent-hover: #0284c7;
    --background: #f8fafc;
    --white: #ffffff;
    --text-primary: #0f172a;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    --border: #e2e8f0;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', 'Poppins', sans-serif;
    background-color: var(--background);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    width: 100%;
    max-width: 100vw;
}

html {
    overflow-x: hidden;
}

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

.fade-in {
    animation: fadeIn 0.4s ease-out forwards;
}

.card {
    background: var(--white);
    border-radius: 16px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    transition: all 0.3s ease;
}

.card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-hover) 100%);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 9999px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px -5px rgba(14, 165, 233, 0.4);
}

.btn-secondary {
    background: var(--white);
    color: var(--text-primary);
    border: 1px solid var(--border);
    padding: 12px 24px;
    border-radius: 9999px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-secondary:hover {
    background: var(--background);
    transform: translateY(-2px);
}

.glass-navbar {
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(51, 65, 85, 0.8);
    position: sticky;
    top: 0;
    z-index: 100;
}

.input-modern {
    width: 100%;
    padding: 14px 20px;
    border: 2px solid var(--border);
    border-radius: 12px;
    font-size: 16px;
    transition: all 0.3s ease;
    background: var(--white);
}

.input-modern:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 4px rgba(14, 165, 233, 0.1);
}

@keyframes bounce {
    0%, 60%, 100% {
        transform: translateY(0);
    }
    30% {
        transform: translateY(-8px);
    }
}

.typing-dot {
    width: 8px;
    height: 8px;
    background: var(--accent);
    border-radius: 50%;
    animation: bounce 1.4s infinite ease-in-out;
}

.typing-dot:nth-child(1) {
    animation-delay: 0s;
}

.typing-dot:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-dot:nth-child(3) {
    animation-delay: 0.4s;
}

.chat-bubble-user {
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-hover) 100%);
    color: white;
    border-radius: 20px 20px 4px 20px;
    padding: 12px 18px;
    max-width: 75%;
    word-wrap: break-word;
}

.chat-bubble-ai {
    background: #f1f5f9;
    color: var(--text-primary);
    border-radius: 20px 20px 20px 4px;
    padding: 12px 18px;
    max-width: 75%;
    word-wrap: break-word;
}

.avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 14px;
    flex-shrink: 0;
}

.avatar-user {
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-hover) 100%);
    color: white;
}

.avatar-ai {
    background: var(--primary);
    color: white;
}

.chat-input-capsule {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--white);
    border: 2px solid var(--border);
    border-radius: 9999px;
    padding: 8px 8px 8px 20px;
    box-shadow: var(--shadow-lg);
    transition: all 0.3s ease;
}

.chat-input-capsule:focus-within {
    border-color: var(--accent);
    box-shadow: 0 0 0 4px rgba(14, 165, 233, 0.1), var(--shadow-lg);
}

.chat-input-capsule input {
    flex: 1;
    border: none;
    outline: none;
    font-size: 16px;
    background: transparent;
}

.chat-input-capsule button {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.mic-btn {
    background: var(--background);
    color: var(--text-secondary);
}

.mic-btn:hover {
    background: var(--accent);
    color: white;
}

.mic-btn.recording {
    background: #ef4444;
    color: white;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4);
    }
    50% {
        box-shadow: 0 0 0 12px rgba(239, 68, 68, 0);
    }
}

.send-btn {
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-hover) 100%);
    color: white;
}

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

.sidebar-modern {
    background: var(--white);
    border-right: 1px solid var(--border);
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: 12px;
    color: var(--text-secondary);
    text-decoration: none;
    transition: all 0.2s ease;
    font-weight: 500;
}

.sidebar-link:hover {
    background: var(--background);
    color: var(--text-primary);
}

.sidebar-link.active {
    background: rgba(14, 165, 233, 0.1);
    color: var(--accent);
}

.translation-text {
    font-size: 14px;
    font-style: italic;
    color: var(--text-secondary);
    opacity: 0.8;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid rgba(0, 0, 0, 0.05);
}

.scenario-card {
    background: var(--white);
    border-radius: 16px;
    padding: 24px;
    border: 1px solid var(--border);
    transition: all 0.3s ease;
    cursor: pointer;
    text-decoration: none;
    display: block;
}

.scenario-card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-4px);
    border-color: var(--accent);
}

.scenario-icon {
    width: 56px;
    height: 56px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
}

.toggle-translation-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 8px;
    background: rgba(14, 165, 233, 0.1);
    color: var(--accent);
    font-size: 13px;
    font-weight: 500;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-top: 10px;
}

.toggle-translation-btn:hover {
    background: rgba(14, 165, 233, 0.2);
}

@media (max-width: 768px) {
    .chat-bubble-user,
    .chat-bubble-ai {
        max-width: 85%;
    }
    
    .chat-input-capsule {
        padding: 6px 6px 6px 16px;
    }
    
    .chat-input-capsule input {
        font-size: 14px;
    }
    
    .chat-input-capsule button {
        width: 40px;
        height: 40px;
    }
}

[dir="rtl"] .message-row.user {
    flex-direction: row;
}

[dir="rtl"] .message-row:not(.user) {
    flex-direction: row-reverse;
}

[dir="rtl"] .message-row.user .message-content {
    align-items: flex-start;
}

[dir="rtl"] .chat-bubble-user {
    border-radius: 20px 20px 20px 4px;
}

[dir="rtl"] .chat-bubble-ai {
    border-radius: 20px 20px 4px 20px;
}

[dir="rtl"] .sidebar-modern {
    border-right: none;
    border-left: 1px solid var(--border);
}

[dir="rtl"] .sidebar-link {
    flex-direction: row-reverse;
}

[dir="rtl"] .btn-primary,
[dir="rtl"] .btn-secondary {
    flex-direction: row-reverse;
}

/* ==========================================
   MOBILE BUBBLE MENU (Speed Dial)
   ========================================== */

/* Hide regular nav on mobile when logged in */
@media (max-width: 768px) {
    .hide-mobile-nav .glass-navbar {
        display: none !important;
    }
    
    .hide-mobile-nav .sidebar-modern {
        display: none !important;
    }
    
    /* Add bottom padding for bubble menu */
    .hide-mobile-nav main {
        padding-bottom: 100px;
    }
}

/* Bubble Menu Container */
.bubble-menu {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 10000;
    display: none;
}

@media (max-width: 768px) {
    .bubble-menu {
        display: block;
    }
}

/* Main FAB Button */
.bubble-fab {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-hover) 100%);
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(14, 165, 233, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    z-index: 10;
}

.bubble-fab:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 25px rgba(14, 165, 233, 0.5);
}

.bubble-fab:active {
    transform: scale(0.95);
}

/* FAB Icon */
.bubble-fab-icon {
    width: 24px;
    height: 24px;
    position: relative;
    transition: all 0.3s ease;
}

.bubble-fab-icon span {
    display: block;
    width: 24px;
    height: 3px;
    background: white;
    border-radius: 3px;
    position: absolute;
    left: 0;
    transition: all 0.3s ease;
}

.bubble-fab-icon span:nth-child(1) {
    top: 4px;
}

.bubble-fab-icon span:nth-child(2) {
    top: 10px;
}

.bubble-fab-icon span:nth-child(3) {
    top: 16px;
}

/* FAB Icon transformed to X */
.bubble-menu.open .bubble-fab-icon span:nth-child(1) {
    transform: rotate(45deg);
    top: 10px;
}

.bubble-menu.open .bubble-fab-icon span:nth-child(2) {
    opacity: 0;
    transform: translateX(10px);
}

.bubble-menu.open .bubble-fab-icon span:nth-child(3) {
    transform: rotate(-45deg);
    top: 10px;
}

/* Bubble Stack Container */
.bubble-stack {
    position: absolute;
    bottom: 70px;
    right: 0;
    display: flex;
    flex-direction: column-reverse;
    gap: 12px;
    pointer-events: none;
}

.bubble-menu.open .bubble-stack {
    pointer-events: auto;
}

/* Individual Bubble Items */
.bubble-item {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    opacity: 0;
    transform: translateY(20px) scale(0.8);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.bubble-menu.open .bubble-item {
    opacity: 1;
    transform: translateY(0) scale(1);
}

/* Stagger animation delays */
.bubble-menu.open .bubble-item:nth-child(1) { transition-delay: 0.05s; }
.bubble-menu.open .bubble-item:nth-child(2) { transition-delay: 0.1s; }
.bubble-menu.open .bubble-item:nth-child(3) { transition-delay: 0.15s; }
.bubble-menu.open .bubble-item:nth-child(4) { transition-delay: 0.2s; }
.bubble-menu.open .bubble-item:nth-child(5) { transition-delay: 0.25s; }

/* Bubble Label */
.bubble-label {
    background: var(--primary);
    color: white;
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
}

/* Bubble Button */
.bubble-btn {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    box-shadow: 0 3px 12px rgba(0, 0, 0, 0.15);
    transition: all 0.2s ease;
    text-decoration: none;
}

.bubble-btn:hover {
    transform: scale(1.1);
}

.bubble-btn:active {
    transform: scale(0.95);
}

/* Bubble Colors */
.bubble-home {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
}

.bubble-news {
    background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
}

.bubble-dojo {
    background: linear-gradient(135deg, #f97316 0%, #ea580c 100%);
}

.bubble-interpreter {
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
}

.bubble-profile {
    background: linear-gradient(135deg, #64748b 0%, #475569 100%);
}

.bubble-vault {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
}

/* Overlay when menu is open */
.bubble-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.3);
    z-index: 9998;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.bubble-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

/* RTL Support for Bubble Menu */
[dir="rtl"] .bubble-menu {
    right: auto;
    left: 20px;
}

[dir="rtl"] .bubble-stack {
    right: auto;
    left: 0;
}

[dir="rtl"] .bubble-item {
    flex-direction: row-reverse;
}
