/**
 * CRM Custom Styles
 * Founder Support Business
 */

:root {
    --primary: #1e3a5f;
    --primary-light: #2d5a87;
    --primary-dark: #152a45;
    --accent: #e67e22;
    --accent-light: #f39c4d;
    --accent-dark: #d35400;
    --success: #27ae60;
    --warning: #f1c40f;
    --danger: #e74c3c;
    --info: #3498db;
    --gray-100: #f8f9fa;
    --gray-200: #e9ecef;
    --gray-300: #dee2e6;
    --gray-400: #ced4da;
    --gray-500: #adb5bd;
    --gray-600: #6c757d;
    --gray-700: #495057;
    --gray-800: #343a40;
    --gray-900: #212529;
    --sidebar-width: 260px;
    --header-height: 60px;
    --border-radius: 8px;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.1);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.12);
    --transition: all 0.2s ease;
}

* { box-sizing: border-box; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 14px;
    line-height: 1.6;
    color: var(--gray-800);
    background-color: var(--gray-100);
    margin: 0;
    padding: 0;
}

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

/* Layout */
.app-wrapper { display: flex; min-height: 100vh; }

.sidebar {
    width: var(--sidebar-width);
    background: linear-gradient(180deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 1000;
    overflow-y: auto;
}

.sidebar-header { padding: 20px 24px; border-bottom: 1px solid rgba(255,255,255,0.1); }
.sidebar-logo { font-size: 24px; font-weight: 700; color: white; display: flex; align-items: center; gap: 10px; }
.sidebar-logo i { color: var(--accent); }
.sidebar-nav { padding: 20px 0; }
.nav-section { margin-bottom: 24px; }
.nav-section-title { padding: 0 24px; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 1px; color: rgba(255,255,255,0.5); margin-bottom: 8px; }

.nav-item {
    display: flex;
    padding: 12px 24px;
    color: rgba(255,255,255,0.8);
    align-items: center;
    gap: 12px;
    transition: var(--transition);
    border-left: 3px solid transparent;
}
.nav-item:hover { background: rgba(255,255,255,0.1); color: white; }
.nav-item.active { background: rgba(255,255,255,0.1); color: white; border-left-color: var(--accent); }
.nav-item i { width: 20px; text-align: center; font-size: 16px; }
.nav-badge { margin-left: auto; background: var(--accent); color: white; font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 10px; }

.main-content { flex: 1; margin-left: var(--sidebar-width); min-height: 100vh; }

.main-header {
    background: white;
    height: var(--header-height);
    padding: 0 30px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-left { display: flex; align-items: center; gap: 20px; }
.page-title { font-size: 18px; font-weight: 600; color: var(--gray-800); margin: 0; }
.header-right { display: flex; align-items: center; gap: 20px; position: relative; }

.header-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: var(--transition);
}
.header-user:hover { background: var(--gray-100); }

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 14px;
    flex-shrink: 0;
}

.user-info { text-align: left; }
.user-name { font-weight: 600; font-size: 14px; color: var(--gray-800); }
.user-role { font-size: 12px; color: var(--gray-500); }

/* Dropdown */
.dropdown { position: relative; }
.dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    min-width: 180px;
    padding: 8px 0;
    display: none;
    z-index: 1000;
    margin-top: 8px;
}
.dropdown-menu.open { display: block; }
.dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    color: var(--gray-700);
    transition: var(--transition);
}
.dropdown-item:hover { background: var(--gray-100); color: var(--gray-800); }
.dropdown-item i { width: 16px; }

.page-content { padding: 30px; }

/* Cards */
.card {
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
    border: none;
    margin-bottom: 24px;
}
.card-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--gray-200);
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.card-title { font-size: 16px; font-weight: 600; margin: 0; color: var(--gray-800); }
.card-body { padding: 24px; }

/* Stats */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 24px; margin-bottom: 30px; }
.stat-card {
    background: white;
    border-radius: var(--border-radius);
    padding: 24px;
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: flex-start;
    gap: 16px;
    transition: var(--transition);
}
.stat-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--border-radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}
.stat-icon.primary { background: rgba(30, 58, 95, 0.1); color: var(--primary); }
.stat-icon.success { background: rgba(39, 174, 96, 0.1); color: var(--success); }
.stat-icon.warning { background: rgba(241, 196, 15, 0.1); color: var(--warning); }
.stat-icon.danger { background: rgba(231, 76, 60, 0.1); color: var(--danger); }
.stat-icon.info { background: rgba(52, 152, 219, 0.1); color: var(--info); }
.stat-icon.accent { background: rgba(230, 126, 34, 0.1); color: var(--accent); }
.stat-content { flex: 1; }
.stat-value { font-size: 28px; font-weight: 700; color: var(--gray-800); line-height: 1.2; }
.stat-label { font-size: 13px; color: var(--gray-500); margin-top: 4px; }

/* Tables */
.table-responsive { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th {
    text-align: left;
    padding: 12px 16px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--gray-500);
    background: var(--gray-100);
    border-bottom: 1px solid var(--gray-200);
}
.table td { padding: 16px; border-bottom: 1px solid var(--gray-200); vertical-align: middle; }
.table tbody tr { transition: var(--transition); }
.table tbody tr:hover { background: var(--gray-100); }
.table tbody tr:last-child td { border-bottom: none; }

/* Badges */
.badge { display: inline-block; padding: 4px 10px; font-size: 12px; font-weight: 600; border-radius: 20px; }
.badge-primary { background: rgba(30, 58, 95, 0.1); color: var(--primary); }
.badge-success { background: rgba(39, 174, 96, 0.1); color: var(--success); }
.badge-warning { background: rgba(241, 196, 15, 0.15); color: #b7950b; }
.badge-danger { background: rgba(231, 76, 60, 0.1); color: var(--danger); }
.badge-info { background: rgba(52, 152, 219, 0.1); color: var(--info); }
.badge-secondary { background: var(--gray-200); color: var(--gray-600); }
.badge-dark { background: var(--gray-800); color: white; }

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 500;
    border-radius: var(--border-radius);
    border: none;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
}
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-light); color: white; }
.btn-accent { background: var(--accent); color: white; }
.btn-accent:hover { background: var(--accent-dark); color: white; }
.btn-success { background: var(--success); color: white; }
.btn-success:hover { background: #219a52; color: white; }
.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { background: #c0392b; color: white; }
.btn-outline { background: transparent; border: 1px solid var(--gray-300); color: var(--gray-700); }
.btn-outline:hover { background: var(--gray-100); border-color: var(--gray-400); }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-lg { padding: 14px 28px; font-size: 16px; }
.btn-icon { width: 36px; height: 36px; padding: 0; border-radius: 50%; }

/* Forms */
.form-group { margin-bottom: 20px; }
.form-label { display: block; font-size: 13px; font-weight: 600; color: var(--gray-700); margin-bottom: 6px; }
.form-control {
    width: 100%;
    padding: 10px 14px;
    font-size: 14px;
    border: 1px solid var(--gray-300);
    border-radius: var(--border-radius);
    transition: var(--transition);
    background: white;
}
.form-control:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(30, 58, 95, 0.1); }
.form-control::placeholder { color: var(--gray-400); }
textarea.form-control { min-height: 100px; resize: vertical; }
select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236c757d' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 20px; }

/* Alerts */
.alert {
    padding: 16px 20px;
    border-radius: var(--border-radius);
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
}
.alert-success { background: rgba(39, 174, 96, 0.1); color: #1e7e34; border-left: 4px solid var(--success); }
.alert-danger { background: rgba(231, 76, 60, 0.1); color: #c0392b; border-left: 4px solid var(--danger); }
.alert-warning { background: rgba(241, 196, 15, 0.1); color: #856404; border-left: 4px solid var(--warning); }
.alert-info { background: rgba(52, 152, 219, 0.1); color: #0c5460; border-left: 4px solid var(--info); }

/* Pipeline Board */
.pipeline-board {
    display: flex;
    gap: 16px;
    overflow-x: auto;
    padding-bottom: 20px;
    min-height: 500px;
}
.pipeline-column {
    min-width: 280px;
    max-width: 280px;
    background: var(--gray-100);
    border-radius: var(--border-radius);
    display: flex;
    flex-direction: column;
}
.pipeline-column-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    border-bottom: 2px solid var(--gray-200);
}
.pipeline-column-title { font-size: 14px; font-weight: 600; color: var(--gray-700); }
.pipeline-column-count { background: var(--gray-300); color: var(--gray-600); font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 10px; }
.pipeline-cards { padding: 12px; flex: 1; min-height: 100px; }
.pipeline-card {
    background: white;
    border-radius: var(--border-radius);
    padding: 16px;
    margin-bottom: 12px;
    box-shadow: var(--shadow-sm);
    cursor: grab;
    transition: var(--transition);
    border-left: 3px solid transparent;
}
.pipeline-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.pipeline-card.dragging { opacity: 0.5; cursor: grabbing; }
.pipeline-card-title { font-weight: 600; margin-bottom: 4px; color: var(--gray-800); }
.pipeline-card-company { font-size: 13px; color: var(--gray-500); margin-bottom: 8px; }
.pipeline-card-footer { display: flex; align-items: center; justify-content: space-between; font-size: 12px; color: var(--gray-400); }
.pipeline-card-value { font-weight: 600; color: var(--success); }

.pipeline-column[data-status="lead"] .pipeline-card { border-left-color: var(--gray-400); }
.pipeline-column[data-status="contacted"] .pipeline-card { border-left-color: var(--info); }
.pipeline-column[data-status="audit_scheduled"] .pipeline-card { border-left-color: var(--primary); }
.pipeline-column[data-status="audit_done"] .pipeline-card { border-left-color: var(--primary); }
.pipeline-column[data-status="trial"] .pipeline-card { border-left-color: var(--warning); }
.pipeline-column[data-status="retainer"] .pipeline-card { border-left-color: var(--success); }

.pipeline-column.drag-over { background: rgba(52, 152, 219, 0.1); }

/* Login */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    padding: 20px;
}
.login-box {
    width: 100%;
    max-width: 420px;
    background: white;
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    padding: 48px 40px;
}
.login-header { text-align: center; margin-bottom: 32px; }
.login-logo { font-size: 32px; font-weight: 700; color: var(--primary); margin-bottom: 8px; }
.login-subtitle { color: var(--gray-500); font-size: 14px; }
.login-form .form-group { margin-bottom: 24px; }
.login-form .btn { width: 100%; padding: 14px; font-size: 15px; }

/* Utilities */
.text-muted { color: var(--gray-500); }
.text-primary { color: var(--primary); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
.text-right { text-align: right; }
.text-center { text-align: center; }
.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.mb-4 { margin-bottom: 32px; }
.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.d-flex { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: 8px; }
.gap-2 { gap: 16px; }
.font-weight-bold { font-weight: 600; }

.empty-state { text-align: center; padding: 48px 24px; color: var(--gray-500); }
.empty-state i { font-size: 48px; margin-bottom: 16px; opacity: 0.5; }
.empty-state p { margin-bottom: 20px; }

/* Responsive */
@media (max-width: 992px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .main-content { margin-left: 0; }
}

@media (max-width: 768px) {
    .stats-grid { grid-template-columns: 1fr; }
    .page-content { padding: 20px; }
    .card-body { padding: 16px; }
    .pipeline-board { flex-direction: column; }
    .pipeline-column { min-width: 100%; max-width: 100%; }
}
