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

:root {
    /* Main Theme Variables (Light Mode) */
    --bg-dark: #f1f5f9;
    --bg-card: #ffffff;
    --border-color: #e2e8f0;
    --border-hover: rgba(139, 92, 246, 0.2);
    
    --primary: #8b5cf6;
    --primary-glow: rgba(139, 92, 246, 0.08);
    --primary-hover: #7c3aed;
    --accent: #0d9488;
    --accent-glow: rgba(13, 148, 136, 0.08);
    
    --text-main: #0f172a;
    --text-muted: #475569;
    --text-dark: #94a3b8;
    
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #3b82f6;
    
    --font-outfit: 'Outfit', sans-serif;
    --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);

    /* Sidebar Variables (Preserved Dark Mode) */
    --bg-sidebar: #0b0d19;
    --sb-border: rgba(255, 255, 255, 0.06);
    --sb-text-main: #f8fafc;
    --sb-text-muted: #94a3b8;
    --sb-text-active: #ffffff;
    --sb-item-hover: rgba(255, 255, 255, 0.03);
}

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

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    font-family: var(--font-outfit);
    overflow-x: hidden;
    min-height: 100vh;
}

/* Scrollbar Styles */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: var(--bg-dark);
}
::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--primary);
}

/* Master Layout Grid */
.app-container {
    display: grid;
    grid-template-columns: 260px 1fr;
    min-height: 100vh;
    align-items: stretch;
}

/* Sidebar Navigation */
.sidebar {
    background-color: var(--bg-sidebar);
    border-right: 1px solid var(--sb-border);
    padding: 1.5rem 1rem;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.logo-container {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.logo-icon {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 15px var(--primary-glow);
}

.logo-text {
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    background: linear-gradient(to right, #ffffff, #e0e7ff);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.nav-menu {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    flex-grow: 1;
}

.nav-item a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.55rem 0.85rem;
    color: var(--sb-text-muted);
    text-decoration: none;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    transition: var(--transition-smooth);
    border: 1px solid transparent;
    position: relative;
}

.nav-item a:hover, .nav-item.active a {
    color: var(--sb-text-active);
    background-color: var(--sb-item-hover);
    border-color: var(--border-hover);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.12);
}

.nav-item.active a::before {
    content: '';
    position: absolute;
    left: 0;
    top: 20%;
    bottom: 20%;
    width: 3px;
    background: linear-gradient(to bottom, #f59e0b, #fbbf24);
    border-radius: 0 4px 4px 0;
    box-shadow: 0 0 8px rgba(245, 158, 11, 0.6);
}

.nav-item a svg {
    width: 20px;
    height: 20px;
    transition: var(--transition-smooth);
}

.nav-item a:hover svg, .nav-item.active a svg {
    color: var(--primary);
    filter: drop-shadow(0 0 4px var(--primary));
}

.sidebar-footer {
    border-top: 1px solid var(--sb-border);
    padding-top: 1.5rem;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #4f46e5, #06b6d4);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    color: #fff;
    border: 2px solid rgba(255, 255, 255, 0.1);
}

.user-info .name {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--sb-text-main);
}

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

/* Main Content Area */
.main-content {
    padding: 0 2.5rem 2.5rem 2.5rem;
    overflow-y: auto;
    max-height: 100vh;
}

.header-action-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2.5rem;
}

.page-title h1 {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.page-title p {
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.65rem 1.25rem;
    font-family: var(--font-outfit);
    font-size: 0.9rem;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    transition: var(--transition-smooth);
    border: 1px solid transparent;
    text-decoration: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), #7c3aed);
    color: #fff;
    box-shadow: 0 4px 15px var(--primary-glow);
}

.btn-primary:hover {
    box-shadow: 0 6px 20px rgba(139, 92, 246, 0.4);
    transform: translateY(-1px);
}

.btn-secondary {
    background-color: rgba(255, 255, 255, 0.05);
    color: var(--text-main);
    border-color: var(--border-color);
}

.btn-secondary:hover {
    background-color: rgba(255, 255, 255, 0.08);
    border-color: var(--border-hover);
}

/* Cards & Glassmorphism */
.glass-card {
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 1.5rem;
    transition: var(--transition-smooth);
}

.glass-card:hover {
    border-color: rgba(255, 255, 255, 0.12);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

/* Dashboard Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.stat-card .info h3 {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 500;
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-card .info .value {
    font-size: 1.75rem;
    font-weight: 700;
}

.stat-card .icon-wrapper {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
}

.stat-card.primary .icon-wrapper {
    color: var(--primary);
    background-color: var(--primary-glow);
    border-color: rgba(139, 92, 246, 0.2);
}

.stat-card.success .icon-wrapper {
    color: var(--success);
    background-color: rgba(16, 185, 129, 0.1);
    border-color: rgba(16, 185, 129, 0.2);
}

.stat-card.warning .icon-wrapper {
    color: var(--warning);
    background-color: rgba(245, 158, 11, 0.1);
    border-color: rgba(245, 158, 11, 0.2);
}

.stat-card.accent .icon-wrapper {
    color: var(--accent);
    background-color: var(--accent-glow);
    border-color: rgba(6, 182, 212, 0.2);
}

/* Two Column Layout */
.dashboard-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 1.5rem;
}

.chart-card {
    min-height: 350px;
}

/* Tables & Lists */
.table-container {
    overflow-x: auto;
    margin-top: 1rem;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

.data-table th {
    padding: 1rem;
    font-size: 0.85rem;
    text-transform: uppercase;
    color: var(--text-muted);
    font-weight: 600;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border-color);
}

.data-table td {
    padding: 1rem;
    font-size: 0.925rem;
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
}

.data-table tr:hover td {
    background-color: rgba(255, 255, 255, 0.01);
}

/* Status Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.65rem;
    border-radius: 50px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.badge-new { background-color: rgba(59, 130, 246, 0.15); color: #60a5fa; }
.badge-contacted { background-color: rgba(245, 158, 11, 0.15); color: #fbbf24; }
.badge-qualified { background-color: rgba(139, 92, 246, 0.15); color: #c084fc; }
.badge-proposal_sent { background-color: rgba(6, 182, 212, 0.15); color: #22d3ee; }
.badge-negotiating { background-color: rgba(236, 72, 153, 0.15); color: #f472b6; }
.badge-converted { background-color: rgba(16, 185, 129, 0.15); color: #34d399; }
.badge-lost { background-color: rgba(239, 68, 68, 0.15); color: #f87171; }

.score-pill {
    padding: 0.2rem 0.5rem;
    background: rgba(139, 92, 246, 0.1);
    border: 1px solid rgba(139, 92, 246, 0.2);
    border-radius: 6px;
    color: var(--primary-hover);
    font-weight: 700;
}

/* Form Styles */
.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.form-control {
    width: 100%;
    background-color: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0.75rem 1rem;
    color: var(--text-main);
    font-family: var(--font-outfit);
    font-size: 0.95rem;
    transition: var(--transition-smooth);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 10px var(--primary-glow);
}

/* Timeline Custom 360 view */
.timeline {
    position: relative;
    padding-left: 2rem;
    margin-top: 1.5rem;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 7px;
    top: 0;
    bottom: 0;
    width: 2px;
    background-color: var(--border-color);
}

.timeline-item {
    position: relative;
    margin-bottom: 1.5rem;
}

.timeline-dot {
    position: absolute;
    left: -29px;
    top: 4px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background-color: var(--bg-dark);
    border: 3px solid var(--primary);
}

.timeline-item.note .timeline-dot { border-color: var(--info); }
.timeline-item.whatsapp .timeline-dot { border-color: var(--success); }
.timeline-item.email .timeline-dot { border-color: var(--warning); }
.timeline-item.timeline .timeline-dot { border-color: var(--primary); }

.timeline-header {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    margin-bottom: 0.25rem;
}

.timeline-time {
    color: var(--text-muted);
}

.timeline-user {
    font-weight: 600;
}

.timeline-content {
    background-color: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    padding: 0.75rem 1rem;
    border-radius: 8px;
    font-size: 0.9rem;
    color: var(--text-main);
}

/* Wizard Flow */
.wizard-steps {
    display: flex;
    justify-content: space-between;
    margin-bottom: 2rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 1rem;
}

.step-indicator {
    flex: 1;
    text-align: center;
    color: var(--text-muted);
    font-weight: 500;
    font-size: 0.9rem;
}

.step-indicator.active {
    color: var(--primary);
    font-weight: 700;
}

.wizard-pane {
    display: none;
}

.wizard-pane.active {
    display: block;
}

/* Flex utilities */
.d-flex { display: flex; }
.justify-between { justify-content: space-between; }
.align-center { align-items: center; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 0.75rem; }
.mt-3 { margin-top: 1rem; }
.mt-4 { margin-top: 1.5rem; }
.mr-2 { margin-right: 0.5rem; }
.w-full { width: 100%; }

/* Grid layout for Lead View */
.lead-360-grid {
    display: grid;
    grid-template-columns: 1fr 1.5fr;
    gap: 1.5rem;
}

/* Chat bubble styling for WhatsApp AI console */
.whatsapp-chat-preview {
    background-color: #0b141a;
    border-radius: 12px;
    padding: 1.5rem;
    border: 1px solid var(--border-color);
    height: 350px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.chat-bubble {
    max-width: 80%;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    font-size: 0.9rem;
    line-height: 1.4;
}

.chat-bubble.sent {
    background-color: #005c4b;
    color: #e9edef;
    align-self: flex-end;
}

.chat-bubble.received {
    background-color: #202c33;
    color: #e9edef;
    align-self: flex-start;
}

/* Mixed Theme Overrides (Light Content Area) */
.main-content h1, 
.main-content h2, 
.main-content h3, 
.main-content h4, 
.main-content h5, 
.main-content h6 {
    color: var(--text-main) !important;
}

.main-content strong {
    color: var(--text-main) !important;
}

.glass-card {
    background: #ffffff !important;
    border: 1px solid var(--border-color) !important;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.02) !important;
}

.glass-card:hover {
    border-color: var(--border-hover) !important;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.06), 0 4px 6px -2px rgba(0, 0, 0, 0.03) !important;
}

.data-table th {
    color: var(--text-muted) !important;
    border-bottom: 1px solid var(--border-color) !important;
}

.data-table td {
    color: var(--text-main) !important;
    border-bottom: 1px solid var(--border-color) !important;
}

.data-table tr:hover td {
    background-color: #f8fafc !important;
}

.form-control {
    background-color: #ffffff !important;
    border: 1px solid var(--border-color) !important;
    color: var(--text-main) !important;
}

.form-control:focus {
    border-color: var(--primary) !important;
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.12) !important;
}

.btn-primary, .btn-primary * {
    color: #ffffff !important;
}

.btn-secondary {
    background-color: #ffffff !important;
    color: var(--text-muted) !important;
    border: 1px solid var(--border-color) !important;
}

.btn-secondary:hover {
    background-color: #f8fafc !important;
    border-color: var(--border-hover) !important;
    color: var(--primary-hover) !important;
}

.score-pill {
    background: rgba(139, 92, 246, 0.06) !important;
    border: 1px solid rgba(139, 92, 246, 0.15) !important;
    color: var(--primary) !important;
}

/* Kanban column titles and cards */
.kanban-column-header h3 {
    color: var(--text-main) !important;
}

.kanban-card {
    background: #ffffff !important;
    border: 1px solid var(--border-color) !important;
    color: var(--text-main) !important;
}

.kanban-card:hover {
    border-color: var(--primary) !important;
}

/* Timeline text overrides */
.timeline-time {
    color: var(--text-dark) !important;
}

.timeline-content {
    background-color: #f8fafc !important;
    border: 1px solid var(--border-color) !important;
    color: var(--text-main) !important;
}

/* Objections/proposals collapsible text */
.collapse-header h4 {
    color: var(--text-main) !important;
}

select option {
    background-color: #ffffff !important;
    color: #0f172a !important;
}

/* Sticky Global Header Styles */
.global-header {
    position: sticky;
    top: 0;
    background-color: var(--bg-dark);
    z-index: 100;
    padding: 1.25rem 2.5rem;
    margin-left: -2.5rem;
    margin-right: -2.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.search-input-group {
    position: relative;
    width: 100%;
}

.search-input-group .search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-dark);
    pointer-events: none;
}

.search-input-group .global-search {
    padding-left: 2.5rem !important;
    height: 38px;
    border-radius: 20px !important;
    background-color: #ffffff !important;
    border: 1px solid var(--border-color) !important;
}

.content-body {
    padding-top: 1.5rem;
}

/* Sortable column headers */
.sortable-th {
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
    transition: color 0.2s ease;
}
.sortable-th:hover {
    color: var(--primary) !important;
}

/* Report table: sticky thead */
.report-table-wrapper {
    overflow-x: auto;
    overflow-y: auto;
    max-height: 560px;   /* sticky scroll container */
    position: relative;
}

.report-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

/* Sticky header row */
.sticky-thead th {
    position: sticky;
    top: 0;
    background-color: #f8fafc;
    z-index: 10;
    box-shadow: 0 2px 4px rgba(0,0,0,0.06);
    border-bottom: 2px solid var(--border-color);
}

/* Sidebar sticky */
.sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    align-self: flex-start;
}

/* Sidebar navigation section title categorization */
.nav-section-title {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--sb-text-muted);
    letter-spacing: 1px;
    margin-top: 1.25rem;
    margin-bottom: 0.4rem;
    padding-left: 0.85rem;
    opacity: 0.55;
    user-select: none;
    list-style: none;
}
.nav-section-title:first-of-type {
    margin-top: 0.5rem;
}

/* Force form labels and descriptions inside content cards to use dark main text color in light mode */
.glass-card form label,
.glass-card form .form-group label,
.glass-card form .pkg-title,
.glass-card form div[style*="color: #fff"],
.glass-card form span[style*="color: #fff"],
.glass-card form td[style*="color: #fff"] {
    color: var(--text-main) !important;
}

/* Sticky Header Action Bar */
.header-action-bar {
    position: sticky;
    top: 0;
    z-index: 100;
    background-color: var(--bg-dark);
    padding: 1.5rem 0;
    margin-top: 0;
    margin-bottom: 1.5rem !important;
    border-bottom: 1px solid var(--border-color);
}

/* Constrain leads table container height to show ~10 rows with scrollbars */
.table-container {
    max-height: 540px;
    overflow: auto;
    position: relative;
}

/* Sticky Table Headers inside scrolling container */
.data-table thead th {
    position: sticky;
    top: 0;
    z-index: 10;
    background-color: var(--bg-card);
    box-shadow: 0 2px 2px -1px rgba(0, 0, 0, 0.12);
}

/* Sticky Checkbox Column */
.data-table th:first-child,
.data-table td:first-child {
    position: sticky;
    left: 0;
    z-index: 5;
    background-color: var(--bg-card);
}

.data-table th:first-child {
    z-index: 12;
}

/* Sticky Lead Name Column */
.data-table th:nth-child(2),
.data-table td:nth-child(2) {
    position: sticky;
    left: 40px; /* Checkbox column width offset */
    z-index: 5;
    background-color: var(--bg-card);
    border-right: 1px solid var(--border-color);
}

.data-table th:nth-child(2) {
    z-index: 12;
}



