/* ============================================================
   BIMsmarter — Dimensionnement Techniques Unifié
   Design System & Layout
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Rubik:wght@400;500;600;700&display=swap');

/* ============== VARIABLES ============== */
:root {
    --sidebar-width: 260px;
    --header-height: 56px;

    --slate-900: #0F172A;
    --slate-850: #131C2E;
    --slate-800: #1E293B;
    --slate-700: #334155;
    --slate-600: #475569;
    --slate-500: #64748B;
    --slate-400: #94A3B8;
    --slate-300: #CBD5E1;
    --slate-200: #E2E8F0;

    --cyan-500: #06B6D4;
    --cyan-400: #22D3EE;
    --cyan-600: #0891B2;

    --green-500: #10B981;
    --red-500: #EF4444;
    --red-400: #F87171;
    --yellow-400: #FBBF24;
    --blue-600: #2563EB;
}

/* ============== RESET ============== */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--slate-900);
    color: var(--slate-200);
    min-height: 100vh;
    overflow: hidden;
}

/* ============== BACKGROUND PATTERN ============== */
.cross-pattern {
    background: linear-gradient(to bottom right, #020617, #0f172a, #020617);
}

.cross-pattern::before {
    content: '';
    position: fixed;
    inset: 0;
    opacity: 0.05;
    background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%2306b6d4' fill-opacity='0.4'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
    pointer-events: none;
    z-index: 0;
}

/* ============== GLASS ============== */
.glass {
    background: rgba(30, 41, 59, 0.75);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(6, 182, 212, 0.15);
}

/* ============== ANIMATIONS ============== */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(16px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes pulse-glow {

    0%,
    100% {
        box-shadow: 0 0 0 0 rgba(6, 182, 212, 0.4);
    }

    50% {
        box-shadow: 0 0 0 10px rgba(6, 182, 212, 0);
    }
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(10px);
    }

    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

@keyframes gradientShift {
    0% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }

    100% {
        background-position: 0% 50%;
    }
}

@keyframes chatbotPulse {
    0% {
        box-shadow: 0 0 0 0 rgba(6, 182, 212, 0.5);
    }

    70% {
        box-shadow: 0 0 0 15px rgba(6, 182, 212, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(6, 182, 212, 0);
    }
}

.animate-fadeIn {
    animation: fadeIn 0.5s ease-out;
}

/* ============== SHARED COMPONENTS ============== */
.gradient-text {
    background: linear-gradient(135deg, var(--cyan-400), #a78bfa);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.btn-primary {
    background: linear-gradient(135deg, #06B6D4, #0891B2);
    border: none;
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #22D3EE, #06B6D4);
    transform: translateY(-2px);
    box-shadow: 0 10px 40px rgba(6, 182, 212, 0.3);
}

.ai-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.2), rgba(6, 182, 212, 0.2));
    border: 1px solid rgba(139, 92, 246, 0.3);
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 600;
    color: #c4b5fd;
}

.ai-badge-icon {
    font-size: 0.8rem;
    animation: float 2s ease-in-out infinite;
}

/* ============================================================
   LOGIN SCREEN
   ============================================================ */
#loginScreen {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.login-brand {
    text-align: center;
    margin-bottom: 2rem;
    position: relative;
    z-index: 1;
}

.login-logo-img {
    width: 5rem;
    height: 5rem;
    border-radius: 1rem;
    box-shadow: 0 8px 32px rgba(6, 182, 212, 0.3);
    margin-bottom: 1rem;
    object-fit: contain;
}

.login-card {
    background: rgba(30, 41, 59, 0.7);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(6, 182, 212, 0.2);
    border-radius: 1rem;
    padding: 2rem;
    width: 100%;
    max-width: 28rem;
    position: relative;
    z-index: 1;
    animation: fadeInScale 0.5s ease-out;
}

.login-title {
    font-family: 'Rubik', sans-serif;
    font-size: 1.8rem;
    font-weight: 700;
    color: white;
    margin-bottom: 6px;
}

.login-subtitle {
    color: var(--slate-400);
    font-size: 0.85rem;
    font-weight: 500;
}

/* Login Tabs (Connexion / Inscription) — Pill buttons */
.login-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.login-tab {
    flex: 1;
    padding: 0.75rem 0;
    background: var(--slate-800);
    border: none;
    border-radius: 0.75rem;
    color: var(--slate-400);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
    font-family: inherit;
}

.login-tab:hover {
    color: white;
}

.login-tab.active {
    background: var(--cyan-500);
    color: white;
    font-weight: 600;
}

.login-field {
    margin-bottom: 16px;
}

.login-label {
    display: block;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--slate-400);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 6px;
}

.login-input {
    width: 100%;
    padding: 0.75rem 1rem;
    background: var(--slate-800);
    border: 1px solid var(--slate-600);
    border-radius: 0.75rem;
    color: white;
    font-size: 0.95rem;
    font-family: inherit;
    transition: all 0.3s;
}

.login-input:focus {
    outline: none;
    border-color: var(--cyan-500);
    box-shadow: 0 0 0 3px rgba(6, 182, 212, 0.2);
}

.login-input::placeholder {
    color: var(--slate-500);
}

.login-btn {
    width: 100%;
    padding: 14px;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    font-family: inherit;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 8px;
}

.login-btn:disabled {
    background: var(--slate-700) !important;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
    animation: none !important;
}

.login-error {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.4);
    border-radius: 10px;
    padding: 12px 14px;
    color: #FCA5A5;
    font-size: 0.85rem;
    margin-bottom: 16px;
    animation: fadeIn 0.3s ease;
}

.login-success {
    background: rgba(16, 185, 129, 0.15);
    border: 1px solid rgba(16, 185, 129, 0.4);
    border-radius: 10px;
    padding: 12px 14px;
    color: #6EE7B7;
    font-size: 0.85rem;
    margin-bottom: 16px;
    animation: fadeIn 0.3s ease;
}

.login-footer {
    text-align: center;
    margin-top: 1.5rem;
    padding-top: 1.25rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.login-footer p {
    color: var(--slate-500);
    font-size: 0.85rem;
}

/* ============================================================
   APP LAYOUT
   ============================================================ */
#appContainer {
    display: none;
    flex-direction: column;
    height: 100vh;
}

.app-layout {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* ============== SIDEBAR ============== */
.sidebar {
    width: var(--sidebar-width);
    min-width: var(--sidebar-width);
    height: 100%;
    background: rgba(15, 23, 42, 0.97);
    border-right: 1px solid rgba(6, 182, 212, 0.15);
    display: flex;
    flex-direction: column;
    position: relative;
    z-index: 50;
    transition: transform 0.3s ease;
}


/* Navigation */
.sidebar-nav {
    flex: 1;
    padding: 16px 12px;
    overflow-y: auto;
}

.sidebar-section-title {
    font-size: 0.65rem;
    font-weight: 700;
    color: var(--slate-500);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 0 8px;
    margin-bottom: 10px;
    margin-top: 8px;
}

.nav-btn {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border: none;
    border-radius: 10px;
    background: transparent;
    color: var(--slate-400);
    font-size: 0.88rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
    position: relative;
    margin-bottom: 4px;
    text-align: left;
}

.nav-btn:hover {
    background: rgba(6, 182, 212, 0.08);
    color: var(--slate-200);
}

.nav-btn.active {
    background: rgba(6, 182, 212, 0.12);
    color: var(--cyan-400);
    font-weight: 600;
}

.nav-btn.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 6px;
    bottom: 6px;
    width: 3px;
    background: var(--cyan-500);
    border-radius: 0 3px 3px 0;
}

.nav-icon {
    font-size: 1.2rem;
    width: 28px;
    text-align: center;
    flex-shrink: 0;
}

.nav-label {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}


/* ============== MAIN AREA ============== */
.main-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}

/* Main Header — style workflowgenerator.html */
.main-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    background: rgba(30, 41, 59, 0.7);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(6, 182, 212, 0.2);
    position: sticky;
    top: 0;
    z-index: 40;
}

.main-header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.main-header-logo {
    width: 56px;
    height: 56px;
    border-radius: 12px;
    box-shadow: 0 4px 16px rgba(6, 182, 212, 0.2);
    object-fit: contain;
    flex-shrink: 0;
}

.main-header-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.main-header-title-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.main-header-subtitle {
    color: var(--slate-400);
    font-size: 0.8rem;
    font-weight: 400;
}

.main-header-user {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 16px;
    background: rgba(30, 41, 59, 0.5);
    border-radius: 12px;
    border: 1px solid var(--slate-700);
}

.main-header-email {
    font-size: 0.8rem;
    color: var(--slate-300);
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.main-header-logout {
    padding: 8px;
    background: var(--slate-700);
    border: none;
    border-radius: 8px;
    color: var(--slate-400);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s ease;
}

.main-header-logout:hover {
    color: white;
}

.menu-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--slate-300);
    font-size: 1.3rem;
    cursor: pointer;
    padding: 6px;
    border-radius: 8px;
    transition: background 0.2s;
}

.menu-toggle:hover {
    background: rgba(6, 182, 212, 0.1);
}

.main-header-title {
    font-family: 'Rubik', sans-serif;
    font-size: 1.1rem;
    font-weight: 600;
    color: white;
}

.main-header-badge {
    background: rgba(6, 182, 212, 0.12);
    color: var(--cyan-400);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 600;
    border: 1px solid rgba(6, 182, 212, 0.2);
}

.main-header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.bimsmarter-link-btn {
    display: none;
    align-items: center;
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 12px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
    text-decoration: none;
    transition: all 0.3s;
}

.bimsmarter-link-btn:hover {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    transform: scale(1.05);
}

.bimsmarter-link-btn .bim-text {
    color: #0E2C50;
    font-weight: 700;
    font-size: 1.1rem;
    font-family: 'Rubik', sans-serif;
}

.bimsmarter-link-btn .smarter-text {
    color: #6C6A6B;
    font-weight: 300;
    font-size: 1.1rem;
    font-family: 'Rubik', sans-serif;
}

/* Content iframe */
.content-frame {
    flex: 1;
    width: 100%;
    border: none;
    background: var(--slate-900);
}

/* Welcome Screen */
.welcome-screen {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
}

.welcome-content {
    text-align: center;
    max-width: 500px;
    animation: fadeIn 0.6s ease-out;
}

.welcome-icon {
    font-size: 4rem;
    margin-bottom: 20px;
}

.welcome-content h2 {
    font-family: 'Rubik', sans-serif;
    font-size: 1.8rem;
    font-weight: 700;
    color: white;
    margin-bottom: 12px;
}

.welcome-content p {
    color: var(--slate-400);
    font-size: 1rem;
    line-height: 1.6;
    margin-bottom: 30px;
}

.welcome-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.welcome-card {
    background: rgba(30, 41, 59, 0.5);
    border: 1px solid var(--slate-700);
    border-radius: 12px;
    padding: 16px;
    cursor: pointer;
    transition: all 0.3s;
    text-align: left;
}

.welcome-card:hover {
    border-color: rgba(6, 182, 212, 0.4);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.welcome-card-icon {
    font-size: 1.5rem;
    margin-bottom: 8px;
}

.welcome-card h3 {
    color: white;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 4px;
}

.welcome-card p {
    color: var(--slate-500);
    font-size: 0.75rem;
    margin-bottom: 0;
}

/* ============================================================
   CHATBOT
   ============================================================ */
/* Chatbot wrapper — hidden by default, shown after auth */
.chatbot-wrapper {
    display: none;
}

.chatbot-wrapper.visible {
    display: block;
}

.chat-fab {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #00d4ff 0%, #0099cc 100%);
    border: 2px solid rgba(255, 255, 255, 0.3);
    color: white;
    font-size: 2rem;
    cursor: pointer;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 32px rgba(0, 212, 255, 0.6);
    transition: all 0.3s ease;
}

.chat-fab:hover {
    transform: scale(1.15) rotate(5deg);
    box-shadow: 0 12px 48px rgba(0, 212, 255, 0.8);
}

/* Chatbot pulse ring */
.chatbot-pulse {
    position: fixed;
    bottom: 19px;
    right: 19px;
    width: 70px;
    height: 70px;
    border-radius: 50%;
    background: rgba(0, 212, 255, 0.3);
    animation: chatbotPulseRing 2s infinite;
    z-index: 999;
    pointer-events: none;
}

/* Chatbot IA badge — RED like reference */
.chatbot-badge {
    position: fixed;
    bottom: 18px;
    right: 18px;
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a6f 100%);
    color: white;
    font-size: 10px;
    font-weight: bold;
    padding: 3px 6px;
    border-radius: 12px;
    border: 2px solid #1a2332;
    box-shadow: 0 2px 8px rgba(255, 107, 107, 0.6);
    z-index: 1001;
    pointer-events: none;
    animation: chatbotBounce 1s infinite;
}

/* AI Bubble — matching reference design */
.ai-bubble {
    position: fixed;
    bottom: 100px;
    right: 24px;
    width: 320px;
    background: linear-gradient(135deg, rgba(30, 41, 59, 0.98), rgba(17, 24, 39, 0.98));
    backdrop-filter: blur(20px);
    border: 1px solid rgba(168, 85, 247, 0.3);
    border-radius: 20px;
    padding: 20px;
    z-index: 999;
    animation: bubbleIn 0.4s ease-out;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5), 0 0 40px rgba(168, 85, 247, 0.15);
}

/* Triangle pointer pointing down toward FAB */
.ai-bubble::after {
    content: '';
    position: absolute;
    bottom: -10px;
    right: 30px;
    width: 20px;
    height: 20px;
    background: linear-gradient(135deg, rgba(30, 41, 59, 0.98), rgba(17, 24, 39, 0.98));
    border-right: 1px solid rgba(168, 85, 247, 0.3);
    border-bottom: 1px solid rgba(168, 85, 247, 0.3);
    transform: rotate(45deg);
}

.ai-bubble-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 15px;
    font-weight: 600;
    color: #fff;
    margin-bottom: 12px;
}

.ai-bubble-title-icon {
    font-size: 20px;
    animation: float 2s ease-in-out infinite;
}

.ai-bubble-text {
    font-size: 13px;
    color: #94a3b8;
    line-height: 1.6;
    margin-bottom: 16px;
}

.ai-bubble-btn {
    width: 100%;
    padding: 12px 16px;
    background: linear-gradient(135deg, #8b5cf6, #06b6d4);
    border: none;
    border-radius: 12px;
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.3s;
    box-shadow: 0 4px 15px rgba(139, 92, 246, 0.4);
    font-family: inherit;
}

.ai-bubble-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(139, 92, 246, 0.5);
}

.ai-bubble-examples {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.ai-bubble-example {
    font-size: 11px;
    color: #64748b;
    padding: 4px 0;
    display: flex;
    align-items: center;
    gap: 6px;
}

.ai-bubble-example::before {
    content: '\2192';
    color: #8b5cf6;
}

.ai-bubble-close {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: #94a3b8;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    transition: all 0.2s;
}

.ai-bubble-close:hover {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

.ai-bubble-closing {
    animation: bubbleOut 0.3s ease-in forwards;
}

/* Chat Panel */
.chat-panel {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 400px;
    height: 600px;
    background: rgba(15, 23, 42, 0.98);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(6, 182, 212, 0.2);
    border-radius: 20px;
    z-index: 1001;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    animation: fadeInScale 0.3s ease-out;
}

.chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px;
    background: linear-gradient(135deg, #00d4ff 0%, #0099cc 100%);
}

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

.chat-header-avatar {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--cyan-500), var(--blue-600));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}

.chat-header-text h3 {
    font-family: 'Rubik', sans-serif;
    font-size: 0.95rem;
    font-weight: 600;
    color: white;
}

.chat-header-text p {
    font-size: 0.7rem;
    color: var(--cyan-400);
}

.chat-close {
    background: none;
    border: none;
    color: var(--slate-400);
    font-size: 1.3rem;
    cursor: pointer;
    padding: 4px;
    border-radius: 8px;
    transition: all 0.2s;
}

.chat-close:hover {
    background: rgba(239, 68, 68, 0.1);
    color: var(--red-400);
}

/* Messages Area */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.chat-messages::-webkit-scrollbar {
    width: 6px;
}

.chat-messages::-webkit-scrollbar-track {
    background: transparent;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: var(--slate-700);
    border-radius: 3px;
}

.chat-msg {
    display: flex;
    gap: 10px;
    animation: fadeIn 0.3s ease;
}

.chat-msg.user {
    flex-direction: row-reverse;
}

.chat-msg-avatar {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    flex-shrink: 0;
}

.chat-msg.assistant .chat-msg-avatar {
    background: linear-gradient(135deg, var(--cyan-500), var(--blue-600));
}

.chat-msg.user .chat-msg-avatar {
    background: var(--slate-700);
}

.chat-msg-content {
    max-width: 80%;
    padding: 10px 14px;
    border-radius: 12px;
    font-size: 0.85rem;
    line-height: 1.55;
}

.chat-msg.assistant .chat-msg-content {
    background: rgba(30, 41, 59, 0.7);
    border: 1px solid var(--slate-700);
    color: var(--slate-200);
    border-radius: 12px 12px 12px 4px;
}

.chat-msg.user .chat-msg-content {
    background: linear-gradient(135deg, var(--cyan-500), var(--blue-600));
    color: white;
    border-radius: 12px 12px 4px 12px;
}

/* Typing Indicator */
.typing-indicator {
    display: flex;
    gap: 4px;
    padding: 10px 14px;
}

.typing-indicator span {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--cyan-400);
    animation: typing 1.2s infinite;
}

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

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

@keyframes typing {

    0%,
    60%,
    100% {
        opacity: 0.3;
        transform: translateY(0);
    }

    30% {
        opacity: 1;
        transform: translateY(-4px);
    }
}

/* Chat Input */
.chat-input-area {
    padding: 12px 16px;
    border-top: 1px solid rgba(6, 182, 212, 0.1);
    display: flex;
    gap: 8px;
    align-items: flex-end;
}

.chat-input {
    flex: 1;
    padding: 10px 14px;
    background: rgba(30, 41, 59, 0.5);
    border: 1px solid var(--slate-700);
    border-radius: 12px;
    color: white;
    font-size: 0.85rem;
    font-family: inherit;
    resize: none;
    max-height: 100px;
    transition: border-color 0.3s;
}

.chat-input:focus {
    outline: none;
    border-color: var(--cyan-500);
}

.chat-input::placeholder {
    color: var(--slate-500);
}

.chat-send {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--cyan-500), var(--blue-600));
    border: none;
    color: white;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.chat-send:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 16px rgba(6, 182, 212, 0.3);
}

.chat-send:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* ============== UTILITIES ============== */
.hidden {
    display: none !important;
}

/* ============== SCROLL ============== */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--slate-900);
}

::-webkit-scrollbar-thumb {
    background: var(--slate-700);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--cyan-500);
}

/* ============== NEW ANIMATIONS (matching reference) ============== */
@keyframes chatbotPulseRing {
    0%, 100% { transform: scale(1); opacity: 0.5; }
    50% { transform: scale(1.3); opacity: 0; }
}

@keyframes chatbotBounce {
    0%, 100% { transform: translateY(0) scale(1); }
    50% { transform: translateY(-3px) scale(1.1); }
}

@keyframes bubbleIn {
    0% { opacity: 0; transform: scale(0.8) translateY(20px); }
    100% { opacity: 1; transform: scale(1) translateY(0); }
}

@keyframes bubbleOut {
    0% { opacity: 1; transform: scale(1) translateY(0); }
    100% { opacity: 0; transform: scale(0.8) translateY(20px); }
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-5px); }
}

@keyframes glow {
    0%, 100% { box-shadow: 0 0 20px rgba(6, 182, 212, 0.4); }
    50% { box-shadow: 0 0 35px rgba(6, 182, 212, 0.7); }
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        height: 100vh;
        transform: translateX(-100%);
        z-index: 200;
        box-shadow: 4px 0 24px rgba(0, 0, 0, 0.5);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .sidebar-overlay {
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 199;
        display: none;
    }

    .sidebar-overlay.active {
        display: block;
    }

    .menu-toggle {
        display: flex;
    }

    .chat-panel {
        width: calc(100vw - 32px);
        height: 70vh;
        bottom: 16px;
        right: 16px;
    }

    .welcome-grid {
        grid-template-columns: 1fr;
    }

    .bimsmarter-link-btn {
        display: none !important;
    }

    .main-header {
        padding: 12px 16px;
    }

    .main-header-logo {
        width: 40px;
        height: 40px;
        border-radius: 10px;
    }

    .main-header-title {
        font-size: 0.9rem;
    }

    .main-header-subtitle {
        display: none;
    }

    .main-header-email {
        display: none;
    }

    .main-header-user {
        padding: 6px;
        background: transparent;
        border: none;
    }
}

/* Desktop: show BIMSmarter link button */
@media (min-width: 769px) {
    .bimsmarter-link-btn {
        display: flex;
    }
}

/* ============================================================
   CHATBOT VISIBILITY OVERRIDES
   ============================================================ */
/* 
   The chatbot wrapper has 'hidden' (display: none) by default in HTML.
   JS adds 'visible' class when authenticated.
   We need !important to override Tailwind's 'hidden' class.
*/
.chatbot-wrapper.visible {
    display: flex !important;
    animation: fadeIn 0.5s ease forwards;
}

/* Ensure smooth transition for child elements if needed */
.chatbot-wrapper .chat-bubble,
.chatbot-wrapper .chatbot-fab {
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}