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

:root {
    /* Premium Minimal SaaS Palette */
    --bg-color: #FAFAFA;          /* Extremely clean off-white */
    --surface-color: #FFFFFF;     
    --sidebar-bg: #0A0A0A;        /* Deep midnight/black for sleek contrast */
    --sidebar-text: #A1A1AA;
    --sidebar-active: #FFFFFF;
    --sidebar-active-bg: rgba(255, 255, 255, 0.08);

    --border-soft: #EAEAEA;       /* Ultra-fine Vercel-like borders */

    --text-main: #111827;         /* High contrast dark text */
    --text-muted: #6B7280;        /* Clear legible gray */

    /* Status Colors (Subtle but clear) */
    --status-urgent: #ef4444;       
    --status-new: #3b82f6;          
    --status-contacted: #f59e0b;     
    --status-booked: #8b5cf6;        
    --status-done: #f97316;          
    --status-won: #10b981;           
    --status-lost: #6b7280;          
    
    /* Source Colors */
    --src-google: #3b82f6;           
    --src-gbp: #10b981;              
    --src-voice: #8b5cf6;            
    --src-direct: #f97316;           
    --src-web: #06b6d4;              

    /* Universal styling */
    --font-main: 'Inter', sans-serif;
    --sidebar-width: 240px;         /* Slimmer, more elegant */
    --topbar-height: 64px;          /* Tighter, more purposeful */
    
    /* True SaaS Aesthetics */
    --card-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.05), 0 1px 2px -1px rgba(0, 0, 0, 0.03); /* Extremely soft depth */
    --card-shadow-hover: 0 4px 6px -1px rgba(0, 0, 0, 0.08), 0 2px 4px -2px rgba(0, 0, 0, 0.04);
    --border-radius: 12px;          
    --elem-radius: 6px;            
}

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

body {
    font-family: var(--font-main);
    background-color: var(--bg-color);
    color: var(--text-main);
    display: flex;
    min-height: 100vh;
    letter-spacing: -0.015em;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ---------------- SIDEBAR ---------------- */
.sidebar {
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    z-index: 100;
    border-right: 1px solid #1f1f1f; /* Subtle dark border separator */
}

.sidebar-header {
    height: var(--topbar-height);
    padding: 0 24px;
    display: flex;
    align-items: center;
    border-bottom: 1px solid #1f1f1f;
}

.sidebar-header h2 {
    font-size: 0.95rem;
    font-weight: 600;
    line-height: 1.25;
    letter-spacing: -0.01em;
    color: #EDEDED;
}

.sidebar-header i {
    font-size: 1.15rem;
    margin-right: 12px;
    color: #F59E0B;
}

.sidebar-nav {
    flex: 1;
    padding: 24px 16px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    color: var(--sidebar-text);
    text-decoration: none;
    font-weight: 500;
    transition: all 0.2s;
    font-size: 0.85rem;
    border-radius: var(--elem-radius);
}

.nav-item:hover {
    color: #EDEDED;
    background-color: rgba(255,255,255,0.04);
}

.nav-item i {
    width: 24px;
    font-size: 1rem;
    opacity: 0.7;
}

.nav-item.active {
    color: var(--sidebar-active);
    background-color: var(--sidebar-active-bg);
    font-weight: 600;
}
.nav-item.active i {
    opacity: 1;
}

.sidebar-footer {
    padding: 20px 24px;
    font-size: 0.75rem;
    color: #71717A;
    border-top: 1px solid #1f1f1f;
}

/* ---------------- MAIN CONTENT ---------------- */
.main-wrapper {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
}

/* Top Bar - Minimalist Vercel Style */
.topbar {
    height: var(--topbar-height);
    background-color: var(--surface-color);
    padding: 0 32px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-soft);
    position: sticky;
    top: 0;
    z-index: 50;
}

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

.topbar-left h1 {
    font-size: 1rem;
    color: var(--text-main);
    font-weight: 600;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

.topbar-sync {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 500;
}

.header-date-selector {
    padding: 6px 12px;
    border-radius: var(--elem-radius);
    border: 1px solid var(--border-soft);
    font-family: var(--font-main);
    font-size: 0.8rem;
    font-weight: 500;
    background-color: #fff;
    color: #111;
    cursor: pointer;
    box-shadow: 0 1px 2px rgba(0,0,0,0.02);
    outline: none;
    transition: border-color 0.2s;
}
.header-date-selector:hover { border-color: #cbd5e1; }

/* Content Area */
.content {
    padding: 32px;
    flex: 1;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
}

/* ---------------- ALERTS ---------------- */
.alert-card {
    background: #FEF2F2;
    border: 1px solid #FCA5A5;
    border-radius: var(--border-radius);
    padding: 16px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}
.alert-text {
    color: #991B1B;
    font-weight: 500;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 8px;
}
.btn-alert {
    background: #EF4444;
    color: white;
    border-radius: var(--elem-radius);
    padding: 6px 14px;
    font-weight: 500;
    font-size: 0.8rem;
    text-decoration: none;
    border: 1px solid transparent;
    transition: all 0.2s;
}
.btn-alert:hover {
    background: #DC2626;
}

/* ---------------- LAYOUTS ---------------- */
.grid-5 { display: grid; grid-template-columns: repeat(5, 1fr); gap: 16px; margin-bottom: 24px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 24px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; margin-bottom: 24px; }

/* ---------------- CARDS ---------------- */
.card {
    background-color: var(--surface-color);
    border-radius: var(--border-radius);
    padding: 24px;
    box-shadow: var(--card-shadow);
    border: 1px solid var(--border-soft);
}

.card-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 16px;
    letter-spacing: -0.01em;
}

.stat-card {
    padding: 20px;
}

.stat-card .stat-label {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.stat-card .stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-main);
    line-height: 1;
    margin-bottom: 8px;
    letter-spacing: -0.02em;
}

.stat-card .stat-subtext {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 500;
}

/* Value Trend */
.trend-up { color: var(--status-won); }
.trend-down { color: var(--status-urgent); }

/* Remove full yellow backgrounds; use clean lines instead */
.card-amber {
    border-top: 3px solid var(--amber); /* Premium minimal accent */
}
.card-amber .stat-value { color: var(--text-main); }

/* Source Numbers (Card 2) */
.source-breakdown {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 12px;
}
.source-mini {
    text-align: center;
    background: #F9FAFB;
    padding: 6px 10px;
    border-radius: var(--elem-radius);
    border: 1px solid var(--border-soft);
    flex: 1;
    margin: 0 4px;
}
.source-mini:first-child{ margin-left:0;}
.source-mini:last-child{ margin-right:0;}

.source-mini .num { font-size: 1rem; font-weight: 600; color: var(--text-main); margin-bottom: 2px; }
.source-mini .dot { width: 6px; height: 6px; border-radius: 50%; display: inline-block; margin-right: 4px; }
.source-mini .label { font-size: 0.65rem; color: var(--text-muted); font-weight: 500; text-transform: uppercase; }

/* ---------------- PILLS & BADGES ---------------- */
.pill {
    display: inline-block;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    background-color: var(--surface-color);
    border: 1px solid var(--border-soft);
    color: var(--text-muted);
    transition: all 0.2s ease;
}

.pill:hover { background-color: #F8FAFC; color: var(--text-main); }
.pill.active { background-color: #111; color: white; border-color: #111; }

.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: var(--elem-radius);
    font-size: 0.7rem;
    font-weight: 600;
}

.badge-urgent { background-color: #FEF2F2; color: #DC2626; border: 1px solid #FECACA; }
.badge-new { background-color: #EFF6FF; color: #2563EB; border: 1px solid #BFDBFE; }
.badge-contacted { background-color: #FFFBEB; color: #D97706; border: 1px solid #FDE68A; }
.badge-booked { background-color: #F5F3FF; color: #7C3AED; border: 1px solid #EDE9FE; }
.badge-done { background-color: #FFF7ED; color: #EA580C; border: 1px solid #FED7AA; }
.badge-won { background-color: #ECFDF5; color: #059669; border: 1px solid #A7F3D0; }
.badge-lost { background-color: #F3F4F6; color: #4B5563; border: 1px solid #E5E7EB; }

.badge-outline { background-color: transparent; border: 1px solid; }

.filter-bar { display: flex; gap: 8px; margin-bottom: 24px; flex-wrap: wrap; }

/* ---------------- LEAD CARDS ---------------- */
.lead-card {
    background-color: var(--surface-color);
    border-radius: var(--border-radius);
    padding: 20px;
    box-shadow: var(--card-shadow);
    margin-bottom: 16px;
    border: 1px solid var(--border-soft);
    position: relative;
    overflow: hidden;
}

.lead-card.urgent { border-left: 3px solid var(--status-urgent); }

.lead-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.lead-name { font-size: 1rem; font-weight: 600; color: var(--text-main); display: flex; align-items: center; gap: 8px;}
.lead-info { font-size: 0.85rem; color: var(--text-muted); display: flex; gap: 20px; margin-bottom: 16px; font-weight: 500; }
.lead-info a { color: var(--text-main); text-decoration: none; transition: color 0.2s; }
.lead-info a:hover { color: var(--status-new); }

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

select.status-dropdown {
    padding: 6px 12px;
    border-radius: var(--elem-radius);
    border: 1px solid var(--border-soft);
    font-weight: 500;
    font-size: 0.8rem;
    cursor: pointer;
    font-family: var(--font-main);
    background-color: transparent;
    color: var(--text-main);
    transition: all 0.2s;
}
select.status-dropdown:hover, select.status-dropdown:focus { border-color: #CBD5E1; outline: none; }

.btn-view-call {
    background-color: #F8FAFC;
    border: 1px solid var(--border-soft);
    color: var(--text-main);
    padding: 6px 14px;
    border-radius: var(--elem-radius);
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}
.btn-view-call:hover { background-color: #F1F5F9; }

/* Lead Expanded Area */
.lead-expanded { display: none; margin-top: 20px; padding-top: 20px; border-top: 1px solid var(--border-soft); }
.lead-expanded.active { display: block; }

.ai-summary {
    background: #F8FAFC;
    padding: 16px;
    border-radius: var(--elem-radius);
    font-size: 0.85rem;
    line-height: 1.5;
    color: var(--text-main);
    margin-bottom: 20px;
    border: 1px solid var(--border-soft);
}
.ai-summary strong { color: var(--text-main); font-weight: 600;}

.transcript-toggle { color: var(--text-main); font-weight: 500; font-size: 0.85rem; cursor: pointer; user-select: none; display: inline-flex; align-items: center; gap: 6px; margin-bottom: 16px; }

.transcript-container { display: none; flex-direction: column; gap: 12px; margin-bottom: 20px; max-height: 300px; overflow-y: auto; padding-right: 12px; }
.transcript-container.active { display: flex; }

.bubble { max-width: 80%; padding: 12px 16px; border-radius: 8px; font-size: 0.85rem; line-height: 1.5; }
.bubble-sarah { align-self: flex-start; background: #0A0A0A; color: white; border-bottom-left-radius: 2px; }
.bubble-caller { align-self: flex-end; background-color: #F3F4F6; color: var(--text-main); border: 1px solid var(--border-soft); border-bottom-right-radius: 2px; }
.bubble-meta { font-size: 0.7rem; margin-bottom: 4px; font-weight: 600; opacity: 0.7; text-transform: uppercase; }

.lead-notes {
    width: 100%; padding: 12px; border-radius: var(--elem-radius); border: 1px solid var(--border-soft); font-family: var(--font-main); font-size: 0.85rem; min-height: 80px; resize: vertical; outline: none;
}
.lead-notes:focus { border-color: #94A3B8; }

/* ---------------- KANBAN ACCORDIONS ---------------- */
.kanban-section { background-color: var(--surface-color); border-radius: var(--border-radius); box-shadow: var(--card-shadow); margin-bottom: 16px; border: 1px solid var(--border-soft); overflow: hidden; }
.kanban-header { padding: 16px 20px; display: flex; justify-content: space-between; align-items: center; cursor: pointer; background-color: #FAFAFA; border-bottom: 1px solid var(--border-soft); user-select: none; }
.kanban-header h3 { font-size: 0.95rem; color: var(--text-main); display: flex; align-items: center; gap: 12px; margin: 0; font-weight: 600;}
.kanban-header i { color: var(--text-muted); transition: transform 0.2s; }
.kanban-section.expanded .kanban-header i { transform: rotate(180deg); color: var(--text-main); }
.kanban-body { display: none; padding: 16px 20px; background-color: var(--surface-color); flex-direction: column; gap: 12px; }
.kanban-section.expanded .kanban-body { display: flex; }

.kanban-item { padding: 12px; border: 1px solid var(--border-soft); border-radius: var(--elem-radius); display: flex; flex-direction: column; gap: 6px; cursor: pointer; background: var(--surface-color); }
.kanban-item:hover { border-color: #CBD5E1; }
.kanban-item-title { font-weight: 600; font-size: 0.9rem; color: var(--text-main); display: flex;justify-content: space-between; align-items: center; }
.kanban-item-meta { font-size: 0.8rem; color: var(--text-muted); font-weight: 500; }
.kanban-item-appt { font-size: 0.75rem; font-weight: 600; color: #7C3AED; background: #F5F3FF; padding: 2px 8px; border-radius: 4px; display: inline-block; margin-top: 4px; border: 1px solid #EDE9FE;}

/* ---------------- UTILITIES ---------------- */
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 16px; }
.mb-4 { margin-bottom: 24px; }
.mb-5 { margin-bottom: 32px; }
.text-navy { color: var(--text-main); }
.text-amber { color: var(--amber); }

/* Source Colors */
.src-tag-google { background-color: #EFF6FF; color: var(--src-google); padding: 4px 10px; border-radius: 4px; font-size: 0.7rem; font-weight: 600; border: 1px solid #BFDBFE; }
.src-tag-gbp { background-color: #ECFDF5; color: var(--src-gbp); padding: 4px 10px; border-radius: 4px; font-size: 0.7rem; font-weight: 600; border: 1px solid #A7F3D0; }
.src-tag-voice { background-color: #F5F3FF; color: var(--src-voice); padding: 4px 10px; border-radius: 4px; font-size: 0.7rem; font-weight: 600; border: 1px solid #EDE9FE; }
.src-tag-direct { background-color: #FFF7ED; color: var(--src-direct); padding: 4px 10px; border-radius: 4px; font-size: 0.7rem; font-weight: 600; border: 1px solid #FED7AA; }

.monthly-summary { background: #FAFAFA; border-color: var(--border-soft); }
.monthly-summary p { font-size: 0.95rem; line-height: 1.6; color: var(--text-muted); margin-bottom: 24px; font-weight: 400; }

.btn-primary { background-color: #111; color: white; border: 1px solid #000; padding: 10px 20px; border-radius: var(--elem-radius); font-weight: 500; font-size: 0.85rem; cursor: pointer; display: inline-flex; align-items: center; gap: 8px; transition: background 0.2s; }
.btn-primary:hover { background-color: #333; }

.play-btn { width: 36px; height: 36px; border-radius: 50%; background-color: var(--surface-color); color: #111; display: flex; align-items: center; justify-content: center; border: 1px solid var(--border-soft); cursor: pointer; transition: all 0.2s; }
.play-btn:hover { background-color: #F3F4F6; }

/* Appointments styling */
.week-group { margin-bottom: 32px; }
.week-header { font-size: 1rem; font-weight: 600; color: var(--text-main); margin-bottom: 12px; border-bottom: 1px solid var(--border-soft); padding-bottom: 8px; }

.btn-search { padding: 8px 12px; border: 1px solid var(--border-soft); border-radius: var(--elem-radius); font-family: var(--font-main); width: 260px; font-size: 0.85rem; transition: all 0.2s; }
.btn-search:focus { border-color: #94A3B8; outline: none; }

/* Base Hamburger Hide */
.menu-toggle { display: none; }

/* =========================================================
   MOBILE RESPONSIVENESS (Max Width 1024px)
   ========================================================= */
@media (max-width: 1024px) {
    
    /* 1. Sidebar Off-Canvas */
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        width: 280px; /* Slightly wider for touch surface on mobile */
    }
    .sidebar.mobile-active {
        transform: translateX(0);
    }
    
    /* Overlay */
    .sidebar-overlay {
        position: fixed;
        top: 0; left: 0; right: 0; bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        backdrop-filter: blur(4px);
        z-index: 90; /* Right below sidebar at 100 */
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.3s ease;
    }
    .sidebar-overlay.active {
        opacity: 1;
        pointer-events: auto;
    }

    /* 2. Main Layout Reset */
    .main-wrapper {
        margin-left: 0; /* Free up space */
    }

    /* 3. Topbar Adjustments */
    .topbar {
        padding: 0 16px;
        height: min-content;
        min-height: 64px;
        flex-direction: row;
        gap: 12px;
        justify-content: space-between;
    }
    .topbar-left {
        gap: 12px;
    }
    .menu-toggle {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        background: transparent;
        border: none;
        color: var(--text-main);
        font-size: 1.25rem;
        cursor: pointer;
        padding: 4px;
        margin-right: 4px;
    }
    
    .topbar-right {
        display: none; /* Hide date/sync on mobile topbar to save space, maybe move them into sidebar if needed, but for SaaS, just clean the header */
    }
    
    .content {
        padding: 24px 16px; /* Tighten up mobile content padding */
    }

    /* 4. Grid Stacking */
    .grid-5, .grid-3, .grid-2 {
        grid-template-columns: 1fr;
    }

    /* 5. Component Wrapping */
    .flex-between {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }
    .card-title {
        flex-direction: row; /* Usually we want titles to stay row if flex-between */
        align-items: center;
    }
    .lead-header, .panel-flex {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    .lead-info {
        flex-direction: column;
        gap: 8px;
    }
    .panel-stats {
        width: 100%;
    }
    .panel-chart {
        width: 100%;
        margin-top: 24px;
    }

    /* Data table scroll constraints */
    .card table {
        min-width: 600px; /* Force scroll */
    }
    .card {
        overflow-x: auto;
    }

    /* Appointment Card Tweak */
    .appt-card {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }
    .appt-meta {
        flex-direction: column;
        gap: 8px;
    }
    .appt-details {
        margin-left: 0;
    }

    /* Hide redundant elements */
    .btn-search {
        width: 100%;
        margin-top: 12px;
    }
}
