/* ============================================================
   Provider Dashboard — Scoped Styles
   Does NOT affect public-facing site styles
   @package ComputeStacker
   ============================================================ */

:root {
  --csd-sidebar-w: 240px;
  --csd-blue:   #2563eb;
  --csd-green:  #16a34a;
  --csd-purple: #7c3aed;
  --csd-orange: #ea580c;
  --csd-yellow: #ca8a04;
  --csd-teal:   #0d9488;
  --csd-red:    #dc2626;
  --csd-bg:     #f8fafc;
  --csd-card:   #ffffff;
  --csd-border: #e2e8f0;
  --csd-text:   #0f172a;
  --csd-muted:  #64748b;
  --csd-radius: 12px;
  --csd-shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.06);
  --csd-shadow-md: 0 4px 16px rgba(0,0,0,0.1);
}

.cs-dashboard-body {
  margin:0; padding:0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--csd-bg);
  color: var(--csd-text);
  -webkit-font-smoothing: antialiased;
}

/* ── LAYOUT ── */
.csd-layout {
  display: flex;
  min-height: 100vh;
}

/* ── SIDEBAR ── */
.csd-sidebar {
  width: var(--csd-sidebar-w);
  background: #0f172a;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  z-index: 100;
}

.csd-sidebar-logo {
  padding: 22px 20px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.csd-sidebar-logo a {
  display: flex; align-items: center; gap: 10px; text-decoration: none;
}
.csd-logo-mark {
  width: 30px; height: 30px;
  background: linear-gradient(135deg, var(--csd-blue), var(--csd-purple));
  border-radius: 7px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.csd-logo-text {
  font-size: 16px; font-weight: 800; color: #fff; letter-spacing: -0.4px;
}
.csd-logo-text em { font-style: normal; color: #60a5fa; }

.csd-provider-chip {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.csd-chip-logo {
  width: 36px; height: 36px; border-radius: 8px; object-fit: contain;
  background: rgba(255,255,255,0.1);
}
.csd-chip-logo-placeholder {
  background: linear-gradient(135deg, var(--csd-blue), var(--csd-purple));
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; color: #fff;
  flex-shrink: 0;
}
.csd-chip-name { font-size: 13px; font-weight: 600; color: #f1f5f9; line-height: 1.3; }
.csd-chip-role { font-size: 11px; color: #64748b; margin-top: 2px; }

.csd-nav { flex: 1; padding: 12px 10px; }
.csd-nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 14px; font-weight: 500; color: #94a3b8;
  text-decoration: none;
  margin-bottom: 2px;
  transition: all 0.15s;
  position: relative;
}
.csd-nav-item svg { flex-shrink: 0; }
.csd-nav-item:hover { background: rgba(255,255,255,0.06); color: #e2e8f0; }
.csd-nav-item.active { background: rgba(37,99,235,0.2); color: #60a5fa; }
.csd-nav-item.active svg { color: #60a5fa; }

.csd-badge {
  background: var(--csd-red); color: #fff;
  font-size: 10px; font-weight: 700;
  padding: 2px 6px; border-radius: 99px;
  margin-left: auto; min-width: 18px; text-align: center;
}
.csd-badge-grey { background: #475569; }

.csd-sidebar-footer {
  padding: 12px 10px 20px;
  border-top: 1px solid rgba(255,255,255,0.06);
  display: flex; flex-direction: column; gap: 4px;
}
.csd-preview-btn, .csd-logout-btn {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 12px; border-radius: 8px;
  font-size: 13px; font-weight: 500; text-decoration: none;
  transition: background 0.15s;
}
.csd-preview-btn { color: #60a5fa; }
.csd-preview-btn:hover { background: rgba(96,165,250,0.1); }
.csd-logout-btn { color: #94a3b8; }
.csd-logout-btn:hover { background: rgba(255,255,255,0.05); color: #e2e8f0; }

/* ── MAIN ── */
.csd-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

/* ── TOP BAR ── */
.csd-topbar {
  background: var(--csd-card);
  border-bottom: 1px solid var(--csd-border);
  padding: 0 28px;
  height: 62px;
  display: flex; align-items: center; gap: 16px;
  position: sticky; top: 0; z-index: 50;
}
.csd-hamburger {
  display: none; background: none; border: none;
  cursor: pointer; color: var(--csd-text); padding: 6px;
  border-radius: 6px;
}
.csd-topbar-title { font-size: 16px; font-weight: 700; color: var(--csd-text); flex: 1; }
.csd-topbar-user { display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--csd-muted); }
.csd-user-avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: linear-gradient(135deg, var(--csd-blue), var(--csd-purple));
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; color: #fff;
}

/* ── CONTENT ── */
.csd-content { padding: 28px; flex: 1; }

.csd-tab-panel { display: none; }
.csd-tab-panel.active { display: block; animation: csd-fade-in 0.25s ease; }
@keyframes csd-fade-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }

.csd-section-header { margin-bottom: 24px; }
.csd-section-header h2 { font-size: 22px; font-weight: 800; margin: 0 0 6px; color: var(--csd-text); }
.csd-section-header p { font-size: 14px; color: var(--csd-muted); margin: 0; }

/* ── STAT CARDS ── */
.csd-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 16px;
}
.csd-stat-card {
  background: var(--csd-card);
  border: 1px solid var(--csd-border);
  border-radius: var(--csd-radius);
  padding: 20px;
  box-shadow: var(--csd-shadow);
  position: relative;
  overflow: hidden;
  transition: transform 0.15s, box-shadow 0.15s;
}
.csd-stat-card:hover { transform: translateY(-2px); box-shadow: var(--csd-shadow-md); }
.csd-stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  border-radius: 12px 12px 0 0;
}
.csd-stat-blue::before   { background: var(--csd-blue); }
.csd-stat-green::before  { background: var(--csd-green); }
.csd-stat-purple::before { background: var(--csd-purple); }
.csd-stat-orange::before { background: var(--csd-orange); }
.csd-stat-yellow::before { background: var(--csd-yellow); }
.csd-stat-teal::before   { background: var(--csd-teal); }

.csd-stat-icon { font-size: 24px; margin-bottom: 10px; }
.csd-stat-value { font-size: 28px; font-weight: 800; color: var(--csd-text); line-height: 1; }
.csd-stat-label { font-size: 12px; color: var(--csd-muted); font-weight: 600; margin-top: 4px; text-transform: uppercase; letter-spacing: 0.04em; }
.csd-stat-sub { font-size: 12px; color: #94a3b8; margin-top: 6px; }

/* ── GENERIC CARD ── */
.csd-card {
  background: var(--csd-card);
  border: 1px solid var(--csd-border);
  border-radius: var(--csd-radius);
  padding: 24px;
  box-shadow: var(--csd-shadow);
}
.csd-card h3 { font-size: 15px; font-weight: 700; margin: 0 0 16px; color: var(--csd-text); }

/* ── PROGRESS BAR ── */
.csd-progress-wrap { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.csd-progress-bar { flex: 1; height: 8px; background: #e2e8f0; border-radius: 99px; overflow: hidden; }
.csd-progress-fill { height: 100%; background: linear-gradient(90deg, var(--csd-blue), var(--csd-purple)); border-radius: 99px; transition: width 0.8s ease; }
.csd-progress-pct { font-size: 14px; font-weight: 700; color: var(--csd-blue); min-width: 40px; text-align: right; }
.csd-hint { font-size: 13px; color: var(--csd-muted); margin: 0; }
.csd-hint a { color: var(--csd-blue); text-decoration: none; font-weight: 500; }

/* ── LEADS ── */
.csd-subtabs { display: flex; gap: 4px; margin-bottom: 20px; background: var(--csd-bg); padding: 6px; border-radius: 10px; width: fit-content; }
.csd-subtab {
  padding: 8px 16px; border: none; border-radius: 8px;
  font-size: 14px; font-weight: 500; cursor: pointer;
  background: none; color: var(--csd-muted); transition: all 0.15s;
  display: flex; align-items: center; gap: 8px;
}
.csd-subtab.active { background: var(--csd-card); color: var(--csd-text); box-shadow: var(--csd-shadow); }

.csd-leads-toolbar { display: flex; gap: 12px; margin-bottom: 16px; align-items: center; flex-wrap: wrap; }
.csd-select {
  padding: 9px 12px; border: 1.5px solid var(--csd-border);
  border-radius: 8px; font-size: 13px; color: var(--csd-text);
  background: var(--csd-card); cursor: pointer; outline: none;
}
.csd-select:focus { border-color: var(--csd-blue); }

.csd-lead-card {
  background: var(--csd-card);
  border: 1px solid var(--csd-border);
  border-radius: 10px;
  padding: 16px 20px;
  margin-bottom: 10px;
  cursor: pointer;
  transition: all 0.15s;
  display: flex; align-items: center; gap: 16px;
}
.csd-lead-card:hover { border-color: var(--csd-blue); box-shadow: var(--csd-shadow-md); }
.csd-lead-avatar {
  width: 40px; height: 40px; border-radius: 50%;
  background: linear-gradient(135deg, var(--csd-blue), var(--csd-purple));
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; font-weight: 700; color: #fff; flex-shrink: 0;
}
.csd-lead-body { flex: 1; min-width: 0; }
.csd-lead-name { font-size: 14px; font-weight: 700; color: var(--csd-text); }
.csd-lead-sub { font-size: 12px; color: var(--csd-muted); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.csd-lead-meta { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.csd-lead-date { font-size: 12px; color: var(--csd-muted); }

/* Status Badges */
.csd-status {
  font-size: 11px; font-weight: 600; padding: 3px 9px;
  border-radius: 99px; text-transform: capitalize; letter-spacing: 0.03em;
}
.csd-status-new           { background: #dbeafe; color: #1d4ed8; }
.csd-status-contacted     { background: #d1fae5; color: #065f46; }
.csd-status-proposal_sent { background: #fef9c3; color: #854d0e; }
.csd-status-won           { background: #dcfce7; color: #14532d; }
.csd-status-lost          { background: #fee2e2; color: #991b1b; }

/* ── DRAWER ── */
.csd-drawer-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,0.4); z-index: 200; backdrop-filter: blur(2px);
}
.csd-drawer-overlay.open { display: block; }
.csd-drawer {
  position: fixed; right: -520px; top: 0; bottom: 0;
  width: 500px; background: var(--csd-card);
  box-shadow: -4px 0 30px rgba(0,0,0,0.15);
  z-index: 201; transition: right 0.3s ease;
  display: flex; flex-direction: column;
  overflow-y: auto;
}
.csd-drawer.open { right: 0; }
.csd-drawer-close {
  position: absolute; top: 16px; right: 20px;
  background: none; border: none;
  font-size: 24px; cursor: pointer; color: var(--csd-muted);
  width: 36px; height: 36px; display: flex; align-items: center; justify-content: center;
  border-radius: 8px; transition: background 0.15s;
}
.csd-drawer-close:hover { background: var(--csd-bg); }
.csd-drawer-content { padding: 28px; }

/* ── ANALYTICS ── */
.csd-analytics-controls { margin-bottom: 20px; }
.csd-charts-row {
  display: grid; grid-template-columns: 1fr;
  gap: 20px; margin-bottom: 20px;
}
.csd-charts-row-3 { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.csd-chart-card {
  background: var(--csd-card);
  border: 1px solid var(--csd-border);
  border-radius: var(--csd-radius);
  padding: 24px;
  box-shadow: var(--csd-shadow);
}
.csd-chart-card h4 { font-size: 14px; font-weight: 700; color: var(--csd-text); margin: 0 0 16px; }
.csd-cta-list { display: flex; flex-direction: column; gap: 10px; }
.csd-cta-row { display: flex; justify-content: space-between; align-items: center; }
.csd-cta-label { font-size: 13px; color: var(--csd-text); }
.csd-cta-bar-wrap { flex: 1; margin: 0 12px; height: 6px; background: #e2e8f0; border-radius: 3px; }
.csd-cta-bar-fill { height: 100%; background: var(--csd-blue); border-radius: 3px; }
.csd-cta-count { font-size: 13px; font-weight: 700; color: var(--csd-muted); min-width: 28px; text-align: right; }

/* ── LISTING FORM ── */
.csd-form-grid {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 20px;
  background: var(--csd-card);
  border: 1px solid var(--csd-border);
  border-radius: var(--csd-radius);
  padding: 28px;
  box-shadow: var(--csd-shadow);
}
.csd-form-section { grid-column: 1 / -1; }
.csd-form-section h3 { font-size: 15px; font-weight: 700; margin: 0 0 14px; }
.csd-logo-upload { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.csd-logo-preview {
  width: 80px; height: 50px;
  border: 1.5px dashed var(--csd-border);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}
.csd-logo-preview img { max-width: 100%; max-height: 100%; object-fit: contain; }
.csd-logo-preview span { font-size: 11px; color: var(--csd-muted); }

.csd-field { display: flex; flex-direction: column; gap: 6px; }
.csd-label { font-size: 13px; font-weight: 600; color: #374151; }
.csd-input {
  padding: 10px 14px; border: 1.5px solid var(--csd-border);
  border-radius: 8px; font-size: 14px; color: var(--csd-text);
  background: #f9fafb; transition: all 0.15s;
  font-family: inherit; outline: none; width: 100%;
  box-sizing: border-box;
}
.csd-input:focus { border-color: var(--csd-blue); background: #fff; box-shadow: 0 0 0 3px rgba(37,99,235,0.08); }
.csd-textarea { resize: vertical; min-height: 100px; }
.csd-form-actions {
  display: flex; align-items: center; gap: 14px;
  margin-top: 20px; flex-wrap: wrap;
}
.csd-save-feedback { font-size: 14px; color: var(--csd-green); font-weight: 500; }

/* ── BUTTONS ── */
.csd-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 10px 18px; border-radius: 8px;
  font-size: 14px; font-weight: 600; cursor: pointer;
  border: 1.5px solid transparent; text-decoration: none;
  transition: all 0.15s; white-space: nowrap;
}
.csd-btn-primary { background: var(--csd-blue); color: #fff; border-color: var(--csd-blue); }
.csd-btn-primary:hover { background: #1d4ed8; }
.csd-btn-secondary { background: var(--csd-card); color: var(--csd-text); border-color: var(--csd-border); }
.csd-btn-secondary:hover { border-color: #94a3b8; }

/* ── SETTINGS ── */
.csd-info-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 0; border-bottom: 1px solid var(--csd-bg);
  font-size: 14px;
}
.csd-info-row span { color: var(--csd-muted); }

/* ── UTILITIES ── */
.csd-loading { text-align: center; padding: 40px; color: var(--csd-muted); font-size: 14px; }
.csd-empty   { text-align: center; padding: 40px; color: var(--csd-muted); font-size: 14px; }
.csd-link    { font-size: 14px; color: var(--csd-blue); text-decoration: none; font-weight: 500; }
.csd-link:hover { text-decoration: underline; }

/* ── RESPONSIVE ── */
@media (max-width: 900px) {
  .csd-sidebar {
    position: fixed; left: -260px; transition: left 0.3s;
    box-shadow: none;
  }
  .csd-sidebar.open { left: 0; box-shadow: 4px 0 30px rgba(0,0,0,0.3); }
  .csd-hamburger { display: flex; }
  .csd-content { padding: 20px 16px; }
  .csd-topbar { padding: 0 16px; }
  .csd-form-grid { grid-template-columns: 1fr; }
  .csd-field[style*="grid-column"] { grid-column: 1; }
}
@media (max-width: 600px) {
  .csd-stats-grid { grid-template-columns: 1fr 1fr; }
  .csd-drawer { width: 95vw; }
}
