/* Prospect Agent — custom styles */

:root {
    --brand-primary: #1B1B4E;
    --brand-gold: #F59E0B;
}

/* ── Global base ── */
body { font-size: 11px; }
.alert { font-size: 11px; }
.btn { font-size: 11px; }
.card-text { font-size: 11px; }
.table { font-size: 11px; }
.form-label { font-size: 11px; }
.form-control { font-size: 11px; }
.form-check-label { font-size: 11px; }
.card-footer { font-size: 11px; }
.text-muted.small { font-size: 11px !important; }

/* ── Layout helpers ── */
/* Padding-top compensates for the fixed-top navbar (≈56 px including its shadow + ~1 rem breathing room). */
.main-content { min-height: calc(100vh - 56px); background: #f5f6fa; padding-bottom: 2rem; padding-top: 5rem !important; }

/* ── Top navbar (replaces the previous sidebar layout) ── */
.navbar-pa {
    background: linear-gradient(180deg, #232366 0%, var(--brand-primary) 100%);
    padding: 0.55rem 0;
}
.navbar-pa .navbar-brand { color: var(--brand-gold); font-size: 1.05rem; letter-spacing: 0.02em; }
.navbar-pa .navbar-brand:hover { color: #fbbf24; }
.navbar-pa .nav-link { color: rgba(255,255,255,0.82); font-size: 12px; padding: 0.45rem 0.9rem; border-radius: 4px; transition: background-color .15s ease, color .15s ease; }
.navbar-pa .nav-link:hover { color: #fff; background: rgba(255,255,255,0.08); }
.navbar-pa .nav-link.active { color: #fff; background: rgba(245,158,11,0.18); box-shadow: inset 0 -2px 0 var(--brand-gold); }
.navbar-pa .dropdown-menu { font-size: 12px; min-width: 9rem; border: 0; }
.navbar-pa .dropdown-item:active { background-color: var(--brand-primary); }
.navbar-pa .navbar-toggler { border-color: rgba(255,255,255,0.3); }
.sidebar-section-label { letter-spacing: .05rem; }  /* still referenced inside dashboard */

/* ── 3D depth effects ── */
.shadow-3d {
    box-shadow: 0 4px 8px rgba(27, 27, 78, 0.12), 0 1px 2px rgba(27, 27, 78, 0.18);
}
.shadow-3d-sm {
    box-shadow: 0 2px 4px rgba(27, 27, 78, 0.08), 0 1px 1px rgba(27, 27, 78, 0.12);
}
.card { box-shadow: 0 2px 6px rgba(27,27,78,0.07), 0 1px 2px rgba(27,27,78,0.10); border: 0; }
.card:hover { box-shadow: 0 4px 12px rgba(27,27,78,0.10), 0 2px 4px rgba(27,27,78,0.12); transition: box-shadow .2s ease; }
.btn-3d {
    box-shadow: 0 1px 0 rgba(0,0,0,0.05), 0 1px 2px rgba(0,0,0,0.10);
    transition: transform .08s ease, box-shadow .12s ease;
}
.btn-3d:active {
    transform: translateY(1px);
    box-shadow: 0 0 0 rgba(0,0,0,0), 0 0 1px rgba(0,0,0,0.10);
}
.btn { box-shadow: 0 1px 0 rgba(0,0,0,0.04), 0 1px 2px rgba(0,0,0,0.08); }
.btn:active { transform: translateY(1px); }
.form-control:focus, .form-select:focus {
    box-shadow: 0 0 0 0.2rem rgba(27,27,78,0.15), inset 0 1px 2px rgba(27,27,78,0.06);
}

/* ── Semantic label classes (replace inline styles) ── */
.section-heading { color: var(--brand-primary); font-size: 1.1rem; }
.card-header-label { color: var(--brand-primary); font-size: 12px; }

/* ── Login page ── */
body.login-page { background-color: #f0f2f5; }
.login-card { width: 100%; max-width: 420px; }
.login-brand { color: var(--brand-primary); font-weight: 700; font-size: 1.4rem; }
.login-subtitle { color: #6c757d; font-size: 11px; }
.accent-bar { height: 4px; background-color: var(--brand-gold); border-radius: 2px 2px 0 0; }

/* ── Badge variants ── */
.badge-admin { background-color: #6B1D2A; }
.badge-hot { background-color: #F59E0B; color: var(--brand-primary); }

/* Status badges */
.badge-unverified { background-color: #ffc107; color: #000; }
.badge-verified { background-color: #198754; color: #fff; }
.badge-rejected { background-color: #6c757d; color: #fff; }

/* Chat panel — collapses to a small placeholder when empty, grows with content up to 400px */
#chat-messages { min-height: 80px; max-height: 400px; overflow-y: auto; background: #f8f9fa; padding: 0.75rem; border-radius: 4px; font-size: 13px; }
#chat-messages:empty::before { content: 'Ask the agent about these prospects \2014 try one of the templates below.'; color: #6c757d; font-style: italic; }
.chat-msg-user { text-align: right; }
.chat-msg-user .bubble { background: var(--brand-primary); color: #fff; display: inline-block; padding: 6px 12px; border-radius: 12px 12px 2px 12px; max-width: 80%; font-size: 13px; }
.chat-msg-agent .bubble { background: #e9ecef; color: #212529; display: inline-block; padding: 6px 12px; border-radius: 12px 12px 12px 2px; max-width: 80%; font-size: 13px; }

/* Results layout — full-width table; chat moved to floating widget */
.results-fullwidth { width: 100%; max-width: 1500px; margin-inline: auto; }

/* Info icons (ⓘ) on column headers + stat cards — click for help popover */
.info-i {
    background: transparent; border: 0; padding: 0; margin-left: 4px;
    font-size: 11px; line-height: 1; cursor: pointer; opacity: 0.6;
    color: inherit;
}
.info-i:hover, .info-i:focus { opacity: 1; outline: none; }
.info-i-light { color: rgba(255,255,255,0.7); }
.info-i-light:hover, .info-i-light:focus { color: #fff; }
.stat-card { position: relative; }
.stat-card .info-i { position: absolute; top: 6px; right: 8px; }
.popover { font-size: 11px; max-width: 320px; }
.popover-header { font-size: 12px; }

/* Stats strip — six metric cards in one horizontal row, uses horizontal space on wide screens */
.stats-strip { display: grid; grid-template-columns: repeat(6, 1fr); gap: 12px; }
@media (max-width: 991px) { .stats-strip { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 575px) { .stats-strip { grid-template-columns: repeat(2, 1fr); } }
.stat-card {
    background: #fff; border-radius: 8px; padding: 14px 16px;
    box-shadow: 0 2px 6px rgba(27,27,78,0.08), 0 1px 2px rgba(27,27,78,0.10);
    border-left: 3px solid var(--brand-primary);
    transition: transform .15s ease, box-shadow .2s ease;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: 0 6px 16px rgba(27,27,78,0.12); }
.stat-num   { font-size: 22px; font-weight: 700; color: var(--brand-primary); line-height: 1.15; }
.stat-label { font-size: 11px; color: #6c757d; margin-top: 2px; text-transform: uppercase; letter-spacing: 0.04em; }
.stat-verified { border-left-color: #198754; } .stat-verified .stat-num { color: #198754; }
.stat-hot      { border-left-color: #F59E0B; } .stat-hot      .stat-num { color: #F59E0B; }
.stat-nosite   { border-left-color: #6B1D2A; } .stat-nosite   .stat-num { color: #6B1D2A; }
.stat-avg      { border-left-color: #0a66c2; } .stat-avg      .stat-num { color: #0a66c2; }
.stat-reach    { border-left-color: #7c3aed; } .stat-reach    .stat-num { color: #7c3aed; }

/* Prospects table — explicit column widths so the Business column stops
   stretching to fit the longest name and leaving white-space for shorter ones. */
#prospects-table { table-layout: fixed; width: 100%; }
#prospects-table th:nth-child(1), #prospects-table td:nth-child(1) { width: 260px; }   /* Business */
#prospects-table th:nth-child(2), #prospects-table td:nth-child(2) { width: 110px; }   /* Phone */
#prospects-table th:nth-child(3), #prospects-table td:nth-child(3) { width: 60px; }    /* Web */
#prospects-table th:nth-child(4), #prospects-table td:nth-child(4) { width: 60px; }    /* Score */
#prospects-table th:nth-child(5), #prospects-table td:nth-child(5) { width: 60px; }    /* Fit */
#prospects-table th:nth-child(6), #prospects-table td:nth-child(6) { width: 70px; }    /* Demand */
#prospects-table th:nth-child(7), #prospects-table td:nth-child(7) { width: 90px; }    /* Signals */
#prospects-table th:nth-child(8), #prospects-table td:nth-child(8) { width: 80px; }    /* Reach */
#prospects-table th:nth-child(9), #prospects-table td:nth-child(9) { width: 100px; }   /* Status */
#prospects-table th:nth-child(10), #prospects-table td:nth-child(10) { width: 86px; }  /* Actions */

/* Business cell — name primary, "City · ★ 4.5" muted secondary; long names wrap rather than push column width */
.biz-name { font-weight: 600; color: #1B1B4E; word-break: break-word; }
.biz-sub  { font-size: 10px; color: #6c757d; margin-top: 1px; }
.phone-cell { white-space: nowrap; }
.website-cell { white-space: nowrap; }

/* Reach column — compact LinkedIn + Facebook side-by-side pills */
.reach-group { display: flex; gap: 4px; }
.reach-pill {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 28px; height: 22px;
    font-size: 10px; font-weight: 600;
    border-radius: 4px; padding: 0 6px;
    text-decoration: none; cursor: pointer; border: 1px solid transparent;
}
.reach-li         { background: #0a66c2; color: #fff; }
.reach-fb         { background: #1877f2; color: #fff; }
.reach-li-enrich  { background: #fff; color: #0a66c2; border-color: #0a66c2; }
.reach-empty      { background: #f1f3f5; color: #adb5bd; }
.reach-pill:hover:not(.reach-empty) { filter: brightness(0.92); }

/* Status cell — primary status badge, engagement underneath */
.status-sub { margin-top: 3px; }
.last-contacted { font-size: 10px; }

/* Actions column — compact 2×2 grid (was stacked single-column, looked squashed) */
.actions-cell { padding: 4px !important; min-width: 76px; }
.actions-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 3px; }
.btn-action {
    font-size: 11px; padding: 2px 0; line-height: 1.2;
    min-width: 30px; height: 24px;
    border-radius: 3px;
    box-shadow: 0 1px 0 rgba(0,0,0,0.08);
}
.btn-action:active { transform: translateY(1px); }

/* Floating Research Agent — collapsed FAB in bottom-right, expands to panel */
.chat-fab {
    position: fixed; right: 20px; bottom: 20px; z-index: 1040;
    background: linear-gradient(180deg, #232366 0%, var(--brand-primary) 100%);
    color: #fff; padding: 10px 16px; border-radius: 999px;
    cursor: pointer; user-select: none;
    display: inline-flex; align-items: center; gap: 8px;
    font-size: 12px; font-weight: 600;
    transition: transform .15s ease, box-shadow .2s ease;
}
.chat-fab:hover { transform: translateY(-2px); }
.chat-fab-icon  { font-size: 16px; line-height: 1; }
.chat-fab.is-hidden { display: none; }

.chat-panel {
    position: fixed; right: 20px; bottom: 20px; z-index: 1040;
    width: 360px; max-width: calc(100vw - 40px);
    height: 540px; max-height: calc(100vh - 100px);
    background: #fff; border-radius: 10px; overflow: hidden;
    display: none; flex-direction: column;
}
.chat-panel.is-open { display: flex; }
.chat-panel-header  {
    padding: 12px 14px; display: flex; justify-content: space-between; align-items: flex-start;
    background: #f5f6fa; border-bottom: 1px solid #e9ecef;
}
.chat-panel-body { flex: 1; overflow-y: auto; padding: 10px; }
.chat-panel-body #chat-messages { max-height: none; height: 100%; min-height: auto; background: transparent; padding: 0; }
.chat-panel-footer { border-top: 1px solid #e9ecef; padding: 10px; background: #fff; }

/* Brand primary button — use instead of inline style on primary actions */
.btn-mb-primary {
    background-color: var(--brand-primary);
    border-color: var(--brand-primary);
    color: #fff;
}
.btn-mb-primary:hover {
    background-color: #141440;
    border-color: #141440;
    color: #fff;
}

/* Prevent browser default from rendering <code> below the 11px minimum */
code {
    font-size: inherit;
}

/* ── Demand score badges ── */
.badge-demand-high { background-color: #16a34a; color: #fff; }
.badge-demand-mid  { background-color: #d97706; color: #fff; }
.badge-demand-low  { background-color: #dc2626; color: #fff; }
.badge-demand-none { background-color: #9ca3af; color: #fff; }

/* ── Engagement status badges ── */
.engagement-badge     { cursor: pointer; font-size: 0.75rem; }
.engagement-none      { background-color: #e5e7eb; color: #374151; }
.engagement-called    { background-color: #dbeafe; color: #1d4ed8; }
.engagement-emailed   { background-color: #ede9fe; color: #6d28d9; }
.engagement-whatsapp  { background-color: #dcfce7; color: #15803d; }
.engagement-follow_up { background-color: #fef3c7; color: #b45309; }

/* ── City tag pill ── */
.city-tag {
    display: inline-block;
    background: #eff6ff;
    color: #1d4ed8;
    font-size: 0.7rem;
    padding: 1px 7px;
    border-radius: 10px;
    font-weight: 600;
}

/* ── City checkbox grid (multi-city selector) ── */
.city-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 6px;
    max-height: 280px;
    overflow-y: auto;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    padding: 8px;
}

/* ── Engagement dropdown ── */
#engagement-menu { display: none; position: absolute; z-index: 9999; min-width: 140px; }

/* ── Session form helpers ── */
.mw-320 { max-width: 320px; }
.mw-480 { max-width: 480px; }
.cursor-pointer { cursor: pointer; }

/* ── Badge base override (Bootstrap uses .75em; enforce 11px minimum) ── */
.badge { font-size: 11px; }

/* ── Lead score badges (JS-rendered) ── */
.lead-score-high { background-color: #198754; color: #fff; }
.lead-score-mid  { background-color: #fd7e14; color: #fff; }
.lead-score-low  { background-color: #dc3545; color: #fff; }

/* ── Trend direction (JS-rendered) ── */
.trend-up     { color: #198754; }
.trend-down   { color: #dc3545; }
.trend-stable { color: #6c757d; }

/* ── Demand evidence panel (JS-rendered) ── */
.demand-panel { background: #f8f9fa; border-top: 1px solid #dee2e6; font-size: 12px; }
.trends-verify-link { color: #0d6efd; }

/* ── Misc JS-rendered elements ── */
.badge-osm      { font-size: 10px; }
.icon-sm        { font-size: 10px; }
.last-contacted { font-size: 0.7rem; }
.intent-snippet { font-size: 12px; }

/* ── Project list (dashboard) ── */
.project-name { cursor: pointer; text-decoration: underline dotted; }
