/* ═══════════════════════════════════════════════════════════════════════════
   Call Connect AI CRM — Design System
   ═══════════════════════════════════════════════════════════════════════════ */

:root {
    --ccai-blue:       #378ADD;
    --ccai-blue-dark:  #185FA5;
    --ccai-dark:       #1a3a5c;
    --ccai-sidebar-bg: #0f2740;
    --ccai-sidebar-w:  210px;
    --ccai-navbar-h:   52px;
    --ccai-bg:         #f4f7fb;
    --ccai-card-bg:    #ffffff;
    --ccai-border:     #e2e8f0;
    --ccai-text:       #1e293b;
    --ccai-muted:      #64748b;
    --ccai-green:      #639922;
    --ccai-orange:     #BA7517;
    --ccai-red:        #D85A30;
}

/* ── Base ─────────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

body.ccai-app {
    background: var(--ccai-bg);
    color: var(--ccai-text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 14px;
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a { color: var(--ccai-blue); }
.text-ccai-blue { color: var(--ccai-blue) !important; }
.bg-ccai-dark   { background-color: var(--ccai-dark) !important; }
.fw-500         { font-weight: 500; }
.fw-600         { font-weight: 600; }

/* ── Top navbar ───────────────────────────────────────────────────────────── */
.ccai-navbar {
    height: var(--ccai-navbar-h);
    background: var(--ccai-dark);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 1px 4px rgba(0,0,0,.25);
    flex-shrink: 0;
}

.ccai-brand {
    font-size: 15px;
    font-weight: 600;
    color: #fff;
    letter-spacing: .01em;
}

/* Logo fallback dots */
.ccai-logo-fallback { display: flex; align-items: center; gap: 3px; }
.ccai-logo-dot { border-radius: 50%; display: block; }
.ccai-logo-dot.blue        { width: 10px; height: 10px; background: var(--ccai-blue); }
.ccai-logo-dot.dark        { width: 8px;  height: 8px;  background: #93c5fd; }
.ccai-logo-dot.blue.small  { width: 6px;  height: 6px;  background: var(--ccai-blue); }

/* ── Sidebar ──────────────────────────────────────────────────────────────── */
.ccai-sidebar {
    width: var(--ccai-sidebar-w);
    background: var(--ccai-sidebar-bg);
    flex-shrink: 0;
    padding-top: 12px;
    overflow-y: auto;
}

.ccai-nav-section {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: #5a7a9a;
    padding: 8px 16px 2px;
    margin: 0;
    font-weight: 600;
}

.ccai-nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 16px;
    color: #93b4d0;
    text-decoration: none;
    font-size: 13.5px;
    border-left: 3px solid transparent;
    transition: background .15s, color .15s, border-color .15s;
}

.ccai-nav-item i { font-size: 15px; flex-shrink: 0; }

.ccai-nav-item:hover {
    background: rgba(255,255,255,.07);
    color: #fff;
    border-left-color: var(--ccai-blue);
}

.ccai-nav-item.active {
    background: rgba(55,138,221,.18);
    color: #fff;
    border-left-color: var(--ccai-blue);
    font-weight: 500;
}

/* ── Main content ─────────────────────────────────────────────────────────── */
.ccai-main {
    min-height: 0;
    overflow-y: auto;
}

/* ── Page titles ──────────────────────────────────────────────────────────── */
.ccai-page-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--ccai-dark);
    line-height: 1.2;
}

.ccai-page-sub {
    color: var(--ccai-muted);
    font-size: 13px;
    margin-bottom: 0;
}

/* ── Stat cards ───────────────────────────────────────────────────────────── */
.ccai-stat {
    background: var(--ccai-card-bg);
    border: 1px solid var(--ccai-border);
    border-radius: 10px;
    padding: 16px 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,.04);
}

.ccai-stat-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--ccai-muted);
    font-weight: 600;
    margin-bottom: 4px;
}

.ccai-stat-value {
    font-size: 26px;
    font-weight: 700;
    color: var(--ccai-dark);
    line-height: 1.1;
}

.ccai-stat-sub {
    font-size: 11px;
    color: var(--ccai-green);
    margin-top: 4px;
}

.ccai-stat-sub.neutral { color: var(--ccai-muted); }

/* ── Cards ────────────────────────────────────────────────────────────────── */
.ccai-card {
    background: var(--ccai-card-bg);
    border: 1px solid var(--ccai-border);
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,.04);
}

.ccai-card-header {
    padding: 10px 16px;
    font-size: 13px;
    font-weight: 600;
    color: var(--ccai-dark);
    background: #f8fafc;
    border-bottom: 1px solid var(--ccai-border);
}

/* ── Charts ───────────────────────────────────────────────────────────────── */
.chart-container {
    background: var(--ccai-card-bg);
    border: 1px solid var(--ccai-border);
    border-radius: 10px;
    overflow: hidden;
    padding: 0;
    box-shadow: 0 1px 3px rgba(0,0,0,.04);
}

.chart-container-title {
    padding: 10px 16px 6px;
    font-size: 12px;
    font-weight: 600;
    color: var(--ccai-muted);
    text-transform: uppercase;
    letter-spacing: .05em;
    background: #f8fafc;
    border-bottom: 1px solid var(--ccai-border);
}

/* ── Tables ───────────────────────────────────────────────────────────────── */
.ccai-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.ccai-table th {
    padding: 8px 14px;
    text-align: left;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--ccai-muted);
    background: #f8fafc;
    border-bottom: 1px solid var(--ccai-border);
}

.ccai-table td {
    padding: 10px 14px;
    border-bottom: 1px solid #f1f5f9;
    vertical-align: middle;
    color: var(--ccai-text);
}

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

.ccai-table tbody tr:hover { background: #f8fafc; }

/* ── Badges / status pills ────────────────────────────────────────────────── */
.badge-pro, .badge-start, .badge-payg,
.badge-paid, .badge-pend, .badge-inact {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
}

.badge-pro   { background: #dbeafe; color: #1e40af; }
.badge-start { background: #dcfce7; color: #166534; }
.badge-payg  { background: #fef9c3; color: #854d0e; }
.badge-paid  { background: #dcfce7; color: #166534; }
.badge-pend  { background: #fef3c7; color: #92400e; }
.badge-inact { background: #f1f5f9; color: #64748b; }

/* Lead stage colour aliases for detail view */
.badge-stage-new         { @extend .badge-payg; }
.badge-stage-contacted   { background: #e0f2fe; color: #0369a1; display:inline-block; padding:2px 8px; border-radius:12px; font-size:11px; font-weight:600; }
.badge-stage-demobooked  { background: #fde68a; color: #92400e; display:inline-block; padding:2px 8px; border-radius:12px; font-size:11px; font-weight:600; }
.badge-stage-proposalsent{ background: #c7d2fe; color: #3730a3; display:inline-block; padding:2px 8px; border-radius:12px; font-size:11px; font-weight:600; }
.badge-stage-won         { background: #dcfce7; color: #166534; display:inline-block; padding:2px 8px; border-radius:12px; font-size:11px; font-weight:600; }
.badge-stage-lost        { background: #fee2e2; color: #991b1b; display:inline-block; padding:2px 8px; border-radius:12px; font-size:11px; font-weight:600; }

/* ── Buttons ──────────────────────────────────────────────────────────────── */
.btn-ccai {
    background: var(--ccai-dark);
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 7px 16px;
    font-size: 13px;
    font-weight: 500;
    transition: background .15s;
    cursor: pointer;
}

.btn-ccai:hover { background: #0e2236; color: #fff; }

.btn-ccai-blue {
    background: var(--ccai-blue);
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 7px 16px;
    font-size: 13px;
    font-weight: 500;
    transition: background .15s;
    cursor: pointer;
}

.btn-ccai-blue:hover { background: var(--ccai-blue-dark); color: #fff; }

/* ── Forms ────────────────────────────────────────────────────────────────── */
.ccai-form-label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--ccai-muted);
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.form-control, .form-select {
    border-radius: 6px;
    border: 1px solid #cbd5e1;
    font-size: 13.5px;
    color: var(--ccai-text);
    transition: border-color .15s, box-shadow .15s;
}

.form-control:focus, .form-select:focus {
    border-color: var(--ccai-blue);
    box-shadow: 0 0 0 3px rgba(55,138,221,.15);
    outline: none;
}

/* ── Kanban lead cards ────────────────────────────────────────────────────── */
.ccai-lead-card {
    transition: box-shadow .15s, transform .1s;
    cursor: pointer;
}

.ccai-lead-card:hover {
    box-shadow: 0 3px 10px rgba(0,0,0,.1);
    transform: translateY(-1px);
}

/* ── Login page ───────────────────────────────────────────────────────────── */
.ccai-login-bg {
    background: linear-gradient(135deg, #0f2740 0%, #1a3a5c 50%, #0f2740 100%);
    display: flex;
    flex-direction: column;
}

.ccai-login-topbar {
    padding: 12px 24px;
    border-bottom: 1px solid rgba(255,255,255,.1);
    flex-shrink: 0;
}

.ccai-login-topbar .ccai-brand { color: #fff; }

.ccai-login-card {
    background: #fff;
    border-radius: 14px;
    padding: 36px 40px;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 24px 64px rgba(0,0,0,.35);
}

.ccai-login-logo-wrap {
    width: 56px;
    height: 56px;
    background: var(--ccai-blue);
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 8px;
    box-shadow: 0 4px 14px rgba(55,138,221,.35);
}

/* ── Scrollbar ────────────────────────────────────────────────────────────── */
::-webkit-scrollbar       { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }

/* ── Alerts ───────────────────────────────────────────────────────────────── */
.alert { border-radius: 8px; font-size: 13.5px; }

/* ── Responsive ───────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
    .ccai-sidebar { width: 60px; }
    .ccai-nav-item span, .ccai-nav-section { display: none; }
    .ccai-nav-item { justify-content: center; gap: 0; }
    .ccai-main { padding: 16px !important; }
}

/* ═══════════════════════════════════════════════════════════════════════════
   v6 — User dropdown navbar (issues 2, 3, 4, 5)
   ═══════════════════════════════════════════════════════════════════════════ */

/* User button in navbar */
.ccai-user-btn {
    background: rgba(255,255,255,.08);
    border: 1px solid rgba(255,255,255,.15);
    border-radius: 8px;
    color: #fff !important;
    padding: 5px 10px;
    transition: background .15s;
}
.ccai-user-btn:hover,
.ccai-user-btn:focus,
.ccai-user-btn.show {
    background: rgba(255,255,255,.15);
    color: #fff !important;
    border-color: rgba(255,255,255,.25);
    box-shadow: none;
}
.ccai-user-btn .dropdown-toggle::after { display: none; }

/* Avatar circle */
.ccai-avatar {
    width: 30px;
    height: 30px;
    background: var(--ccai-blue);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    flex-shrink: 0;
    color: #fff;
}

/* Name + role text in button */
.ccai-user-name {
    font-size: 13px;
    font-weight: 500;
    color: #fff;
    line-height: 1.2;
}
.ccai-user-role {
    font-size: 10px;
    color: rgba(255,255,255,.55);
    line-height: 1;
}

/* Chevron icon */
.ccai-chevron {
    font-size: 10px;
    color: rgba(255,255,255,.5);
    margin-left: 2px;
}

/* Dropdown menu */
.ccai-user-dropdown {
    min-width: 220px;
    border-radius: 10px;
    border: 1px solid var(--ccai-border);
    padding: 4px 0;
    margin-top: 4px;
}

.ccai-user-dropdown .dropdown-header {
    padding: 10px 16px 8px;
    color: var(--ccai-text);
}

.ccai-user-dropdown .dropdown-item {
    font-size: 13.5px;
    padding: 8px 16px;
    color: var(--ccai-text);
    border-radius: 0;
    transition: background .1s;
}

.ccai-user-dropdown .dropdown-item:hover {
    background: #f8fafc;
}

.ccai-user-dropdown .dropdown-item.text-danger:hover {
    background: #fff5f5;
}

/* ═══════════════════════════════════════════════════════════════════════════
   v6 — Lead pipeline admin label
   ═══════════════════════════════════════════════════════════════════════════ */
.badge-admin-lead {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    background: #f1f5f9;
    color: #475569;
}

/* ═══════════════════════════════════════════════════════════════════════════
   v16 — Mobile sidebar + hamburger
   ═══════════════════════════════════════════════════════════════════════════ */

/* Hamburger button */
.ccai-hamburger {
    background: rgba(255,255,255,.1);
    border: 1px solid rgba(255,255,255,.2);
    color: #fff;
    border-radius: 6px;
    padding: 4px 8px;
    line-height: 1;
}
.ccai-hamburger:hover { background: rgba(255,255,255,.18); color: #fff; }

/* Overlay (mobile only) */
.ccai-sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.45);
    z-index: 1040;
}

/* Desktop: sidebar always visible */
@media (min-width: 992px) {
    .ccai-sidebar {
        position: relative !important;
        transform: none !important;
        box-shadow: none !important;
        z-index: auto !important;
    }
    .ccai-sidebar-overlay { display: none !important; }
    .ccai-hamburger { display: none !important; }
}

/* Mobile: sidebar hidden off-screen, slides in when .sidebar-open */
@media (max-width: 991.98px) {
    .ccai-sidebar {
        position: fixed !important;
        top: 52px;              /* below navbar */
        left: 0;
        height: calc(100vh - 52px);
        z-index: 1045;
        transform: translateX(-100%);
        transition: transform .22s ease;
        box-shadow: 4px 0 24px rgba(0,0,0,.18);
        overflow-y: auto;
        width: 220px !important;
        min-width: 220px !important;
    }
    .ccai-sidebar.sidebar-open {
        transform: translateX(0);
    }
    .ccai-main {
        width: 100% !important;
        padding: 16px !important;
    }
}
