/* IT-RANKS DMP Design System */

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

:root {
  /* Brand colors — light mode (IT-RANKS light sections inspired) */
  --ink: #f5f8fc;          /* page background */
  --ink-2: #ffffff;        /* topbar / sidebar surface */
  --ink-3: #eef2f7;        /* code blocks, inset surfaces */
  --surface: #ffffff;      /* cards */
  --surface-2: #f0f4f8;    /* hover row, secondary surface */
  --border: #e1e8f0;
  --border-strong: #cbd5e1;

  /* Accent — kept identical so brand colour reads through */
  --blue: #3b82f6;
  --blue-2: #2563eb;
  --blue-3: #1d4ed8;
  --blue-soft: rgba(59, 130, 246, 0.10);
  --blue-border: rgba(59, 130, 246, 0.30);

  /* Semantic */
  --success: #059669;
  --warning: #d97706;
  --danger: #dc2626;
  --info: #2563eb;

  /* Text — dark on light */
  --text: #0f172a;
  --text-2: #334155;
  --text-3: #64748b;
  --text-4: #94a3b8;

  /* Dark accents (still used for banners) */
  --dark-bg: #070c14;
  --dark-surface: #0d1421;
  --dark-border: #2a3350;
  --dark-text: #ffffff;
  --dark-text-2: #b8c1d4;
  --dark-text-3: #6b7693;

  /* Type */
  --font-display: 'Barlow', system-ui, sans-serif;
  --font-body: 'Inter', system-ui, sans-serif;

  /* Layout */
  --radius-sm: 4px;
  --radius: 6px;
  --radius-lg: 10px;
  --radius-xl: 16px;

  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
  --shadow: 0 4px 16px rgba(15, 23, 42, 0.06);
  --shadow-lg: 0 10px 40px rgba(15, 23, 42, 0.08);
  --shadow-blue: 0 0 0 3px rgba(59, 130, 246, 0.18);

  --transition: 200ms cubic-bezier(.4,0,.2,1);
}

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

html, body {
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  background: var(--ink);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, select, textarea { font-family: inherit; }

/* Eyebrow label — IT-RANKS signature pattern */
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 2.5px;
  text-transform: uppercase;
  color: var(--blue);
}
.eyebrow::before {
  content: '';
  width: 24px;
  height: 1px;
  background: var(--blue);
}

/* Display headline */
.h-display {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 48px;
  line-height: 1.05;
  letter-spacing: -0.02em;
}
.h-1 { font-family: var(--font-display); font-weight: 700; font-size: 32px; line-height: 1.15; letter-spacing: -0.01em; }
.h-2 { font-family: var(--font-display); font-weight: 700; font-size: 24px; line-height: 1.2; }
.h-3 { font-family: var(--font-display); font-weight: 600; font-size: 18px; line-height: 1.3; }
.h-4 { font-family: var(--font-display); font-weight: 600; font-size: 15px; line-height: 1.3; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 13px;
  letter-spacing: 0.3px;
  border-radius: var(--radius);
  transition: all var(--transition);
  white-space: nowrap;
}
.btn-primary {
  background: var(--blue);
  color: #fff;
}
.btn-primary:hover { background: var(--blue-3); transform: translateY(-1px); }
.btn-secondary {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border-strong);
}
.btn-secondary:hover { background: var(--surface); border-color: var(--blue); }
.btn-ghost {
  background: transparent;
  color: var(--text-2);
}
.btn-ghost:hover { background: var(--surface); color: var(--text); }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-icon { padding: 8px; }

/* Cards */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  transition: border-color var(--transition);
}
.card-light {
  background: var(--light-surface);
  border: 1px solid var(--light-border);
  color: var(--light-text);
}

/* Badges & pills */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  font-size: 11px;
  font-weight: 500;
  border-radius: 999px;
  font-family: var(--font-body);
}
.badge-blue { background: var(--blue-soft); color: var(--blue-2); border: 1px solid var(--blue-border); }
.badge-success { background: rgba(5, 150, 105, 0.10); color: #047857; border: 1px solid rgba(5, 150, 105, 0.25); }
.badge-warning { background: rgba(217, 119, 6, 0.10); color: #b45309; border: 1px solid rgba(217, 119, 6, 0.25); }
.badge-danger { background: rgba(220, 38, 38, 0.10); color: #b91c1c; border: 1px solid rgba(220, 38, 38, 0.25); }
.badge-neutral { background: var(--surface-2); color: var(--text-2); border: 1px solid var(--border); }

/* Status dot */
.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}
.status-dot-green { background: var(--success); box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.18); animation: pulse-soft 2s ease-in-out infinite; }
.status-dot-amber { background: var(--warning); box-shadow: 0 0 0 3px rgba(217, 119, 6, 0.18); }
.status-dot-red { background: var(--danger); box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.18); }

@keyframes pulse-soft { 0%,100%{opacity:1} 50%{opacity:.5} }

/* Forms */
.form-group { margin-bottom: 16px; }
.form-label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-2);
  margin-bottom: 6px;
  font-family: var(--font-display);
  letter-spacing: 0.3px;
}
.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 10px 14px;
  background: var(--ink-3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 14px;
  transition: all var(--transition);
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: var(--shadow-blue);
}
.form-input::placeholder { color: var(--text-4); }

/* Tables */
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.table th {
  text-align: left;
  font-weight: 500;
  color: var(--text-3);
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  font-family: var(--font-display);
  letter-spacing: 0.3px;
  font-size: 11px;
  text-transform: uppercase;
}
.table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--text-2);
}
.table tbody tr:hover { background: var(--surface-2); }
.table tbody tr:hover td { color: var(--text); }

/* Top bar — global header for all portals */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
  padding: 0 24px;
  background: var(--ink-2);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}
.topbar-brand { display: flex; align-items: center; gap: 12px; }
.topbar-logo {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  background: linear-gradient(135deg, var(--blue), #6366f1);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 13px;
  color: #fff;
}
.topbar-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 14px;
  color: var(--text);
}
.topbar-portal {
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 500;
  color: var(--text-3);
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-left: 6px;
  padding-left: 12px;
  border-left: 1px solid var(--border);
}
.topbar-actions { display: flex; align-items: center; gap: 12px; }
.topbar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 10px 4px 4px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  cursor: pointer;
  transition: all var(--transition);
}
.topbar-user:hover { border-color: var(--blue); }
.avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--blue), #8b5cf6);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 11px;
  color: #fff;
  flex-shrink: 0;
}
.avatar-lg { width: 40px; height: 40px; font-size: 14px; }
.avatar-sm { width: 22px; height: 22px; font-size: 10px; }

/* Sidebar */
.sidebar {
  background: var(--ink-2);
  border-right: 1px solid var(--border);
  padding: 16px 0;
  overflow-y: auto;
}
.sidebar-section { margin-bottom: 20px; }
.sidebar-title {
  font-family: var(--font-display);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--text-3);
  padding: 0 20px;
  margin-bottom: 6px;
}
.sidebar-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 20px;
  font-size: 13px;
  color: var(--text-2);
  cursor: pointer;
  border-left: 2px solid transparent;
  transition: all var(--transition);
}
.sidebar-item:hover { background: var(--surface-2); color: var(--text); }
.sidebar-item.active {
  background: var(--blue-soft);
  color: var(--blue-2);
  border-left-color: var(--blue);
}
.sidebar-item svg { width: 16px; height: 16px; flex-shrink: 0; opacity: 0.8; }
.sidebar-item.active svg { opacity: 1; color: var(--blue); }
.sidebar-count {
  margin-left: auto;
  font-size: 10px;
  color: var(--text-3);
  background: var(--ink-3);
  padding: 1px 7px;
  border-radius: 10px;
  font-variant-numeric: tabular-nums;
}

/* Page layout */
.page {
  padding: 24px 32px;
  max-width: 1400px;
  margin: 0 auto;
}
.page-header {
  margin-bottom: 24px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}
.page-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 26px;
  color: var(--text);
  margin-bottom: 4px;
}
.page-sub {
  color: var(--text-3);
  font-size: 14px;
}

/* Stat cards (KPI) */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}
.kpi {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
}
.kpi-label {
  font-size: 11px;
  font-family: var(--font-display);
  font-weight: 500;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--text-3);
  margin-bottom: 6px;
}
.kpi-value {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 26px;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  margin-bottom: 4px;
}
.kpi-trend { font-size: 11px; color: var(--success); }
.kpi-trend.down { color: var(--danger); }

/* Tabs */
.tabs {
  display: flex;
  gap: 2px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
}
.tab {
  padding: 10px 16px;
  font-size: 13px;
  font-family: var(--font-display);
  font-weight: 500;
  color: var(--text-3);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: all var(--transition);
}
.tab:hover { color: var(--text-2); }
.tab.active { color: var(--text); border-bottom-color: var(--blue); }

/* Utility */
.flex { display: flex; }
.flex-col { display: flex; flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; } .gap-3 { gap: 12px; } .gap-4 { gap: 16px; } .gap-6 { gap: 24px; }
.mt-2 { margin-top: 8px; } .mt-4 { margin-top: 16px; } .mt-6 { margin-top: 24px; }
.mb-2 { margin-bottom: 8px; } .mb-4 { margin-bottom: 16px; } .mb-6 { margin-bottom: 24px; }
.text-sm { font-size: 12px; } .text-xs { font-size: 11px; }
.text-muted { color: var(--text-3); }
.font-mono { font-family: 'SF Mono', Monaco, Consolas, monospace; }
.w-full { width: 100%; }

/* Scrollbars */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--ink); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-strong); }

/* User menu dropdown buttons (rendered in session.js) */
#dmp-user-menu button:hover { background: var(--surface-2); }
#dmp-user-menu button[onclick*="logout"]:hover { background: rgba(220, 38, 38, 0.08); }
