/* =============================================
   Fix IT CRM — Global Stylesheet
   Theme: Deep Dark Navy / Electric Blue Accent
   ============================================= */

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

/* ---- CSS Variables ---- */
:root {
  --bg-primary:    #030712;
  --bg-secondary:  #0b1528;
  --bg-card:       #0d1b2e;
  --bg-card-alt:   #101f34;
  --bg-hover:      #142240;
  --border:        #1e293b;
  --border-light:  #253654;
  --accent:        #38a3fd;
  --accent-hover:  #1e8fe8;
  --accent-glow:   rgba(56,163,253,0.18);
  --accent-dim:    rgba(56,163,253,0.12);
  --text-primary:  #ffffff;
  --text-secondary:#8f9cae;
  --text-muted:    #4e6077;
  --success:       #22c55e;
  --warning:       #f59e0b;
  --danger:        #ef4444;
  --purple:        #a855f7;
  --teal:          #14b8a6;
  --sidebar-w:     240px;
  --radius:        10px;
  --radius-sm:     6px;
  --shadow:        0 4px 24px rgba(0,0,0,0.5);
  --shadow-glow:   0 0 40px rgba(56,163,253,0.12);
}

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

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
button { cursor: pointer; font-family: inherit; }
input, select, textarea { font-family: inherit; }
img { max-width: 100%; }
ul, ol { list-style: none; }

/* ---- Scrollbar ---- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-secondary); }
::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent); }

/* =============================================
   LAYOUT — Sidebar + Main
   ============================================= */
.app-layout {
  display: flex;
  min-height: 100vh;
}

/* ---- Sidebar ---- */
.sidebar {
  width: var(--sidebar-w);
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0;
  height: 100vh;
  z-index: 100;
  overflow-y: auto;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 22px 20px;
  border-bottom: 1px solid var(--border);
}

.logo-icon {
  width: 36px; height: 36px;
  background: var(--accent);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
  box-shadow: 0 0 12px rgba(56,163,253,0.4);
}

.logo-text {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.3px;
}
.logo-text span { color: var(--accent); }

.sidebar-nav {
  padding: 16px 12px;
  flex: 1;
}

.nav-section-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  text-transform: uppercase;
  padding: 10px 8px 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  transition: all 0.18s ease;
  position: relative;
  margin-bottom: 2px;
}
.nav-item:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}
.nav-item.active {
  background: var(--accent-dim);
  color: var(--accent);
  border: 1px solid rgba(56,163,253,0.2);
}
.nav-item .nav-icon { font-size: 16px; width: 18px; text-align: center; }
.nav-item .badge {
  margin-left: auto;
  background: var(--accent);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 99px;
}

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid var(--border);
}
.user-profile {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border-radius: var(--radius-sm);
  transition: background 0.18s;
}
.user-profile:hover { background: var(--bg-hover); }
.avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--purple));
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; color: #fff;
  flex-shrink: 0;
}
.user-info .user-name { font-size: 13px; font-weight: 600; }
.user-info .user-role { font-size: 11px; color: var(--text-secondary); }

/* ---- Main Content ---- */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ---- Top Bar ---- */
.topbar {
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  padding: 14px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 50;
}
.topbar-title {
  font-size: 18px;
  font-weight: 700;
}
.topbar-title span { color: var(--accent); }
.topbar-right {
  display: flex;
  align-items: center;
  gap: 14px;
}
.topbar-search {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 14px;
  min-width: 220px;
}
.topbar-search input {
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-size: 13px;
  width: 100%;
}
.topbar-search input::placeholder { color: var(--text-muted); }
.topbar-search .icon { color: var(--text-muted); font-size: 14px; }

.icon-btn {
  width: 36px; height: 36px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-secondary);
  display: flex; align-items: center; justify-content: center;
  font-size: 15px;
  transition: all 0.18s;
}
.icon-btn:hover { border-color: var(--accent); color: var(--accent); }

/* ---- Page Body ---- */
.page-body {
  padding: 28px;
  flex: 1;
}

/* ---- Page Header ---- */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 12px;
}
.page-header h1 {
  font-size: 22px;
  font-weight: 700;
}
.page-header p {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 2px;
}
.header-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* =============================================
   COMPONENTS
   ============================================= */

/* ---- Buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  border: none;
  transition: all 0.18s ease;
  white-space: nowrap;
}
.btn-primary {
  background: var(--accent);
  color: #fff;
}
.btn-primary:hover { background: var(--accent-hover); box-shadow: 0 0 16px rgba(56,163,253,0.4); }

.btn-secondary {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border);
}
.btn-secondary:hover { background: var(--bg-hover); color: var(--text-primary); border-color: var(--border-light); }

.btn-danger {
  background: rgba(239,68,68,0.15);
  color: var(--danger);
  border: 1px solid rgba(239,68,68,0.3);
}
.btn-danger:hover { background: rgba(239,68,68,0.25); }

.btn-success {
  background: rgba(34,197,94,0.15);
  color: var(--success);
  border: 1px solid rgba(34,197,94,0.3);
}
.btn-success:hover { background: rgba(34,197,94,0.25); }

.btn-sm { padding: 6px 13px; font-size: 12px; }
.btn-lg { padding: 12px 26px; font-size: 15px; }
.btn-full { width: 100%; justify-content: center; }

/* ---- Cards ---- */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow);
}
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}
.card-title {
  font-size: 15px;
  font-weight: 600;
}
.card-subtitle {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 2px;
}

/* ---- Stat Cards ---- */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 18px;
  margin-bottom: 28px;
}
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  transition: border-color 0.2s, transform 0.2s;
}
.stat-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.stat-card .stat-icon {
  width: 42px; height: 42px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  margin-bottom: 14px;
}
.stat-card .stat-value {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.5px;
}
.stat-card .stat-label {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 4px;
}
.stat-card .stat-change {
  font-size: 12px;
  font-weight: 600;
  margin-top: 8px;
  display: flex;
  align-items: center;
  gap: 4px;
}
.stat-change.up { color: var(--success); }
.stat-change.down { color: var(--danger); }

/* Icon bg variants */
.icon-blue   { background: rgba(56,163,253,0.15); color: var(--accent); }
.icon-green  { background: rgba(34,197,94,0.15);  color: var(--success); }
.icon-yellow { background: rgba(245,158,11,0.15); color: var(--warning); }
.icon-purple { background: rgba(168,85,247,0.15); color: var(--purple); }
.icon-teal   { background: rgba(20,184,166,0.15); color: var(--teal); }
.icon-red    { background: rgba(239,68,68,0.15);  color: var(--danger); }

/* ---- Tables ---- */
.table-wrapper {
  overflow-x: auto;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
thead tr {
  background: var(--bg-card-alt);
  border-bottom: 1px solid var(--border);
}
thead th {
  padding: 13px 16px;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--text-secondary);
  white-space: nowrap;
}
tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background 0.15s;
}
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: var(--bg-hover); }
tbody td { padding: 13px 16px; color: var(--text-primary); vertical-align: middle; }

/* ---- Badges / Status Pills ---- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}
.badge-blue    { background: rgba(56,163,253,0.15); color: var(--accent); border: 1px solid rgba(56,163,253,0.25); }
.badge-green   { background: rgba(34,197,94,0.15);  color: var(--success); border: 1px solid rgba(34,197,94,0.25); }
.badge-yellow  { background: rgba(245,158,11,0.15); color: var(--warning); border: 1px solid rgba(245,158,11,0.25); }
.badge-red     { background: rgba(239,68,68,0.15);  color: var(--danger);  border: 1px solid rgba(239,68,68,0.25); }
.badge-purple  { background: rgba(168,85,247,0.15); color: var(--purple);  border: 1px solid rgba(168,85,247,0.25); }
.badge-teal    { background: rgba(20,184,166,0.15); color: var(--teal);    border: 1px solid rgba(20,184,166,0.25); }
.badge-grey    { background: rgba(100,116,139,0.2); color: var(--text-secondary); border: 1px solid var(--border); }
.badge::before { content: ''; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }

/* ---- Forms ---- */
.form-group { margin-bottom: 18px; }
.form-label { display: block; font-size: 12px; font-weight: 600; color: var(--text-secondary); margin-bottom: 7px; letter-spacing: 0.03em; }
.form-control {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 14px;
  outline: none;
  transition: border-color 0.18s, box-shadow 0.18s;
}
.form-control::placeholder { color: var(--text-muted); }
.form-control:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-dim); }
select.form-control { appearance: none; cursor: pointer; }
textarea.form-control { resize: vertical; min-height: 90px; }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

/* ---- Progress Bar ---- */
.progress-bar-wrap { background: var(--bg-secondary); border-radius: 99px; height: 6px; overflow: hidden; }
.progress-bar { height: 100%; border-radius: 99px; background: var(--accent); transition: width 0.4s; }
.progress-bar.green  { background: var(--success); }
.progress-bar.yellow { background: var(--warning); }
.progress-bar.red    { background: var(--danger); }
.progress-bar.purple { background: var(--purple); }

/* ---- Divider ---- */
.divider { border: none; border-top: 1px solid var(--border); margin: 20px 0; }

/* ---- Chart container ---- */
.chart-container { position: relative; }

/* ---- Grid Layouts ---- */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 20px; }
.grid-auto { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 20px; }

/* ---- Filters Bar ---- */
.filters-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.filter-select {
  padding: 8px 14px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 13px;
  outline: none;
  cursor: pointer;
}
.filter-select:focus { border-color: var(--accent); }
.search-input-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 14px;
  flex: 1;
  min-width: 200px;
}
.search-input-wrap input {
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-size: 13px;
  width: 100%;
}
.search-input-wrap input::placeholder { color: var(--text-muted); }

/* ---- Avatar cells in tables ---- */
.cell-user { display: flex; align-items: center; gap: 10px; }
.cell-user .mini-avatar {
  width: 30px; height: 30px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; color: #fff;
  flex-shrink: 0;
}

/* ---- Pipeline Kanban ---- */
.kanban-board {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 18px;
  align-items: start;
}
.kanban-col {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.kanban-col-header {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.kanban-col-title { font-size: 13px; font-weight: 600; }
.kanban-count {
  width: 22px; height: 22px;
  background: var(--bg-secondary);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700;
  color: var(--text-secondary);
}
.kanban-cards { padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.kanban-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 13px;
  transition: border-color 0.18s;
}
.kanban-card:hover { border-color: var(--accent); }
.kanban-card-title { font-size: 13px; font-weight: 600; margin-bottom: 6px; }
.kanban-card-company { font-size: 11px; color: var(--text-secondary); margin-bottom: 8px; }
.kanban-card-meta { display: flex; align-items: center; justify-content: space-between; }
.kanban-card-value { font-size: 13px; font-weight: 700; color: var(--accent); }

/* ---- Timeline ---- */
.timeline { position: relative; padding-left: 22px; }
.timeline::before {
  content: '';
  position: absolute; left: 7px; top: 0; bottom: 0;
  width: 2px;
  background: var(--border);
}
.timeline-item { position: relative; padding-bottom: 22px; }
.timeline-item::before {
  content: '';
  position: absolute; left: -18px; top: 5px;
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--bg-card);
}
.timeline-date { font-size: 11px; color: var(--text-muted); margin-bottom: 4px; }
.timeline-text { font-size: 13px; }
.timeline-sub  { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }

/* ---- Modal ---- */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(3,7,18,0.8);
  display: flex; align-items: center; justify-content: center;
  z-index: 999;
  opacity: 0; pointer-events: none;
  transition: opacity 0.2s;
  padding: 20px;
}
.modal-overlay.open { opacity: 1; pointer-events: all; }
.modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  width: 100%; max-width: 520px;
  box-shadow: var(--shadow);
  transform: translateY(-16px);
  transition: transform 0.2s;
}
.modal-overlay.open .modal { transform: translateY(0); }
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 22px;
}
.modal-title { font-size: 17px; font-weight: 700; }
.modal-close {
  background: none; border: none;
  color: var(--text-secondary); font-size: 20px;
  line-height: 1;
  transition: color 0.15s;
}
.modal-close:hover { color: var(--danger); }
.modal-footer { display: flex; gap: 10px; justify-content: flex-end; margin-top: 24px; }

/* ---- Toast ---- */
.toast {
  position: fixed; bottom: 28px; right: 28px;
  background: var(--bg-card-alt);
  border: 1px solid var(--border-light);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-sm);
  padding: 14px 18px;
  font-size: 13px;
  box-shadow: var(--shadow);
  z-index: 9999;
  opacity: 0; transform: translateX(20px);
  transition: all 0.25s;
  pointer-events: none;
}
.toast.show { opacity: 1; transform: translateX(0); }
.toast.success { border-left-color: var(--success); }
.toast.error   { border-left-color: var(--danger); }

/* ---- Footer ---- */
.page-footer {
  text-align: center;
  padding: 18px 28px;
  font-size: 12px;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
  background: var(--bg-secondary);
}
.page-footer a { color: var(--accent); }

/* ---- Responsive ---- */
@media (max-width: 1024px) {
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); transition: transform 0.25s; }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; }
  .page-body { padding: 18px; }
  .form-row { grid-template-columns: 1fr; }
  .stat-grid { grid-template-columns: 1fr 1fr; }
  .topbar { padding: 12px 18px; }
  .topbar-search { display: none; }
}
@media (max-width: 480px) {
  .stat-grid { grid-template-columns: 1fr; }
}
