/* ============================================
   鲸鱼先生ˣ Chat Widget Styles
   Desktop + Mobile Responsive
   ============================================ */

:root {
    /* Brand Colors - Default (鲸鱼先生) */
    --brand-primary: #1a56db;
    --brand-secondary: #1e40af;
    --brand-gradient: linear-gradient(135deg, #1a56db 0%, #1e40af 100%);
    
    /* Neutral Colors */
    --bg-sidebar: #F7F7F9;
    --bg-main: #FFFFFF;
    --bg-chat: #f8fafc;
    --text-primary: #1A1D20;
    --text-secondary: #5F6672;
    --text-tertiary: #8C94A3;
    --border-color: #E6E8EB;
    
    /* Semantic Colors */
    --success: #10b981;
    --warning: #f59e0b;
    --error: #ef4444;
    
    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
    
    /* Radius */
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
    --radius-2xl: 1.5rem;
    --radius-full: 9999px;
    
    /* Transitions */
    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-base: 200ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 300ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* Reset & Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    color: var(--text-primary);
    background-color: var(--bg-main);
    line-height: 1.5;
    overflow: hidden;
}

/* ============================================
   LAYOUT
   ============================================ */
.layout {
    display: flex;
    height: 100vh;
    height: 100dvh;
    width: 100vw;
    overflow: hidden;
}

/* ============================================
   SIDEBAR (Desktop Only)
   ============================================ */
.sidebar {
    width: 300px;
    background-color: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    padding: 1.5rem;
    flex-shrink: 0;
    overflow-y: auto;
}

.sidebar-header {
    margin-bottom: 1.5rem;
}

.logo-icon {
    width: 48px;
    height: 48px;
    background: var(--brand-gradient);
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    margin-bottom: 0.75rem;
    box-shadow: var(--shadow-md);
    overflow: hidden;
}

.logo-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.logo-icon i,
.logo-icon svg {
    color: var(--brand-primary);
}

.has-custom-logo svg {
    display: none !important;
}

.brand-title {
    font-size: 1.125rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.brand-subtitle {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

/* Sidebar Promo Banner Card */
.promo-card {
    background: var(--brand-gradient);
    border-radius: var(--radius-xl);
    padding: 1.25rem;
    margin-bottom: 1.25rem;
    color: white;
    position: relative;
    overflow: hidden;
    cursor: pointer;
    transition: all var(--transition-base);
}

.promo-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(26, 86, 219, 0.35);
}

.promo-badge {
    display: inline-block;
    background: rgba(255,255,255,0.25);
    backdrop-filter: blur(4px);
    border: 1px solid rgba(255,255,255,0.3);
    border-radius: var(--radius-full);
    padding: 0.25rem 0.75rem;
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    margin-bottom: 0.5rem;
    text-transform: uppercase;
}

.promo-title {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 0.375rem;
    line-height: 1.3;
}

.promo-desc {
    font-size: 0.8125rem;
    opacity: 0.88;
    line-height: 1.5;
    margin-bottom: 0.75rem;
}

.promo-img {
    width: 100%;
    height: 120px;
    object-fit: cover;
    border-radius: var(--radius-lg);
    margin-top: 0.75rem;
}

.promo-gradient-overlay {
    position: absolute;
    top: 0; right: 0;
    width: 80px; height: 80px;
    background: radial-gradient(circle at top right, rgba(255,255,255,0.15), transparent 70%);
    pointer-events: none;
}

/* Subsidy Card */
.subsidy-card {
    background: linear-gradient(135deg, #fff7ed, #fef3c7);
    border: 1px solid #fcd34d;
    border-radius: var(--radius-xl);
    padding: 1rem 1.25rem;
    margin-bottom: 1.25rem;
}

.subsidy-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.375rem;
}

.flash-icon {
    color: #f59e0b;
    width: 16px;
    height: 16px;
}

.subsidy-title {
    font-size: 0.875rem;
    font-weight: 700;
    color: #92400e;
}

.subsidy-desc {
    font-size: 0.8125rem;
    color: #78350f;
    line-height: 1.5;
}

/* Sidebar Shortcuts Nav Grid */
.nav-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.nav-item {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1rem 0.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    cursor: pointer;
    transition: all var(--transition-fast);
    text-align: center;
}

.nav-item:hover {
    border-color: var(--brand-primary);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.nav-icon {
    font-size: 1.25rem;
    line-height: 1;
}

.nav-label {
    font-size: 0.6875rem;
    font-weight: 500;
    color: var(--text-secondary);
    line-height: 1.3;
}

.sidebar-footer {
    margin-top: auto;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

/* Sidebar contact area */
.contact-info h5 {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-tertiary);
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.contact-line {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 0.375rem;
}

.contact-line a {
    color: var(--brand-primary);
    text-decoration: none;
}

.powered-by {
    margin-top: 1rem;
    font-size: 0.625rem;
    color: var(--text-tertiary);
    text-align: center;
}

/* ============================================
   MAIN CHAT AREA
   ============================================ */
.chat-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--bg-main);
    overflow: hidden;
}

/* Desktop Header */
.chat-header {
    padding: 1rem 1.5rem;
    background: white;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.agent-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.agent-avatar {
    width: 40px;
    height: 40px;
    background: var(--brand-gradient);
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    overflow: hidden;
}

.agent-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.agent-name {
    font-size: 0.9375rem;
    font-weight: 600;
    margin-bottom: 0.125rem;
}

.agent-status {
    font-size: 0.75rem;
    color: var(--text-tertiary);
}

.icon-button {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-md);
    border: none;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}

.icon-button:hover {
    background: var(--bg-sidebar);
    color: var(--text-primary);
}

/* Scroll Area */
.scroll-area {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
    background: var(--bg-chat);
}

/* ============================================
   WELCOME BOX
   ============================================ */
.welcome-box {
    background: white;
    border-radius: var(--radius-xl);
    padding: 2rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow-sm);
    text-align: center;
}

.welcome-avatar {
    width: 64px;
    height: 64px;
    background: var(--brand-gradient);
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    margin: 0 auto 1rem;
    font-size: 1.5rem;
}

.welcome-title {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.welcome-text {
    font-size: 0.9375rem;
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
    line-height: 1.6;
}

.suggestion-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: center;
}

.suggestion-item {
    background: var(--bg-sidebar);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-full);
    padding: 0.625rem 1rem;
    font-size: 0.875rem;
    color: var(--text-primary);
    cursor: pointer;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.suggestion-item:hover {
    background: white;
    border-color: var(--brand-primary);
    box-shadow: var(--shadow-sm);
}

/* ============================================
   CHAT MESSAGES
   ============================================ */
.chat-content {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.message-row {
    display: flex;
    gap: 0.75rem;
    max-width: 80%;
}

.message-row.user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.message-avatar {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 600;
    flex-shrink: 0;
}

.message-row.ai .message-avatar {
    background: var(--brand-gradient);
    color: white;
}

.message-row.user .message-avatar {
    background: var(--brand-gradient);
    color: white;
}

.message-bubble {
    padding: 0.875rem 1rem;
    border-radius: var(--radius-lg);
    font-size: 0.9375rem;
    line-height: 1.65;
    word-wrap: break-word;
}

/* Typography inside message bubbles */
.message-bubble p {
    margin-top: 0;
    margin-bottom: 0.75rem;
}
.message-bubble p:last-child {
    margin-bottom: 0;
}

.message-bubble .chat-list {
    margin-top: 0.5rem;
    margin-bottom: 0.75rem;
    padding-left: 1.25rem;
}
.message-bubble ul.chat-list {
    list-style-type: disc;
}
.message-bubble ol.chat-list {
    list-style-type: decimal;
}

.message-bubble .chat-list li {
    margin-bottom: 0.5rem;
    padding-left: 0.25rem;
}
.message-bubble .chat-list li:last-child {
    margin-bottom: 0;
}

.message-bubble strong {
    font-weight: 700;
}

.message-row.ai .message-bubble {
    background: white;
    color: var(--text-primary);
    border-bottom-left-radius: var(--radius-sm);
    box-shadow: var(--shadow-sm);
}

.message-row.user .message-bubble {
    background: var(--brand-gradient);
    color: white;
    border-bottom-right-radius: var(--radius-sm);
}

/* ============================================
   CHAT INPUT
   ============================================ */
.chat-footer {
    padding: 1rem 1.5rem;
    background: white;
    border-top: 1px solid var(--border-color);
}

.input-container {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: var(--bg-sidebar);
    border-radius: var(--radius-full);
    padding: 0.5rem;
}

.attachment-btn {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-full);
    border: none;
    background: transparent;
    color: var(--text-tertiary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
    flex-shrink: 0;
}

.attachment-btn:hover {
    background: white;
    color: var(--text-secondary);
}

.chat-input {
    flex: 1;
    border: none;
    background: transparent;
    font-size: 0.9375rem;
    color: var(--text-primary);
    outline: none;
    padding: 0 0.5rem;
}

.chat-input::placeholder {
    color: var(--text-tertiary);
}

.send-btn {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-full);
    border: none;
    background: var(--brand-gradient);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
    flex-shrink: 0;
}

.send-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(26, 86, 219, 0.4);
}

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

.security-notice {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.375rem;
    margin-top: 0.75rem;
    font-size: 0.75rem;
    color: var(--text-tertiary);
}

.lock-icon {
    width: 12px;
    height: 12px;
}

/* ============================================
   LEAD CAPTURE MODAL
   ============================================ */
.lead-capture-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 1rem;
}

.lead-capture-modal__content {
    background: white;
    border-radius: var(--radius-xl);
    padding: 2rem;
    max-width: 420px;
    width: 100%;
    box-shadow: var(--shadow-xl);
}

.lead-capture-modal__header {
    text-align: center;
    margin-bottom: 1.5rem;
}

.lead-capture-modal__title {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.lead-capture-modal__subtitle {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.lead-capture-form__group {
    margin-bottom: 1rem;
}

.lead-capture-form__option {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.lead-capture-form__option:hover {
    border-color: var(--brand-primary);
}

.lead-capture-form__radio {
    width: 18px;
    height: 18px;
    accent-color: var(--brand-primary);
}

.lead-capture-form__label-text {
    font-size: 0.875rem;
    font-weight: 500;
    min-width: 60px;
}

.lead-capture-form__input {
    flex: 1;
    border: none;
    background: transparent;
    font-size: 0.9375rem;
    outline: none;
}

.lead-capture-form__actions {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-top: 1.5rem;
}

.lead-capture-form__submit {
    padding: 0.875rem;
    background: var(--brand-gradient);
    color: white;
    border: none;
    border-radius: var(--radius-lg);
    font-size: 0.9375rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.lead-capture-form__submit:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.lead-capture-form__skip {
    padding: 0.875rem;
    background: transparent;
    color: var(--text-secondary);
    border: none;
    font-size: 0.9375rem;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.lead-capture-form__skip:hover {
    color: var(--text-primary);
}

/* ============================================
   MOBILE STYLES
   ============================================ */

/* Mobile Header */
.mobile-header {
    display: none;
}

/* Mobile Drawer - drops from TOP (天降神兵效果) */
.mobile-drawer-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 900;
    opacity: 0;
    transition: opacity var(--transition-base);
}

.mobile-drawer-overlay.active {
    display: block !important;
    opacity: 1 !important;
}

.mobile-drawer {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    z-index: 99999;
    transform: translateY(100%);
    visibility: hidden;
    transition: transform 0.38s cubic-bezier(0.22, 1, 0.36, 1), visibility 0s 0.38s;
    max-height: 85vh;
    padding-bottom: env(safe-area-inset-bottom, 20px);
    overflow-y: auto;
    box-shadow: 0 -12px 40px rgba(0,0,0,0.15);
}

.mobile-drawer.active {
    display: block !important;
    transform: translateY(0) !important;
    visibility: visible !important;
    transition: transform 0.38s cubic-bezier(0.22, 1, 0.36, 1), visibility 0s 0s;
}

/* drag handle - at the TOP of the drawer */
.mobile-drawer-handle {
    width: 36px;
    height: 4px;
    background: var(--border-color);
    border-radius: var(--radius-full);
    margin: 0.75rem auto 0.5rem;
}

.mobile-drawer-content {
    padding: 0 1.25rem 1.5rem;
}

.mobile-drawer-header {
    text-align: center;
    padding: 1rem 0;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 1rem;
}

.mobile-drawer-logo {
    width: 56px;
    height: 56px;
    background: var(--brand-gradient);
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    margin: 0 auto 0.75rem;
    overflow: hidden;
}

.mobile-drawer-logo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.mobile-drawer-title {
    font-size: 1.125rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.mobile-drawer-subtitle {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.mobile-drawer-widgets {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.mobile-drawer-widget {
    background: var(--bg-sidebar);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.mobile-drawer-widget:hover {
    border-color: var(--brand-primary);
}

.mobile-drawer-widget-icon {
    color: var(--brand-primary);
}

.mobile-drawer-widget-label {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.mobile-drawer-contact {
    padding: 1rem 0;
    border-top: 1px solid var(--border-color);
}

.mobile-drawer-contact h3 {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-tertiary);
    margin-bottom: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.contact-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.contact-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    background: var(--bg-sidebar);
    border-radius: var(--radius-lg);
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.contact-item-icon {
    color: var(--brand-primary);
}

.mobile-drawer-footer {
    text-align: center;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
    font-size: 0.625rem;
    color: var(--text-tertiary);
}

/* ============================================
   MOBILE RESPONSIVE (< 768px)
   ============================================ */
@media (max-width: 768px) {
    /* Hide desktop elements */
    .sidebar,
    #desktop-header {
        display: none;
    }
    
    /* Show mobile elements */
    .mobile-header,
    .mobile-drawer {
        display: block;
    }
    
    /* Layout adjustments */
    .layout {
        flex-direction: column;
    }
    
    .chat-main {
        width: 100%;
    }
    
    /* Mobile Header */
    .mobile-header {
        display: flex;
        align-items: center;
        padding: 0.75rem 1rem;
        background: white;
        border-bottom: 1px solid var(--border-color);
        flex-shrink: 0;
        gap: 0.75rem;
        position: relative;
        z-index: 50;
    }
    
    .mobile-back-btn,
    .mobile-menu-btn {
        width: 40px;
        height: 40px;
        border-radius: var(--radius-full);
        border: none;
        background: transparent;
        color: var(--text-secondary);
        display: flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        transition: all var(--transition-fast);
        flex-shrink: 0;
    }
    
    .mobile-back-btn:hover,
    .mobile-menu-btn:hover {
        background: var(--bg-sidebar);
        color: var(--text-primary);
    }
    
    .mobile-brand {
        flex: 1;
        display: flex;
        align-items: center;
        gap: 0.75rem;
        min-width: 0;
    }
    
    .mobile-brand-logo {
        width: 40px;
        height: 40px;
        background: var(--brand-gradient);
        border-radius: var(--radius-full);
        display: flex;
        align-items: center;
        justify-content: center;
        color: white;
        flex-shrink: 0;
        overflow: hidden;
    }
    
    .mobile-brand-logo img {
        width: 100%;
        height: 100%;
        object-fit: cover;
    }
    
    .mobile-brand-info {
        min-width: 0;
        overflow: hidden;
    }
    
    .mobile-brand-name {
        font-size: 1rem;
        font-weight: 600;
        margin-bottom: 0.125rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    
    .mobile-brand-status {
        display: flex;
        align-items: center;
        gap: 0.375rem;
        font-size: 0.75rem;
        color: var(--text-tertiary);
    }
    
    .status-dot {
        width: 8px;
        height: 8px;
        background: var(--success);
        border-radius: var(--radius-full);
        animation: pulse 2s infinite;
    }
    
    @keyframes pulse {
        0%, 100% { opacity: 1; }
        50% { opacity: 0.5; }
    }
    
    /* Mobile Chat Area */
    .scroll-area {
        padding: 1rem;
        -webkit-overflow-scrolling: touch;
    }
    
    /* Mobile Welcome Box */
    .welcome-box {
        padding: 1.25rem 1rem;
        margin-bottom: 1rem;
    }
    
    .welcome-title {
        font-size: 1.125rem;
        margin-bottom: 0.5rem;
    }
    
    .welcome-text {
        font-size: 0.875rem;
        margin-bottom: 1rem;
    }
    
    .suggestion-list {
        flex-wrap: wrap;
        padding-bottom: 0.5rem;
        justify-content: flex-start;
        display: flex;
        gap: 0.5rem;
    }
    
    .suggestion-item {
        white-space: normal;
        max-width: 100%;
        text-align: left;
    }
    
    /* Mobile Messages */
    .message-row {
        max-width: 85%;
        gap: 0.5rem;
    }
    
    .message-avatar {
        width: 32px;
        height: 32px;
        font-size: 0.625rem;
    }
    
    .message-bubble {
        padding: 0.75rem 0.875rem;
        font-size: 0.9375rem;
    }
    
    /* Mobile Input */
    .chat-footer {
        padding: 0.75rem 1rem;
        padding-bottom: max(0.75rem, env(safe-area-inset-bottom));
    }
    
    .input-container {
        gap: 0.5rem;
    }
    
    .attachment-btn,
    .send-btn {
        width: 44px;
        height: 44px;
    }
    
    .chat-input {
        font-size: 16px; /* Prevent zoom on iOS */
    }
    
    .security-notice {
        font-size: 0.6875rem;
        margin-top: 0.5rem;
    }
    
    /* Mobile Lead Capture Modal */
    .lead-capture-modal__content {
        max-height: 90vh;
        overflow-y: auto;
        border-radius: var(--radius-xl) var(--radius-xl) 0 0;
        margin-top: auto;
    }
    
    .lead-capture-modal {
        align-items: flex-end;
    }
}

/* ============================================
   ANIMATIONS
   ============================================ */
@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message-row {
    animation: slideUp 0.3s ease-out;
}

/* Typing Indicator */
.typing-indicator {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 0.75rem 1rem;
}

.typing-indicator span {
    width: 8px;
    height: 8px;
    background: var(--text-tertiary);
    border-radius: var(--radius-full);
    animation: typing 1.4s infinite ease-in-out both;
}

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

@keyframes typing {
    0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
    40% { transform: scale(1); opacity: 1; }
}

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

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* ============================================
   RICH MESSAGE CARDS
   ============================================ */

/* Base card wrapper - appears as an AI message */
.rich-card {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
    max-width: 320px;
    width: 100%;
    animation: slideUp 0.35s ease-out;
    font-size: 0.875rem;
}

/* --- 1. QUOTE CARD --- */
.quote-card {
    border: 1px solid var(--border-color);
}

.quote-card-header {
    background: var(--bg-hover);
    padding: 0.75rem 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.quote-card-icon {
    font-size: 1rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
}

.quote-card-icon svg {
    width: 16px;
    height: 16px;
}

.quote-card-title {
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--text-primary);
}

.quote-card-body {
    padding: 0.75rem 1rem;
}

.quote-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
    border-bottom: 1px dashed var(--border-color);
    font-size: 0.875rem;
}

.quote-item:last-child {
    border-bottom: none;
    font-weight: 700;
    font-size: 1rem;
    color: var(--brand-primary);
    padding-top: 0.75rem;
}

.quote-item-label {
    color: var(--text-secondary);
}

.quote-cta {
    margin: 0.5rem 1rem 1rem;
    padding: 0.5rem;
    background: var(--brand-gradient);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    font-weight: 600;
    width: calc(100% - 2rem);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.quote-cta:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(26, 86, 219, 0.4);
}

/* --- 2. LEAD FORM CARD (inline, not modal) --- */
.lead-form-card {
    border: 1px solid var(--border-color);
}

.lead-form-card-header {
    background: var(--bg-hover);
    padding: 0.75rem 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.lead-form-card-header-icon {
    color: var(--text-secondary);
    display: flex;
    align-items: center;
}

.lead-form-card-header-icon svg {
    width: 16px;
    height: 16px;
}

.lead-form-card-title {
    font-size: 0.875rem;
    font-weight: 700;
}

.lead-form-card-body {
    padding: 0.75rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.lead-form-field {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.lead-form-field label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.lead-form-field input,
.lead-form-field textarea,
.lead-form-field select {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 0.5rem 0.625rem;
    font-size: 0.875rem;
    outline: none;
    transition: border-color var(--transition-fast);
    font-family: inherit;
}

.lead-form-field input:focus,
.lead-form-field textarea:focus,
.lead-form-field select:focus {
    border-color: var(--brand-primary);
    box-shadow: 0 0 0 2px rgba(var(--brand-primary-rgb, 26, 86, 219), 0.1);
}

.lead-form-field textarea {
    resize: none;
    height: 56px;
}

.lead-form-submit {
    padding: 0.5rem;
    background: var(--brand-gradient);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
    margin-bottom: 0;
    margin-top: 0.25rem;
}

.lead-form-submit:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(26, 86, 219, 0.4);
}

/* --- 3. PRODUCT SHOWCASE CARD --- */
.product-card-img {
    width: 100%;
    aspect-ratio: 16/9;
    height: auto;
    object-fit: cover;
}

.product-card-body {
    padding: 0.75rem 1rem;
}

.product-card-tag {
    display: inline-block;
    font-size: 0.625rem;
    font-weight: 600;
    color: var(--brand-primary);
    background: rgba(var(--brand-primary-rgb, 26, 86, 219), 0.1);
    border-radius: var(--radius-full);
    padding: 0.15rem 0.5rem;
    margin-bottom: 0.375rem;
    letter-spacing: 0.04em;
}

.product-card-title {
    font-size: 0.9375rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
    line-height: 1.3;
}

.product-card-desc {
    font-size: 0.75rem;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 0.5rem;
}

.product-card-price {
    font-size: 1.125rem;
    font-weight: 800;
    color: var(--brand-primary);
    margin-bottom: 0.75rem;
}

.product-card-price .original-price {
    font-size: 0.8125rem;
    font-weight: 400;
    color: var(--text-tertiary);
    text-decoration: line-through;
    margin-left: 0.375rem;
}

.product-card-actions {
    display: flex;
    gap: 0.5rem;
}

.product-card-btn {
    flex: 1;
    padding: 0.5rem;
    border-radius: var(--radius-md);
    font-size: 0.8125rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
    text-align: center;
}

.product-card-btn.primary {
    background: var(--brand-gradient);
    color: white;
    border: none;
}

.product-card-btn.secondary {
    background: transparent;
    color: var(--brand-primary);
    border: 1px solid var(--brand-primary);
}

.product-card-btn:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

/* --- 4. VIDEO PLAYER CARD --- */
.video-card-thumb {
    position: relative;
    cursor: pointer;
    overflow: hidden;
}

.video-card-thumb img {
    width: 100%;
    height: 170px;
    object-fit: cover;
    display: block;
    transition: transform var(--transition-base);
}

.video-card-thumb:hover img {
    transform: scale(1.04);
}

.video-play-btn {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 52px;
    height: 52px;
    background: rgba(255,255,255,0.92);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
    transition: all var(--transition-fast);
}

.video-play-btn:hover {
    transform: translate(-50%, -50%) scale(1.1);
    background: white;
}

.video-play-btn-triangle {
    width: 0;
    height: 0;
    border-top: 10px solid transparent;
    border-bottom: 10px solid transparent;
    border-left: 16px solid var(--brand-primary);
    margin-left: 3px;
}

.video-duration-badge {
    position: absolute;
    bottom: 8px;
    right: 10px;
    background: rgba(0,0,0,0.75);
    color: white;
    font-size: 0.6875rem;
    font-weight: 600;
    padding: 0.2rem 0.5rem;
    border-radius: var(--radius-sm);
}

.video-card-body {
    padding: 0.875rem 1.25rem 1.25rem;
}

.video-card-title {
    font-size: 0.9375rem;
    font-weight: 700;
    margin-bottom: 0.375rem;
}

.video-card-source {
    font-size: 0.75rem;
    color: var(--text-tertiary);
}

/* --- 5. CONTACT INFO CARD --- */
.contact-card-header {
    background: linear-gradient(135deg, var(--brand-primary), var(--brand-secondary));
    padding: 1.25rem;
    color: white;
    text-align: center;
}

.contact-card-avatar {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: rgba(255,255,255,0.25);
    margin: 0 auto 0.625rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.75rem;
    overflow: hidden;
}

.contact-card-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.contact-card-name {
    font-size: 1rem;
    font-weight: 700;
}

.contact-card-role {
    font-size: 0.8125rem;
    opacity: 0.85;
}

.contact-card-methods {
    padding: 0.875rem 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.625rem;
}

.contact-method-btn {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    border-radius: var(--radius-lg);
    background: var(--bg-sidebar);
    border: 1px solid var(--border-color);
    cursor: pointer;
    transition: all var(--transition-fast);
    text-decoration: none;
    color: var(--text-primary);
    font-size: 0.875rem;
    font-weight: 500;
}

.contact-method-btn:hover {
    border-color: var(--brand-primary);
    background: white;
    box-shadow: var(--shadow-sm);
}

.contact-method-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    flex-shrink: 0;
}

/* --- 6. FILE DOWNLOAD CARD --- */
.file-download-card {
    border-top: 3px solid #06b6d4;
}

.file-download-card-body {
    padding: 1.25rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.file-icon-wrap {
    width: 52px;
    height: 52px;
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.75rem;
    flex-shrink: 0;
    background: #ecfeff;
}

.file-info {
    flex: 1;
    min-width: 0;
}

.file-name {
    font-size: 0.9375rem;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 0.25rem;
}

.file-meta {
    font-size: 0.75rem;
    color: var(--text-tertiary);
}

.file-download-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #06b6d4;
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    flex-shrink: 0;
    transition: all var(--transition-fast);
}

.file-download-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(6, 182, 212, 0.4);
}

/* --- 7. SURVEY CARD --- */
.survey-card {
    border-top: 3px solid var(--warning);
}

.survey-card-header {
    background: linear-gradient(135deg, #fffbeb, #fef9c3);
    padding: 1rem 1.25rem;
}

.survey-card-title {
    font-size: 0.9375rem;
    font-weight: 700;
    color: #78350f;
    margin-bottom: 0.25rem;
}

.survey-card-subtitle {
    font-size: 0.75rem;
    color: #92400e;
}

.survey-card-body {
    padding: 1rem 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.survey-option {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.625rem 0.875rem;
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all var(--transition-fast);
    font-size: 0.875rem;
}

.survey-option:hover {
    border-color: var(--warning);
    background: #fffbeb;
}

.survey-option.selected {
    border-color: var(--warning);
    background: #fef9c3;
    color: #78350f;
    font-weight: 600;
}

.survey-option input[type=radio] {
    accent-color: var(--warning);
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.survey-submit {
    margin: 0.25rem 1.25rem 1.25rem;
    padding: 0.75rem;
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: white;
    border: none;
    border-radius: var(--radius-lg);
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
    width: calc(100% - 2.5rem);
}

.survey-submit:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(245, 158, 11, 0.4);
}

/* Card star ratings (for surveys/reviews) */
.star-rating {
    display: flex;
    gap: 0.25rem;
    padding: 0.5rem 0;
}

.star {
    font-size: 1.5rem;
    cursor: pointer;
    color: #d1d5db;
    transition: color var(--transition-fast);
    line-height: 1;
}

.star.active,
.star:hover {
    color: var(--warning);
}

/* Success state for submitted forms */
.card-success-state {
    padding: 1.5rem;
    text-align: center;
}

.card-success-icon {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
}

.card-success-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--success);
    margin-bottom: 0.25rem;
}

.card-success-text {
    font-size: 0.8125rem;
    color: var(--text-secondary);
}

/* Skeleton Loader for Chat */
.skeleton-welcome {
    display: flex;
    flex-direction: column;
    align-items: center;
}

@keyframes pulse-skeleton {
    0% { opacity: 0.6; }
    50% { opacity: 0.2; }
    100% { opacity: 0.6; }
}

.skeleton-avatar {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: #E2E4E9;
    margin-bottom: 0.75rem;
    animation: pulse-skeleton 1.5s ease-in-out infinite;
}

.skeleton-title {
    width: 120px;
    height: 20px;
    border-radius: 4px;
    background: #E2E4E9;
    margin-bottom: 1rem;
    animation: pulse-skeleton 1.5s ease-in-out infinite;
}

.skeleton-text {
    width: 60%;
    height: 14px;
    border-radius: 4px;
    background: #E2E4E9;
    margin-bottom: 0.5rem;
    animation: pulse-skeleton 1.5s ease-in-out infinite;
}

.skeleton-text.short {
    width: 40%;
    margin-bottom: 1.5rem;
}

.skeleton-suggestions {
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.skeleton-pill {
    width: 90px;
    height: 32px;
    border-radius: 16px;
    background: #E2E4E9;
    animation: pulse-skeleton 1.5s ease-in-out infinite;
}
