/**
 * My EV Charger - Lead & Outreach Management CRM
 * Modern SaaS UI Stylesheet
 * Brand Accent & Sidebar: #032d16 (Deep Evergreen / Dark Pine)
 * Compliant with Modern Web Guidance (visual-effects, typography, browser-ui-theming, legibility)
 */

:root {
    --crm-primary: #032d16;
    --crm-primary-hover: #021f0f;
    --crm-primary-active: #01170b;
    --crm-primary-light: #e5efe8;
    --crm-primary-rgb: 3, 45, 22;
    --crm-accent: #054924;
    --crm-sidebar-bg: #032d16;
    --crm-slate-900: #0f172a;
    --crm-slate-800: #1e293b;
    --crm-slate-700: #334155;
    --crm-slate-600: #475569;
    --crm-slate-100: #f1f5f9;
    --crm-slate-50: #f8fafc;
    --crm-border: #e2e8f0;
    --crm-border-subtle: #edf2f7;
    --crm-sidebar-width: 260px;
    
    /* Layered Elevation Shadows (visual-effects guidance) */
    --shadow-subtle: 0 1px 2px 0 rgba(0, 0, 0, 0.04);
    --shadow-card: 0 1px 3px rgba(0, 0, 0, 0.04), 0 6px 12px -2px rgba(0, 0, 0, 0.03);
    --shadow-hover: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 14px 20px -3px rgba(0, 0, 0, 0.07);
    --shadow-dropdown: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.06);

    /* Browser UI Theming */
    accent-color: var(--crm-primary);
}

/* Typography Best Practices (typography & improve-text-layout-and-legibility) */
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: var(--crm-slate-50);
    color: var(--crm-slate-900);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Balanced Headlines & Pretty Text Wrapping */
h1, h2, h3, h4, h5, h6, .text-balance {
    text-wrap: balance;
    letter-spacing: -0.015em;
}

p, .text-pretty, .timeline-text {
    text-wrap: pretty;
    max-width: 80ch;
}

.text-break-word {
    overflow-wrap: break-word;
}

/* Custom Text Selection (browser-ui-theming) */
::selection {
    background-color: var(--crm-primary);
    color: #ffffff;
}

/* Native Form Controls Theming */
input:not([type="range"]):user-valid {
    border-color: #86efac;
}

input:not([type="range"]):user-invalid {
    border-color: #fca5a5;
    background-color: #fffbfb;
}

/* Customized Native Scrollbars (browser-ui-theming) */
* {
    scrollbar-color: #cbd5e1 transparent;
    scrollbar-width: thin;
}

::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Sidebar Styles (#032d16) */
.crm-sidebar {
    width: var(--crm-sidebar-width);
    min-height: 100vh;
    background-color: var(--crm-sidebar-bg) !important;
    z-index: 1040;
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@media (max-width: 767.98px) {
    .crm-sidebar {
        position: fixed;
        top: 0;
        bottom: 0;
        left: 0;
        transform: translateX(-100%);
    }
    .crm-sidebar.show {
        transform: translateX(0);
        box-shadow: 0 0 35px rgba(0, 0, 0, 0.6);
    }
}

.crm-sidebar .nav-link {
    color: rgba(255, 255, 255, 0.78);
    font-size: 0.88rem;
    font-weight: 500;
    padding: 0.58rem 0.9rem;
    border-radius: 0.6rem;
    margin-bottom: 3px;
    transition: all 0.18s ease-in-out;
}

.crm-sidebar .nav-link:hover {
    color: #ffffff;
    background-color: rgba(255, 255, 255, 0.12);
    transform: translateX(2px);
}

.crm-sidebar .nav-link.active {
    color: #ffffff !important;
    background-color: rgba(255, 255, 255, 0.18) !important;
    border: 1px solid rgba(255, 255, 255, 0.24);
    font-weight: 600;
    box-shadow: 0 4px 8px -2px rgba(0, 0, 0, 0.25);
}

/* Glassmorphic Topbar */
.crm-topbar {
    background-color: rgba(255, 255, 255, 0.94);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-color: var(--crm-border) !important;
    height: 64px;
    z-index: 1020;
}

/* Primary Button Theming (#032d16) */
.btn-primary {
    background-color: var(--crm-primary) !important;
    border-color: var(--crm-primary) !important;
    color: #ffffff !important;
    font-weight: 600;
    letter-spacing: 0.01em;
    transition: all 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}

.btn-primary:hover, .btn-primary:focus {
    background-color: var(--crm-primary-hover) !important;
    border-color: var(--crm-primary-hover) !important;
    color: #ffffff !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px -1px rgba(3, 45, 22, 0.35);
}

.btn-primary:active {
    background-color: var(--crm-primary-active) !important;
    border-color: var(--crm-primary-active) !important;
    color: #ffffff !important;
    transform: translateY(0);
}

.btn-outline-primary {
    color: var(--crm-primary) !important;
    border-color: var(--crm-primary) !important;
    font-weight: 600;
    transition: all 0.18s ease-in-out;
}

.btn-outline-primary:hover, .btn-outline-primary:focus, .btn-outline-primary:active {
    background-color: var(--crm-primary) !important;
    border-color: var(--crm-primary) !important;
    color: #ffffff !important;
    transform: translateY(-1px);
}

/* Utility Theme Colors */
.bg-primary {
    background-color: var(--crm-primary) !important;
}

.text-primary {
    color: var(--crm-primary) !important;
}

.border-primary {
    border-color: var(--crm-primary) !important;
}

.badge.bg-primary-subtle {
    background-color: var(--crm-primary-light) !important;
    color: var(--crm-primary) !important;
    border-color: #b7e1c8 !important;
}

/* Drop-shadow for Logo */
.brand-logo-img {
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.15));
    transition: transform 0.2s ease;
}
.brand-logo-img:hover {
    transform: scale(1.02);
}

/* Card Styling & Depth */
.card {
    background-color: #ffffff;
    border: 1px solid var(--crm-border);
    border-radius: 1rem;
    box-shadow: var(--shadow-card);
    transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.2s ease;
}

/* Polished KPI Cards with Colored Top Accent */
.kpi-card {
    position: relative;
    overflow: hidden;
    border-top: 3.5px solid transparent;
}

.kpi-card-primary {
    border-top-color: var(--crm-primary);
}
.kpi-card-success {
    border-top-color: #059669;
}
.kpi-card-info {
    border-top-color: #0284c7;
}
.kpi-card-warning {
    border-top-color: #d97706;
}

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

.kpi-stat-value {
    font-size: clamp(1.75rem, 1.4rem + 1.2vw, 2.35rem);
    letter-spacing: -0.03em;
}

/* Pulsing Status Beacon */
.status-beacon {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: #10b981;
    display: inline-block;
    position: relative;
}
.status-beacon::after {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background-color: rgba(16, 185, 129, 0.4);
    animation: beacon-pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}
@keyframes beacon-pulse {
    0%, 100% { transform: scale(1); opacity: 0.8; }
    50% { transform: scale(1.8); opacity: 0; }
}

/* Quick Action Bar Hover */
.quick-action-pill {
    transition: all 0.15s ease-in-out;
}
.quick-action-pill:hover {
    background-color: #f1f5f9;
    transform: translateY(-1px);
}

/* Secondary Metrics Bar */
.secondary-metric-item {
    transition: background-color 0.18s ease;
    border-radius: 0.6rem;
}
.secondary-metric-item:hover {
    background-color: var(--crm-slate-50);
}

.divide-cols > [class*='col-']:not(:last-child) {
    border-right: 1px solid var(--crm-border);
}

@media (max-width: 767.98px) {
    .divide-cols > [class*='col-']:not(:last-child) {
        border-right: none;
        border-bottom: 1px solid var(--crm-border);
    }
}

/* Task Checkbox & Item */
.task-item {
    transition: background-color 0.18s ease, transform 0.15s ease;
}
.task-item:hover {
    background-color: #fafbfc;
}
.task-quick-check {
    width: 22px;
    height: 22px;
    border-radius: 6px;
    border: 2px solid #cbd5e1;
    background: transparent;
    cursor: pointer;
    transition: all 0.18s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}
.task-quick-check:hover {
    border-color: var(--crm-primary);
    background-color: var(--crm-primary-light);
    color: var(--crm-primary);
}

/* Activity Timeline Feed */
.timeline-icon-wrap {
    width: 34px;
    height: 34px;
    flex-shrink: 0;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.95rem;
}

/* Typography Helpers */
.text-xs {
    font-size: 0.75rem;
}

/* Custom Badges */
.badge.bg-indigo {
    background-color: #6366f1 !important;
}
.badge.bg-teal {
    background-color: #0d9488 !important;
}

/* Print Styles for Physical Letters */
@media print {
    body {
        background-color: #ffffff !important;
    }
    .crm-sidebar, .crm-topbar, footer, .btn, .no-print {
        display: none !important;
    }
    .crm-main-viewport {
        margin: 0 !important;
        padding: 0 !important;
    }
    .card {
        border: none !important;
        box-shadow: none !important;
    }
    .page-break {
        page-break-after: always;
    }
}
