/**
 * BOSCH PARTNER B2B CRM & INVENTORY SYSTEM - MATERIO DESIGN SYSTEM
 * Inspired by Materio CRM Admin Template (Clean, Modern, Corporate SaaS)
 */

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

:root {
    /* Materio Canvas & Surface Tokens */
    --bg-main: #f4f5fa;
    --bg-surface: #ffffff;
    --bg-card: #ffffff;
    --bg-card-hover: #fafafa;
    --bg-input: #ffffff;
    --bg-subtle: #f8f7fa;
    
    /* Materio Border & Divider */
    --border-color: rgba(47, 43, 61, 0.08);
    --border-color-light: rgba(47, 43, 61, 0.14);
    --border-input: #dbdade;
    
    /* Brand & Accent Colors */
    --primary: #666cff;
    --primary-hover: #565be0;
    --primary-light: rgba(102, 108, 255, 0.12);
    --primary-gradient: linear-gradient(72.47deg, #666cff 22.16%, rgba(102, 108, 255, 0.75) 76.47%);
    
    --bosch-blue: #005691;
    --bosch-blue-light: rgba(0, 86, 145, 0.12);
    --bosch-red: #E20015;
    --bosch-red-light: rgba(226, 0, 21, 0.12);
    
    /* Typography Colors */
    --color-text-heading: #2f2b3d;
    --color-text: #4b465c;
    --color-text-muted: #86848d;
    --color-text-dim: #a5a3ae;
    
    /* State & Feedback Colors (Materio Palette) */
    --success: #28c76f;
    --success-bg: rgba(40, 199, 111, 0.12);
    --warning: #ff9f43;
    --warning-bg: rgba(255, 159, 67, 0.12);
    --danger: #ea5455;
    --danger-bg: rgba(234, 84, 85, 0.12);
    --info: #00bad1;
    --info-bg: rgba(0, 186, 209, 0.12);
    --secondary: #86848d;
    --secondary-bg: rgba(134, 132, 141, 0.12);
    
    /* Layout Dimensions */
    --sidebar-width: 260px;
    --header-height: 70px;
    
    /* Corner Radii */
    --radius-xs: 4px;
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    --radius-full: 9999px;
    
    /* Materio Multi-layer Shadows */
    --shadow-xs: 0 1px 3px 0 rgba(47, 43, 61, 0.05);
    --shadow-sm: 0 2px 6px 0 rgba(47, 43, 61, 0.06);
    --shadow-card: 0 2px 10px 0 rgba(76, 78, 100, 0.08);
    --shadow-hover: 0 6px 18px 0 rgba(76, 78, 100, 0.12);
    --shadow-lg: 0 10px 25px 0 rgba(47, 43, 61, 0.14);
    --shadow-primary: 0 2px 6px 0 rgba(102, 108, 255, 0.38);
    --shadow-success: 0 2px 6px 0 rgba(40, 199, 111, 0.38);
    --shadow-danger: 0 2px 6px 0 rgba(234, 84, 85, 0.38);
}

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

body {
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--bg-main);
    color: var(--color-text);
    min-height: 100vh;
    display: flex;
    overflow-x: hidden;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* Typography Utility */
.font-mono {
    font-family: 'JetBrains Mono', monospace;
}

h1, h2, h3, h4, h5, h6 {
    color: var(--color-text-heading);
    font-weight: 700;
}

/* Custom Scrollbars */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: #dbdade;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #b6b4b8;
}

/* ==========================================================
   APP SIDEBAR (Materio Clean White Layout)
   ========================================================== */
.app-sidebar {
    width: var(--sidebar-width);
    background: var(--bg-surface);
    border-right: 1px solid var(--border-color);
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    z-index: 100;
    box-shadow: 0 0 15px 0 rgba(47, 43, 61, 0.04);
    transition: transform 0.3s ease;
}

/* Sidebar Header / Brand */
.sidebar-brand {
    padding: 1.25rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid var(--border-color);
}

.brand-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-lg);
    background: var(--primary-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    font-size: 1.2rem;
    box-shadow: var(--shadow-primary);
    flex-shrink: 0;
}

.brand-title {
    font-size: 1.1rem;
    font-weight: 800;
    letter-spacing: -0.3px;
    color: var(--color-text-heading);
    line-height: 1.2;
}

.brand-sub {
    font-size: 0.72rem;
    color: var(--bosch-blue);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
}

/* Sidebar Navigation Items */
.sidebar-nav {
    flex: 1;
    padding: 1.25rem 0.85rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.nav-category {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--color-text-dim);
    padding: 0.85rem 0.75rem 0.35rem;
    margin-top: 0.5rem;
}

.nav-category:first-child {
    margin-top: 0;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0.65rem 0.85rem;
    border-radius: var(--radius-md);
    color: var(--color-text);
    text-decoration: none;
    font-size: 0.88rem;
    font-weight: 500;
    transition: all 0.2s ease;
    position: relative;
}

.nav-link i {
    font-size: 1.15rem;
    width: 22px;
    text-align: center;
    color: var(--color-text-muted);
    transition: color 0.2s ease;
}

.nav-link:hover {
    color: var(--primary);
    background: var(--primary-light);
}

.nav-link:hover i {
    color: var(--primary);
}

.nav-link.active {
    color: #ffffff !important;
    background: var(--primary-gradient) !important;
    font-weight: 600;
    box-shadow: var(--shadow-primary);
}

.nav-link.active i {
    color: #ffffff !important;
}

.nav-badge {
    margin-left: auto;
    font-size: 0.72rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: var(--radius-full);
}

.nav-badge.badge-amber {
    background: var(--warning-bg);
    color: var(--warning);
}

.nav-badge.badge-red {
    background: var(--danger-bg);
    color: var(--danger);
}

/* Sidebar User Footer */
.sidebar-user {
    padding: 1rem 1.25rem;
    border-top: 1px solid var(--border-color);
    background: var(--bg-subtle);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.user-avatar {
    width: 38px;
    height: 38px;
    border-radius: var(--radius-full);
    background: var(--primary-light);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.88rem;
    flex-shrink: 0;
}

.user-info {
    flex: 1;
    margin-left: 10px;
    overflow: hidden;
}

.user-name {
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--color-text-heading);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-role {
    font-size: 0.72rem;
    color: var(--color-text-muted);
    text-transform: capitalize;
}

.user-logout-btn {
    color: var(--color-text-muted);
    transition: color 0.2s;
    text-decoration: none;
    padding: 4px;
}

.user-logout-btn:hover {
    color: var(--danger);
}

/* ==========================================================
   MAIN LAYOUT & HEADER (Materio Floating Card Style)
   ========================================================== */
.app-main {
    margin-left: var(--sidebar-width);
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    background: var(--bg-main);
}

.app-header {
    height: var(--header-height);
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
    padding: 0 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 90;
    box-shadow: 0 1px 4px 0 rgba(47, 43, 61, 0.04);
}

.app-content {
    padding: 1.75rem 2rem 2.5rem;
    flex: 1;
}

.page-title-box {
    display: flex;
    align-items: center;
    gap: 15px;
}

.page-title {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--color-text-heading);
    letter-spacing: -0.4px;
}

.header-search {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--bg-subtle);
    padding: 0.45rem 0.95rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    color: var(--color-text-muted);
    font-size: 0.85rem;
    min-width: 240px;
}

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

/* ==========================================================
   CARDS & MATERIO KPI GRID
   ========================================================== */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
    margin-bottom: 1.5rem;
    transition: box-shadow 0.2s ease, transform 0.2s ease;
    position: relative;
}

.card:hover {
    box-shadow: var(--shadow-hover);
}

.card-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: transparent;
}

.card-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--color-text-heading);
    display: flex;
    align-items: center;
    gap: 10px;
}

.card-title i {
    color: var(--primary);
}

.card-body {
    padding: 1.5rem;
}

/* KPI Cards (Materio CRM Stats Style) */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.25rem;
    margin-bottom: 1.5rem;
}

.kpi-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.4rem;
    box-shadow: var(--shadow-card);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
}

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

.kpi-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.75rem;
}

.kpi-label {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.kpi-icon {
    width: 42px;
    height: 42px;
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    flex-shrink: 0;
}

.kpi-blue .kpi-icon   { background: var(--primary-light); color: var(--primary); }
.kpi-green .kpi-icon  { background: var(--success-bg);    color: var(--success); }
.kpi-amber .kpi-icon  { background: var(--warning-bg);    color: var(--warning); }
.kpi-red .kpi-icon    { background: var(--danger-bg);     color: var(--danger); }
.kpi-info .kpi-icon   { background: var(--info-bg);       color: var(--info); }

.kpi-value {
    font-size: 1.75rem;
    font-weight: 800;
    letter-spacing: -0.5px;
    color: var(--color-text-heading);
    margin-bottom: 6px;
    line-height: 1.1;
}

.kpi-footer {
    font-size: 0.82rem;
    color: var(--color-text-muted);
    display: flex;
    align-items: center;
    gap: 6px;
}

/* High-Visibility Bounced Cheque Banner */
.alert-bounced-banner {
    background: #fff5f5;
    border: 1px solid rgba(234, 84, 85, 0.3);
    border-left: 5px solid var(--danger);
    border-radius: var(--radius-lg);
    padding: 1.15rem 1.5rem;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: var(--shadow-sm);
}

.alert-bounced-content {
    display: flex;
    align-items: center;
    gap: 15px;
}

.alert-bounced-icon {
    width: 42px;
    height: 42px;
    border-radius: var(--radius-full);
    background: var(--danger-bg);
    color: var(--danger);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    flex-shrink: 0;
}

/* ==========================================================
   TABLES (Materio Clean Data Grids)
   ========================================================== */
.table-responsive {
    width: 100%;
    overflow-x: auto;
}

.table-custom {
    width: 100%;
    border-collapse: collapse;
}

.table-custom th {
    background: var(--bg-subtle);
    color: var(--color-text-muted);
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    padding: 0.85rem 1.2rem;
    border-bottom: 1px solid var(--border-color);
    text-align: left;
}

.table-custom td {
    padding: 0.95rem 1.2rem;
    font-size: 0.88rem;
    color: var(--color-text);
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
}

.table-custom tbody tr {
    transition: background-color 0.15s ease;
}

.table-custom tbody tr:hover {
    background-color: var(--bg-card-hover);
}

.table-custom tbody tr:last-child td {
    border-bottom: none;
}

/* ==========================================================
   STATUS BADGES & PILLS (Materio Pastel Aesthetic)
   ========================================================== */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 10px;
    border-radius: var(--radius-full);
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: capitalize;
    letter-spacing: 0.2px;
    white-space: nowrap;
}

.badge-success { background: var(--success-bg); color: var(--success); }
.badge-warning { background: var(--warning-bg); color: var(--warning); }
.badge-danger  { background: var(--danger-bg);  color: var(--danger); }
.badge-info    { background: var(--info-bg);    color: var(--info); }
.badge-primary { background: var(--primary-light); color: var(--primary); }
.badge-secondary { background: var(--secondary-bg); color: var(--secondary); }

/* Fulfillment Progress Bars */
.fulfillment-bar {
    width: 100%;
    height: 8px;
    background: var(--bg-subtle);
    border-radius: var(--radius-full);
    overflow: hidden;
    position: relative;
}

.fulfillment-fill {
    height: 100%;
    background: var(--primary-gradient);
    border-radius: var(--radius-full);
    transition: width 0.5s ease;
}

.fulfillment-fill.full {
    background: var(--success);
}

/* ==========================================================
   BUTTONS (Materio Elevated Buttons)
   ========================================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 0.55rem 1.15rem;
    border-radius: var(--radius-md);
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    border: 1px solid transparent;
    transition: all 0.2s ease;
    font-family: inherit;
    line-height: 1.4;
}

.btn-sm {
    padding: 0.35rem 0.75rem;
    font-size: 0.8rem;
    border-radius: var(--radius-sm);
}

.btn-primary {
    background: var(--primary-gradient);
    color: #ffffff;
    box-shadow: var(--shadow-primary);
}

.btn-primary:hover {
    background: var(--primary-hover);
    color: #ffffff;
    transform: translateY(-1px);
    box-shadow: 0 4px 10px 0 rgba(102, 108, 255, 0.45);
}

.btn-danger {
    background: var(--danger);
    color: #ffffff;
    box-shadow: var(--shadow-danger);
}

.btn-danger:hover {
    background: #d33c3d;
    color: #ffffff;
    transform: translateY(-1px);
}

.btn-success {
    background: var(--success);
    color: #ffffff;
    box-shadow: var(--shadow-success);
}

.btn-success:hover {
    background: #23ad60;
    color: #ffffff;
    transform: translateY(-1px);
}

.btn-secondary {
    background: #ffffff;
    color: var(--color-text);
    border: 1px solid var(--border-input);
    box-shadow: var(--shadow-xs);
}

.btn-secondary:hover {
    background: var(--bg-subtle);
    color: var(--color-text-heading);
    border-color: #c4c2c7;
}

/* ==========================================================
   FORMS & INPUT CONTROLS
   ========================================================== */
.form-group {
    margin-bottom: 1.25rem;
}

label {
    display: block;
    font-size: 0.84rem;
    font-weight: 600;
    color: var(--color-text-heading);
    margin-bottom: 0.4rem;
}

.form-control, .form-select {
    width: 100%;
    padding: 0.6rem 0.9rem;
    background: var(--bg-input);
    border: 1px solid var(--border-input);
    border-radius: var(--radius-md);
    color: var(--color-text-heading);
    font-size: 0.9rem;
    font-family: inherit;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-control:focus, .form-select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(102, 108, 255, 0.15);
}

.form-control::placeholder {
    color: var(--color-text-dim);
}

/* ==========================================================
   MODALS (Materio Elevated Popups)
   ========================================================== */
.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(47, 43, 61, 0.5);
    backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 1.5rem;
}

.modal-backdrop.show {
    display: flex;
}

.modal-dialog {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    width: 100%;
    max-width: 620px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    animation: modalSlideUp 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-dialog.modal-lg {
    max-width: 820px;
}

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

.modal-header {
    padding: 1.25rem 1.75rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--color-text-heading);
}

.modal-close {
    background: none;
    border: none;
    color: var(--color-text-muted);
    font-size: 1.35rem;
    cursor: pointer;
    transition: color 0.15s;
    line-height: 1;
}

.modal-close:hover {
    color: var(--color-text-heading);
}

.modal-body {
    padding: 1.75rem;
}

.modal-footer {
    padding: 1.25rem 1.75rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    background: var(--bg-subtle);
    border-bottom-left-radius: var(--radius-xl);
    border-bottom-right-radius: var(--radius-xl);
}

/* ==========================================================
   ACTIVITY FEED (Materio Timeline)
   ========================================================== */
.activity-feed {
    display: flex;
    flex-direction: column;
    gap: 16px;
    position: relative;
}

.activity-item {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
}

.activity-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.activity-icon {
    width: 34px;
    height: 34px;
    border-radius: var(--radius-full);
    background: var(--primary-light);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    flex-shrink: 0;
}

.activity-content {
    flex: 1;
}

.activity-title {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--color-text-heading);
    margin-bottom: 2px;
}

.activity-time {
    font-size: 0.76rem;
    color: var(--color-text-muted);
}

/* ==========================================================
   FLASH MESSAGES & ALERTS
   ========================================================== */
.alert {
    padding: 0.95rem 1.25rem;
    border-radius: var(--radius-md);
    margin-bottom: 1.25rem;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.9rem;
}

.alert-success { background: #e8fadf; color: #1e7e34; border-left: 4px solid var(--success); }
.alert-danger  { background: #fce8e8; color: #b71c1c; border-left: 4px solid var(--danger); }
.alert-warning { background: #fff4e5; color: #b76e00; border-left: 4px solid var(--warning); }
.alert-info    { background: #e0f7fa; color: #00838f; border-left: 4px solid var(--info); }

/* ==========================================================
   RESPONSIVE ADJUSTMENTS
   ========================================================== */
@media (max-width: 992px) {
    .app-sidebar {
        transform: translateX(-100%);
    }
    .app-sidebar.open {
        transform: translateX(0);
    }
    .app-main {
        margin-left: 0;
    }
    .app-content {
        padding: 1.25rem;
    }
}

/* ==========================================================
   PHASE 4: MODERN SAAS CARD LAYOUT - AI CHAT ASSISTANT
   ========================================================== */
.ai-assistant-widget {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 1060;
    font-family: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
}

/* Floating Trigger Button */
.ai-trigger-btn {
    width: 54px;
    height: 54px;
    border-radius: 50%;
    background: linear-gradient(135deg, #2563eb 0%, #4f46e5 100%);
    color: #ffffff;
    border: none;
    box-shadow: 0 8px 24px rgba(37, 99, 235, 0.38);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.35rem;
    position: relative;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    outline: none;
}

.ai-trigger-btn:hover {
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 12px 28px rgba(37, 99, 235, 0.5);
}

.ai-trigger-btn .ai-trigger-icon-open {
    display: flex;
    transition: transform 0.25s;
}

.ai-trigger-btn .ai-trigger-icon-close {
    display: none;
    font-size: 1.25rem;
}

.ai-trigger-btn.chat-open {
    background: #0f172a;
    box-shadow: 0 6px 20px rgba(15, 23, 42, 0.3);
    transform: rotate(90deg);
}

.ai-trigger-btn.chat-open .ai-trigger-icon-open {
    display: none;
}

.ai-trigger-btn.chat-open .ai-trigger-icon-close {
    display: flex;
}

/* Floating AI Chat Window (Modern SaaS Card Layout) */
.ai-chat-window {
    position: fixed;
    bottom: 88px;
    right: 24px;
    width: 480px;
    max-width: calc(100vw - 32px);
    height: 680px;
    max-height: calc(100vh - 110px);
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 1.5rem; /* rounded-3xl */
    box-shadow: 0 25px 50px -12px rgba(15, 23, 42, 0.22);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 1060;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(16px) scale(0.97);
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.ai-chat-window.active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateY(0) scale(1);
}

.ai-chat-window.maximized {
    width: 780px;
    height: 85vh;
}

/* Drag & Drop Overlay */
.ai-drop-overlay {
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.96);
    border: 2px dashed #3b82f6;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    z-index: 100;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
    backdrop-filter: blur(4px);
    border-radius: 1.5rem;
}

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

.ai-drop-icon {
    font-size: 2.5rem;
    animation: bounce 1.2s infinite;
}

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

/* Header Bar */
.ai-chat-header {
    padding: 0.85rem 1.15rem;
    border-bottom: 1px solid #f1f5f9;
    background: #ffffff;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.ai-personalize-btn {
    border: 1px solid #e2e8f0;
    background: #f8fafc;
    color: #475569;
    font-size: 0.76rem;
    font-weight: 500;
    padding: 3px 8px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    cursor: pointer;
    transition: all 0.15s;
}

.ai-personalize-btn:hover {
    background: #f1f5f9;
    color: #0f172a;
    border-color: #cbd5e1;
}

.ai-header-action-btn {
    background: transparent;
    border: none;
    color: #94a3b8;
    width: 28px;
    height: 28px;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
}

.ai-header-action-btn:hover {
    background: #f1f5f9;
    color: #334155;
}

/* Messages Feed */
.ai-messages-feed {
    flex: 1;
    overflow-y: auto;
    padding: 1.15rem;
    display: flex;
    flex-direction: column;
    gap: 14px;
    background: #f8fafc;
    scroll-behavior: smooth;
}

/* Message Rows */
.ai-message-row {
    display: flex;
    gap: 10px;
    width: 100%;
}

.ai-message-row.user-msg {
    justify-content: flex-end;
}

.ai-message-row.ai-msg {
    justify-content: flex-start;
}

.ai-avatar-box {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #eff6ff;
    border: 1px solid #dbeafe;
    color: #2563eb;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.78rem;
    flex-shrink: 0;
    margin-top: 2px;
}

.ai-bubble-wrap {
    max-width: 86%;
    display: flex;
    flex-direction: column;
}

.ai-bubble {
    padding: 10px 14px;
    border-radius: 18px;
    font-size: 0.88rem;
    line-height: 1.5;
    word-break: break-word;
}

.user-bubble {
    background: #2563eb;
    color: #ffffff;
    border-bottom-right-radius: 4px;
    max-width: 84%;
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.2);
}

.ai-bubble-content {
    background: #ffffff;
    color: #1e293b;
    border: 1px solid #e2e8f0;
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

/* Inline Document Capsule Asset */
.ai-doc-capsule {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    color: #1e40af;
    padding: 4px 10px;
    border-radius: 9999px;
    font-size: 0.78rem;
    font-weight: 500;
    box-shadow: 0 1px 2px rgba(37, 99, 235, 0.05);
}

.ai-doc-title {
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 600;
}

.ai-doc-badge {
    background: #dbeafe;
    color: #1d4ed8;
    padding: 2px 7px;
    border-radius: 9999px;
    font-size: 0.7rem;
    font-weight: 600;
}

.ai-doc-remove {
    background: none;
    border: none;
    color: #60a5fa;
    cursor: pointer;
    font-size: 1.15rem;
    line-height: 1;
    padding: 0 2px;
    transition: color 0.15s;
}

.ai-doc-remove:hover {
    color: #ef4444;
}

/* Quick-Action Informational Alert Strip */
.ai-info-pill {
    background: #eff6ff;
    border: 1px solid #dbeafe;
    color: #1e40af;
    border-radius: 12px;
    padding: 7px 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.78rem;
}

/* Prompt Suggestion List Choices */
.ai-suggestion-item {
    display: block;
    width: 100%;
    text-align: left;
    background: transparent;
    border: none;
    padding: 6px 8px;
    border-radius: 8px;
    font-size: 0.82rem;
    color: #475569;
    cursor: pointer;
    transition: all 0.15s;
    line-height: 1.4;
}

.ai-suggestion-item:hover {
    background: #f1f5f9;
    color: #0f172a;
    padding-left: 12px;
}

.ai-suggestion-arrow {
    color: #2563eb;
    font-weight: bold;
    margin-right: 6px;
}

/* Typing indicator */
.ai-bubble-typing {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-bottom-left-radius: 4px;
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 10px 14px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.ai-dot {
    width: 6px;
    height: 6px;
    background: #3b82f6;
    border-radius: 50%;
    animation: aiDotPulse 1.4s infinite ease-in-out both;
}

.ai-dot:nth-child(1) { animation-delay: -0.32s; }
.ai-dot:nth-child(2) { animation-delay: -0.16s; }

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

/* Primary Prompt Input Card Component */
.ai-bottom-area {
    padding: 0.85rem;
    background: #ffffff;
    border-top: 1px solid #f1f5f9;
}

.ai-input-card {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    padding: 10px 12px;
    transition: all 0.2s;
}

.ai-input-card:focus-within {
    background: #ffffff;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12);
}

.ai-chat-input {
    width: 100%;
    max-height: 140px;
    min-height: 44px;
    padding: 0;
    border: none;
    background: transparent;
    color: #0f172a;
    font-size: 0.88rem;
    line-height: 1.5;
    outline: none;
    resize: none;
    font-family: inherit;
}

.ai-chat-input::placeholder {
    color: #94a3b8;
}

.ai-attach-btn {
    background: transparent;
    border: none;
    color: #94a3b8;
    width: 28px;
    height: 28px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.15s;
}

.ai-attach-btn:hover {
    background: #f1f5f9;
    color: #2563eb;
}

.ai-send-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #2563eb;
    border: none;
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    cursor: pointer;
    flex-shrink: 0;
    transition: all 0.15s;
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.3);
}

.ai-send-btn:hover {
    background: #1d4ed8;
    transform: scale(1.05);
}

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


