/**
 * Lead Platform - Main Stylesheet
 * Mobile-first responsive design
 */

/* ========================================
   CSS Variables
======================================== */
:root {
    --primary: #3b82f6;
    --primary-dark: #2563eb;
    --secondary: #6b7280;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --light: #f3f4f6;
    --dark: #1f2937;
    --white: #ffffff;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;
    --sidebar-width: 256px;
    --header-height: 64px;
    --transition: 150ms ease;
}

/* ========================================
   Reset & Base
======================================== */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.5;
    color: var(--gray-800);
    background-color: var(--gray-50);
}

a {
    color: var(--primary);
    text-decoration: none;
}

a:hover {
    color: var(--primary-dark);
}

/* ========================================
   Layout
======================================== */
.min-h-screen {
    min-height: 100vh;
}

.flex {
    display: flex;
}

.flex-1 {
    flex: 1;
}

.flex-col {
    flex-direction: column;
}

/* ========================================
   Sidebar
======================================== */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background-color: var(--gray-800);
    color: var(--white);
    z-index: 50;
    display: flex;
    flex-direction: column;
    transform: translateX(-100%);
    transition: transform var(--transition);
}

.sidebar.open {
    transform: translateX(0);
}

.sidebar-header {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--gray-700);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.sidebar-title {
    font-size: 1.25rem;
    font-weight: 700;
}

.sidebar-close {
    display: block;
    background: none;
    border: none;
    color: var(--white);
    cursor: pointer;
    padding: 0.25rem;
}

.sidebar-nav {
    flex: 1;
    padding: 1rem;
    overflow-y: auto;
}

.nav-link {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    color: var(--gray-300);
    border-radius: 0.375rem;
    margin-bottom: 0.25rem;
    transition: background-color var(--transition), color var(--transition);
}

.nav-link:hover {
    background-color: var(--gray-700);
    color: var(--white);
}

.nav-link.active {
    background-color: var(--gray-700);
    color: var(--white);
}

.nav-link svg {
    width: 1.25rem;
    height: 1.25rem;
    margin-right: 0.75rem;
    flex-shrink: 0;
}

.nav-badge {
    margin-left: auto;
    background-color: var(--danger);
    color: var(--white);
    font-size: 0.75rem;
    padding: 0.125rem 0.5rem;
    border-radius: 9999px;
    font-weight: 600;
}

.nav-section {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--gray-700);
}

.nav-section-title {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--gray-400);
    padding: 0 1rem;
    margin-bottom: 0.5rem;
}

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

.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 40;
}

.sidebar-overlay.show {
    display: block;
}

/* ========================================
   Header
======================================== */
.header {
    height: var(--header-height);
    background-color: var(--white);
    border-bottom: 1px solid var(--gray-200);
    padding: 0 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.header-left {
    display: flex;
    align-items: center;
}

.mobile-menu-btn {
    display: block;
    background: none;
    border: none;
    padding: 0.5rem;
    margin-right: 1rem;
    cursor: pointer;
    color: var(--gray-600);
}

.page-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--gray-800);
}

.header-right {
    display: flex;
    align-items: center;
}

.user-dropdown {
    position: relative;
}

.user-dropdown-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--gray-700);
    font-weight: 500;
}

.dropdown-menu {
    display: none;
    position: absolute;
    right: 0;
    top: 100%;
    margin-top: 0.5rem;
    background-color: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: 0.375rem;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    min-width: 160px;
    z-index: 50;
}

.dropdown-menu.show {
    display: block;
}

.dropdown-item {
    display: block;
    width: 100%;
    padding: 0.5rem 1rem;
    text-align: left;
    color: var(--gray-700);
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.875rem;
}

.dropdown-item:hover {
    background-color: var(--gray-100);
}

/* ========================================
   Main Content
======================================== */
main {
    padding: 1.5rem;
}

/* ========================================
   Cards
======================================== */
.card {
    background-color: var(--white);
    border-radius: 0.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.card-header {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--gray-800);
}

.card-body {
    padding: 1.5rem;
}

/* ========================================
   Stats Cards
======================================== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

.stats-grid-2 {
    grid-template-columns: repeat(2, 1fr);
}

.stat-card {
    background-color: var(--white);
    border-radius: 0.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    padding: 1.25rem;
    display: flex;
    align-items: center;
}

.stat-icon {
    width: 3rem;
    height: 3rem;
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 1rem;
    flex-shrink: 0;
}

.stat-content {
    flex: 1;
    min-width: 0;
}

.stat-label {
    font-size: 0.875rem;
    color: var(--gray-500);
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--gray-800);
}

/* ========================================
   Buttons
======================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: 0.375rem;
    border: 1px solid transparent;
    cursor: pointer;
    transition: all var(--transition);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    background-color: var(--primary);
    color: var(--white);
}

.btn-primary:hover {
    background-color: var(--primary-dark);
}

.btn-secondary {
    background-color: var(--white);
    color: var(--gray-700);
    border-color: var(--gray-300);
}

.btn-secondary:hover {
    background-color: var(--gray-50);
}

.btn-danger {
    background-color: var(--danger);
    color: var(--white);
}

.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.75rem;
}

.btn-block {
    width: 100%;
}

/* ========================================
   Forms
======================================== */
.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--gray-700);
    margin-bottom: 0.25rem;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="tel"],
input[type="number"],
textarea,
select {
    width: 100%;
    padding: 0.5rem 0.75rem;
    font-size: 1rem;
    border: 1px solid var(--gray-300);
    border-radius: 0.375rem;
    background-color: var(--white);
    transition: border-color var(--transition), box-shadow var(--transition);
}

input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* ========================================
   Tables
======================================== */
.table-container {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th, td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--gray-200);
}

th {
    background-color: var(--gray-50);
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--gray-500);
}

tr:hover {
    background-color: var(--gray-50);
}

/* ========================================
   Badges
======================================== */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 500;
    border-radius: 9999px;
}

/* ========================================
   Alerts
======================================== */
.alert {
    padding: 0.75rem 1rem;
    border-radius: 0.375rem;
    margin-bottom: 1rem;
}

.alert-error {
    background-color: #fee2e2;
    color: #b91c1c;
    border: 1px solid #fca5a5;
}

.alert-success {
    background-color: #dcfce7;
    color: #15803d;
    border: 1px solid #86efac;
}

/* ========================================
   Leads List
======================================== */
.leads-list {
    display: flex;
    flex-direction: column;
}

.lead-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--gray-100);
    color: var(--gray-800);
}

.lead-item:last-child {
    border-bottom: none;
}

.lead-item:hover {
    background-color: var(--gray-50);
    margin: 0 -1.5rem;
    padding-left: 1.5rem;
    padding-right: 1.5rem;
}

.lead-item.unread {
    font-weight: 600;
}

.lead-info {
    flex: 1;
    min-width: 0;
}

.lead-name {
    font-weight: 500;
    color: var(--gray-800);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.lead-project {
    font-size: 0.875rem;
    color: var(--gray-500);
}

.lead-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.25rem;
    margin-left: 1rem;
}

.lead-date {
    font-size: 0.75rem;
    color: var(--gray-400);
}

/* ========================================
   Status List
======================================== */
.status-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.status-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.status-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.status-dot {
    width: 0.75rem;
    height: 0.75rem;
    border-radius: 50%;
}

.status-name {
    font-size: 0.875rem;
    color: var(--gray-700);
}

.status-count {
    font-weight: 600;
    color: var(--gray-800);
}

/* ========================================
   Projects Grid
======================================== */
.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1rem;
}

.project-card {
    display: block;
    padding: 1.25rem;
    background-color: var(--gray-50);
    border-radius: 0.5rem;
    border: 1px solid var(--gray-200);
    transition: all var(--transition);
}

.project-card:hover {
    border-color: var(--primary);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.project-name {
    font-weight: 600;
    color: var(--gray-800);
    margin-bottom: 0.5rem;
}

.project-stats {
    display: flex;
    gap: 1rem;
    font-size: 0.875rem;
    color: var(--gray-500);
}

.project-stat.new {
    color: var(--primary);
}

/* ========================================
   Login Page
======================================== */
.login-container {
    width: 100%;
    max-width: 400px;
    padding: 2rem;
    background-color: var(--white);
    border-radius: 0.5rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.login-header {
    text-align: center;
    margin-bottom: 2rem;
}

.login-header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--gray-800);
}

.login-header p {
    color: var(--gray-500);
    margin-top: 0.5rem;
}

/* ========================================
   Utilities
======================================== */
.text-center { text-align: center; }
.text-gray-500 { color: var(--gray-500); }
.mt-4 { margin-top: 1rem; }
.mt-6 { margin-top: 1.5rem; }
.mb-4 { margin-bottom: 1rem; }
.py-4 { padding-top: 1rem; padding-bottom: 1rem; }
.hidden { display: none !important; }

.grid { display: grid; }
.grid-cols-1 { grid-template-columns: repeat(1, 1fr); }
.gap-6 { gap: 1.5rem; }

.bg-blue-100 { background-color: #dbeafe; }
.bg-green-100 { background-color: #dcfce7; }
.bg-purple-100 { background-color: #f3e8ff; }
.bg-yellow-100 { background-color: #fef9c3; }
.text-blue-600 { color: #2563eb; }
.text-green-600 { color: #16a34a; }
.text-purple-600 { color: #9333ea; }
.text-yellow-600 { color: #ca8a04; }

/* ========================================
   Responsive - Tablet and up
======================================== */
@media (min-width: 768px) {
    .sidebar {
        transform: translateX(0);
    }
    
    .sidebar-close {
        display: none;
    }
    
    .sidebar-overlay {
        display: none !important;
    }
    
    .mobile-menu-btn {
        display: none;
    }
    
    main {
        margin-left: var(--sidebar-width);
    }
    
    .header {
        margin-left: var(--sidebar-width);
    }
    
    .stats-grid {
        grid-template-columns: repeat(4, 1fr);
    }
    
    .stats-grid-2 {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ========================================
   Responsive - Desktop
======================================== */
@media (min-width: 1024px) {
    .grid-cols-1.lg\:grid-cols-2 {
        grid-template-columns: repeat(2, 1fr);
    }
}
