/* Modern Dark CRM - Compact & Sleek */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
    /* Dark Modern Palette */
    --primary-400: #60a5fa;
    --primary-500: #3b82f6;
    --primary-600: #2563eb;
    --accent-400: #34d399;
    --accent-500: #10b981;
    --accent-600: #059669;
    --orange-400: #fb923c;
    --orange-500: #f97316;
    
    /* Dark Backgrounds */
    --bg-primary: #0a0a0a;
    --bg-secondary: #111111;
    --bg-tertiary: #1a1a1a;
    --surface-1: #1e1e1e;
    --surface-2: #252525;
    --surface-3: #2d2d2d;
    --surface-hover: #333333;
    
    /* Modern Text */
    --text-primary: #ffffff;
    --text-secondary: #e4e4e7;
    --text-tertiary: #a1a1aa;
    --text-muted: #71717a;
    --text-disabled: #52525b;
    
    /* Compact Borders */
    --border-1: #2d2d2d;
    --border-2: #404040;
    --border-3: #525252;
    
    /* Status Colors */
    --success: #22c55e;
    --warning: #f59e0b;
    --error: #ef4444;
    --info: #3b82f6;
    
    /* Compact Typography */
    --font-xs: 11px;
    --font-sm: 12px;
    --font-base: 13px;
    --font-md: 14px;
    --font-lg: 15px;
    --font-xl: 16px;
    --font-2xl: 18px;
    --font-3xl: 20px;
    
    /* Compact Spacing */
    --space-0: 0px;
    --space-1: 2px;
    --space-2: 4px;
    --space-3: 6px;
    --space-4: 8px;
    --space-5: 10px;
    --space-6: 12px;
    --space-8: 16px;
    --space-10: 20px;
    --space-12: 24px;
    
    /* Compact Component Sizes */
    --btn-height: 28px;
    --btn-height-lg: 32px;
    --input-height: 30px;
    --table-row: 32px;
    --sidebar-width: 220px;
    
    /* Modern Effects */
    --shadow-glow: 0 0 20px rgb(59 130 246 / 0.15);
    --shadow-1: 0 1px 3px rgb(0 0 0 / 0.3);
    --shadow-2: 0 4px 8px rgb(0 0 0 / 0.2);
    --gradient-primary: linear-gradient(135deg, var(--primary-500), var(--primary-600));
    --gradient-accent: linear-gradient(135deg, var(--accent-500), var(--accent-600));
    
    /* Fast Transitions */
    --transition: all 150ms ease;
}

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

html {
    font-size: 13px;
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.4;
    font-weight: 400;
    -webkit-font-smoothing: antialiased;
    font-feature-settings: 'cv02', 'cv03', 'cv04', 'cv11';
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    line-height: 1.2;
    color: var(--text-primary);
}

h1 { font-size: var(--font-3xl); font-weight: 700; }
h2 { font-size: var(--font-2xl); font-weight: 600; }
h3 { font-size: var(--font-xl); font-weight: 600; }
h4 { font-size: var(--font-lg); font-weight: 500; }
h5 { font-size: var(--font-base); font-weight: 500; }

/* Layout */
.layout {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    background: var(--bg-primary);
}

.main-layout {
    display: flex;
    flex: 1;
}

/* Compact Navigation */
.navbar {
    background: var(--surface-1);
    border-bottom: 1px solid var(--border-1);
    padding: var(--space-4) var(--space-6);
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 48px;
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(8px);
}

.nav-brand h1 {
    font-size: var(--font-lg);
    font-weight: 700;
    background: var(--gradient-primary);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin: 0;
}

.nav-user {
    display: flex;
    align-items: center;
    gap: var(--space-5);
    font-size: var(--font-xs);
    font-weight: 500;
    color: var(--text-secondary);
}

.user-role {
    background: var(--surface-3);
    color: var(--accent-400);
    padding: var(--space-1) var(--space-3);
    border-radius: 4px;
    font-size: var(--font-xs);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border: 1px solid var(--accent-500);
}

/* Compact Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: var(--surface-1);
    border-right: 1px solid var(--border-1);
    padding: var(--space-5) 0;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}

.sidebar-nav {
    padding: 0 var(--space-4);
}

.nav-link {
    display: block;
    padding: var(--space-3) var(--space-4);
    color: var(--text-tertiary);
    text-decoration: none;
    border-radius: 4px;
    margin-bottom: var(--space-2);
    font-weight: 500;
    font-size: var(--font-sm);
    transition: var(--transition);
    border-left: 2px solid transparent;
}

.nav-link:hover {
    background: var(--surface-hover);
    color: var(--text-secondary);
    border-left-color: var(--primary-500);
}

.nav-link.active {
    background: var(--surface-3);
    color: var(--primary-400);
    border-left-color: var(--primary-500);
    font-weight: 600;
    box-shadow: var(--shadow-glow);
}

/* Main Content */
.main-content {
    flex: 1;
    padding: var(--space-6);
    background: var(--bg-secondary);
    overflow-y: auto;
}

.content-header {
    margin-bottom: var(--space-6);
    padding-bottom: var(--space-4);
    border-bottom: 1px solid var(--border-1);
}

.content-header h2 {
    font-size: var(--font-2xl);
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: var(--space-2);
    background: var(--gradient-primary);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.desk-info {
    font-size: var(--font-sm);
    color: var(--text-muted);
}

/* Compact Dashboard Grid */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: var(--space-5);
    margin-bottom: var(--space-6);
}

.dashboard-section {
    background: var(--surface-1);
    border: 1px solid var(--border-1);
    border-radius: 6px;
    padding: var(--space-5);
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.dashboard-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--gradient-primary);
    opacity: 0.7;
}

.dashboard-section:hover {
    border-color: var(--border-2);
    box-shadow: var(--shadow-glow);
}

.dashboard-section h3 {
    font-size: var(--font-md);
    font-weight: 600;
    margin-bottom: var(--space-4);
    color: var(--text-primary);
}

/* Compact Stats */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: var(--space-4);
    margin-bottom: var(--space-6);
}

.stat-card {
    background: var(--surface-2);
    border: 1px solid var(--border-1);
    padding: var(--space-5);
    border-radius: 6px;
    text-align: center;
    transition: var(--transition);
    position: relative;
}

.stat-card:hover {
    border-color: var(--primary-500);
    transform: translateY(-1px);
    box-shadow: var(--shadow-2);
}

.stat-number {
    font-size: var(--font-2xl);
    font-weight: 700;
    color: var(--primary-400);
    margin-bottom: var(--space-2);
    display: block;
}

.stat-label {
    color: var(--text-tertiary);
    font-weight: 500;
    font-size: var(--font-xs);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Compact Forms */
.form {
    max-width: 420px;
}

.form-group {
    margin-bottom: var(--space-4);
}

.form-group label {
    display: block;
    margin-bottom: var(--space-2);
    font-weight: 500;
    color: var(--text-secondary);
    font-size: var(--font-sm);
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0 var(--space-3);
    height: var(--input-height);
    border: 1px solid var(--border-2);
    border-radius: 4px;
    background: var(--surface-2);
    color: var(--text-primary);
    font-size: var(--font-sm);
    font-family: inherit;
    transition: var(--transition);
}

.form-group textarea {
    height: auto;
    min-height: 60px;
    padding: var(--space-3);
    resize: vertical;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-500);
    box-shadow: 0 0 0 2px rgb(59 130 246 / 0.2);
    background: var(--surface-1);
}

.form-group input::placeholder {
    color: var(--text-disabled);
    font-size: var(--font-xs);
}

/* Compact Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: var(--btn-height);
    padding: 0 var(--space-4);
    border: 1px solid transparent;
    border-radius: 4px;
    font-size: var(--font-xs);
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn-primary {
    background: var(--gradient-primary);
    color: var(--text-primary);
    border-color: var(--primary-600);
    box-shadow: var(--shadow-1);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-glow), var(--shadow-2);
}

.btn-secondary {
    background: var(--surface-2);
    color: var(--text-secondary);
    border-color: var(--border-2);
}

.btn-secondary:hover {
    background: var(--surface-3);
    color: var(--text-primary);
    border-color: var(--border-3);
}

.btn-accent {
    background: var(--gradient-accent);
    color: var(--text-primary);
    border-color: var(--accent-600);
}

.btn-outline {
    background: transparent;
    color: var(--text-tertiary);
    border-color: var(--border-2);
}

.btn-outline:hover {
    background: var(--surface-hover);
    color: var(--text-secondary);
    border-color: var(--primary-500);
}

.btn-sm {
    height: 24px;
    padding: 0 var(--space-3);
    font-size: var(--font-xs);
}

.btn-lg {
    height: var(--btn-height-lg);
    padding: 0 var(--space-6);
    font-size: var(--font-sm);
}

.btn-full {
    width: 100%;
}

/* Dense Tables */
.table-container {
    background: var(--surface-1);
    border: 1px solid var(--border-1);
    border-radius: 6px;
    overflow: hidden;
    margin-bottom: var(--space-5);
}

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--font-sm);
}

.table th {
    background: var(--surface-2);
    color: var(--text-secondary);
    font-weight: 600;
    text-align: left;
    padding: var(--space-3);
    font-size: var(--font-xs);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border-1);
    position: sticky;
    top: 0;
}

.table td {
    padding: var(--space-3);
    border-bottom: 1px solid var(--border-1);
    color: var(--text-tertiary);
    font-size: var(--font-sm);
    height: var(--table-row);
}

.table tr:hover {
    background: var(--surface-hover);
}

.table tr:hover td {
    color: var(--text-secondary);
}

/* Status Badges */
.status-badge {
    display: inline-block;
    padding: var(--space-1) var(--space-2);
    border-radius: 3px;
    font-size: var(--font-xs);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border: 1px solid currentColor;
}

/* Alerts */
.alert {
    padding: var(--space-3) var(--space-4);
    border-radius: 4px;
    margin-bottom: var(--space-4);
    font-size: var(--font-sm);
    font-weight: 500;
    border-left: 3px solid;
    background: var(--surface-2);
}

.alert-success {
    color: var(--success);
    border-left-color: var(--success);
    background: rgb(34 197 94 / 0.1);
}

.alert-error {
    color: var(--error);
    border-left-color: var(--error);
    background: rgb(239 68 68 / 0.1);
}

.alert-warning {
    color: var(--warning);
    border-left-color: var(--warning);
    background: rgb(245 158 11 / 0.1);
}

/* Login Page */
.login-page {
    background: var(--bg-primary);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-4);
    position: relative;
}

.login-page::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 50% 50%, rgb(59 130 246 / 0.1) 0%, transparent 50%);
}

.login-container {
    background: var(--surface-1);
    border: 1px solid var(--border-2);
    border-radius: 8px;
    padding: var(--space-8);
    width: 100%;
    max-width: 360px;
    position: relative;
    z-index: 1;
    box-shadow: var(--shadow-2);
}

.login-header {
    text-align: center;
    margin-bottom: var(--space-8);
}

.login-header h1 {
    font-size: var(--font-xl);
    font-weight: 700;
    background: var(--gradient-primary);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: var(--space-2);
}

.login-header p {
    color: var(--text-muted);
    font-size: var(--font-sm);
}

/* Filters */
.filters {
    background: var(--surface-1);
    border: 1px solid var(--border-1);
    padding: var(--space-4);
    border-radius: 6px;
    margin-bottom: var(--space-5);
}

.filter-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: var(--space-3);
    margin-bottom: var(--space-4);
}

.filter-actions {
    display: flex;
    gap: var(--space-2);
    flex-wrap: wrap;
}

/* Data Tables */
.data-table {
    background: var(--surface-1);
    border-radius: 4px;
    overflow: hidden;
    border: 1px solid var(--border-1);
}

.data-table table {
    width: 100%;
    font-size: var(--font-sm);
}

.data-table th {
    background: var(--surface-2);
    padding: var(--space-2) var(--space-3);
    text-align: left;
    font-weight: 600;
    color: var(--text-secondary);
    font-size: var(--font-xs);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.data-table td {
    padding: var(--space-2) var(--space-3);
    border-top: 1px solid var(--border-1);
    color: var(--text-tertiary);
}

.data-table tr:hover td {
    background: var(--surface-hover);
    color: var(--text-secondary);
}

.section-footer {
    margin-top: var(--space-4);
    padding-top: var(--space-3);
    border-top: 1px solid var(--border-1);
}

.empty-state {
    color: var(--text-muted);
    text-align: center;
    padding: var(--space-6);
    font-size: var(--font-sm);
}

.empty-state a {
    color: var(--primary-400);
    text-decoration: none;
    font-weight: 500;
}

.empty-state a:hover {
    color: var(--primary-300);
    text-decoration: underline;
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        width: 100%;
        height: auto;
        padding: var(--space-3) 0;
    }
    
    .sidebar-nav {
        display: flex;
        overflow-x: auto;
        padding: 0 var(--space-4);
        gap: var(--space-2);
    }
    
    .nav-link {
        white-space: nowrap;
        margin-bottom: 0;
    }
    
    .main-content {
        padding: var(--space-4);
    }
    
    .stats-grid {
        grid-template-columns: 1fr 1fr;
    }
    
    .filter-grid {
        grid-template-columns: 1fr;
    }
    
    .filter-actions {
        flex-direction: column;
    }
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: var(--surface-1);
}

::-webkit-scrollbar-thumb {
    background: var(--border-3);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary-500);
}

/* Focus */
.btn:focus,
input:focus,
select:focus,
textarea:focus,
.nav-link:focus {
    outline: 2px solid var(--primary-500);
    outline-offset: 1px;
}

/* Pagination */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: var(--space-8) 0;
    margin-top: var(--space-8);
    border-top: 1px solid var(--border-1);
    flex-wrap: wrap;
}

.pagination-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 32px;
    padding: 0 var(--space-4);
    background: var(--surface-1);
    border: 1px solid var(--border-2);
    border-radius: 4px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: var(--font-sm);
    font-weight: 500;
    transition: all 0.15s ease;
}

.pagination-link:hover {
    background: var(--surface-hover);
    border-color: var(--primary-500);
    color: var(--text-primary);
}

.pagination-link.active {
    background: var(--primary-600);
    border-color: var(--primary-600);
    color: var(--text-primary);
    cursor: default;
}

.pagination-ellipsis {
    color: var(--text-muted);
    padding: 0 var(--space-2);
}

.pagination-info {
    width: 100%;
    text-align: center;
    color: var(--text-muted);
    font-size: var(--font-sm);
    margin-top: var(--space-4);
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}
/* Quick Search Component */
.quick-search-container {
    position: relative;
    flex: 0 0 400px;
    max-width: 400px;
}

.quick-search-input {
    width: 100%;
    height: var(--btn-height-lg);
    padding: 0 var(--space-8) 0 36px;
    background: var(--surface-1);
    border: 1px solid var(--border-2);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: var(--font-sm);
    transition: all 0.2s ease;
}

.quick-search-input:focus {
    border-color: var(--primary-500);
    background: var(--surface-2);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.quick-search-input::placeholder {
    color: var(--text-muted);
}

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

.quick-search-results {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    max-height: 500px;
    overflow-y: auto;
    background: var(--surface-1);
    border: 1px solid var(--border-2);
    border-radius: 6px;
    box-shadow: var(--shadow-2);
    z-index: 1000;
    display: none;
}

.search-section {
    padding: var(--space-6);
}

.search-section + .search-section {
    border-top: 1px solid var(--border-1);
}

.search-section-title {
    font-size: var(--font-xs);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    margin-bottom: var(--space-4);
}

.search-result-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-4) var(--space-6);
    border-radius: 4px;
    text-decoration: none;
    color: var(--text-primary);
    transition: background 0.15s ease;
}

.search-result-item:hover {
    background: var(--surface-hover);
}

.search-result-main {
    flex: 1;
}

.search-result-main strong {
    display: block;
    font-size: var(--font-sm);
    color: var(--text-primary);
    margin-bottom: 2px;
}

.search-result-meta {
    font-size: var(--font-xs);
    color: var(--text-muted);
}

.search-result-badge {
    padding: 2px 8px;
    border-radius: 12px;
    font-size: var(--font-xs);
    font-weight: 500;
    color: white;
}

.search-no-results,
.search-error {
    padding: var(--space-10);
    text-align: center;
    color: var(--text-muted);
    font-size: var(--font-sm);
}

.lead-score-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 18px;
    padding: 0 6px;
    background: var(--primary-600);
    color: white;
    font-size: 10px;
    font-weight: 600;
    border-radius: 9px;
    margin-left: 6px;
}
