/* =============================================================================
   Xirql — common.css
   Brand palette: deep indigo #1E2D8E → purple #6B35A0 → magenta #BE1060
   ========================================================================== */
:root {
  /* ── Brand gradient stops ─────────────────────────────────────────────── */
  --brand-indigo:   #1E2D8E;
  --brand-purple:   #6B35A0;
  --brand-magenta:  #BE1060;
  --gradient-brand: linear-gradient(135deg, #1E2D8E 0%, #6B35A0 50%, #BE1060 100%);

  /* ── Primary action (magenta) ──────────────────────────────────────────── */
  --color-primary:        #BE1060;
  --color-primary-hover:  #A50E52;
  --color-primary-light:  rgba(190, 16, 96, 0.09);
  --color-primary-ring:   rgba(190, 16, 96, 0.22);

  /* ── Background & surfaces ─────────────────────────────────────────────── */
  --color-bg:       #F7F6FB;   /* very slight lavender tint */
  --color-surface:  #FFFFFF;

  /* ── Text ───────────────────────────────────────────────────────────────── */
  --color-brand:      #1E2D8E;   /* indigo — used for brand text / headings */
  --color-text:       #16142A;   /* near-black with purple undertone */
  --color-text-muted: #6B7080;

  /* ── Border ─────────────────────────────────────────────────────────────── */
  --color-border: #E3DFF0;    /* slightly purple-tinted */

  /* ── Semantic ───────────────────────────────────────────────────────────── */
  --color-success: #16a34a;
  --color-warning: #d97706;
  --color-danger:  #dc2626;
  --color-info:    #1E2D8E;   /* brand indigo */

  /* ── Radius ─────────────────────────────────────────────────────────────── */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;

  /* ── Spacing ─────────────────────────────────────────────────────────────── */
  --space-xs: 8px;
  --space-sm: 12px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;

  /* ── Shadows (brand-tinted) ──────────────────────────────────────────────── */
  --shadow-sm: 0 1px 3px rgba(30, 45, 142, 0.07);
  --shadow-md: 0 4px 16px rgba(30, 45, 142, 0.10);
}

* { box-sizing: border-box; }

/* Ensure [hidden] always wins over any display rule */
[hidden] { display: none !important; }

html, body { margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica,
    Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji';
  font-size: 14px;
  line-height: 1.5;
  color: var(--color-text);
  background: var(--color-bg);
}

h1 { font-size: 24px; font-weight: 700; margin: 0 0 var(--space-xs); color: var(--color-text); }
h2 { font-size: 20px; font-weight: 700; margin: 0 0 var(--space-xs); }
h3 { font-size: 18px; font-weight: 600; margin: 0 0 var(--space-xs); }
h4 { font-size: 16px; font-weight: 600; margin: 0 0 var(--space-xs); }

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

.text-muted { font-size: 13px; color: var(--color-text-muted); }

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0);
  white-space: nowrap; border: 0;
}

/* --- Layout ---------------------------------------------------------------- */
.page-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: var(--space-lg);
}

.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-lg);
  box-shadow: var(--shadow-sm);
}

/* --- Buttons --------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-xs);
  min-height: 44px;
  padding: 0 var(--space-md);
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
  background: transparent;
}
.btn:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}
.btn:disabled { opacity: 0.55; cursor: not-allowed; }

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

.btn-gradient {
  background: var(--gradient-brand);
  color: #fff;
  border: none;
}
.btn-gradient:hover { opacity: 0.9; }

.btn-secondary {
  background: var(--color-surface);
  color: var(--color-text);
  border-color: var(--color-border);
}
.btn-secondary:hover { background: var(--color-bg); }

.btn-danger { background: var(--color-danger); color: #fff; }
.btn-block { width: 100%; }

/* --- Forms ----------------------------------------------------------------- */
.form-group { margin-bottom: var(--space-md); }
.form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: var(--space-xs);
  color: var(--color-text);
}
.form-input,
.form-select,
.form-textarea {
  width: 100%;
  min-height: 44px;
  padding: 0 var(--space-sm);
  font-size: 14px;
  color: var(--color-text);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.form-textarea { min-height: 120px; padding: var(--space-sm); resize: vertical; }
.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-primary-ring);
}

/* --- Badges / pills -------------------------------------------------------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}
.badge-success { background: rgba(22, 163, 74, 0.10); color: var(--color-success); }
.badge-danger  { background: rgba(220, 38, 38, 0.10); color: var(--color-danger); }
.badge-muted   { background: var(--color-bg); color: var(--color-text-muted); }
.badge-brand   { background: var(--color-primary-light); color: var(--color-primary); }

/* --- Top nav --------------------------------------------------------------- */
.top-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
  padding: 0 var(--space-lg);
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: var(--shadow-sm);
}
.top-nav-left  { display: flex; align-items: center; gap: var(--space-lg); }
.brand-lockup  { display: flex; align-items: center; gap: 10px; text-decoration: none; cursor: default; pointer-events: none; }
.brand-logo    { width: 32px; height: 32px; border-radius: 8px; display: block; flex-shrink: 0; }

.brand-name {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.3px;
  color: var(--brand-magenta);
}
.brand-subtitle { font-size: 12px; color: var(--color-text-muted); margin-left: 2px; }

.top-nav-links { display: flex; align-items: center; gap: 2px; }
.top-nav-link {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 0 var(--space-sm);
  border-radius: var(--radius-sm);
  color: var(--color-text-muted);
  font-weight: 600;
  font-size: 14px;
  text-decoration: none;
  transition: background 0.12s ease, color 0.12s ease;
}
.top-nav-link:hover {
  background: var(--color-primary-light);
  color: var(--color-primary);
  text-decoration: none;
}
.top-nav-link.--active,
.top-nav-link[aria-current='page'] {
  color: var(--color-primary);
  background: var(--color-primary-light);
}

.top-nav-right { display: flex; align-items: center; gap: var(--space-sm); }

.nav-conn-counter {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 600;
  color: var(--color-text-muted);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 20px;
  padding: 3px 10px 3px 8px;
  white-space: nowrap;
  cursor: default;
  user-select: none;
}

.nav-company-select {
  min-height: 36px;
  max-width: 180px;
  padding: 0 var(--space-sm);
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
}
.nav-company-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text-muted);
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-linkedin-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  padding: 0 var(--space-sm);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  color: var(--color-text);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.nav-linkedin-btn:disabled { opacity: 0.65; cursor: wait; }
.nav-linkedin-btn--connected {
  color: #15803d;
  border-color: #bbf7d0;
  background: #f0fdf4;
}
.nav-linkedin-btn--connected:hover { background: #dcfce7; }
.nav-linkedin-btn--disconnected {
  color: #be123c;
  border-color: #fecdd3;
  background: #fff1f2;
}
.nav-linkedin-btn--disconnected:hover { background: #ffe4e6; }
.nav-linkedin-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  color: #0A66C2;  /* LinkedIn blue */
}
.nav-linkedin-btn--connected .nav-linkedin-icon { color: #16a34a; }
.nav-linkedin-btn--disconnected .nav-linkedin-icon { color: #e11d48; }

.nav-icon-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px; height: 40px;
  border: 1px solid transparent;
  background: transparent;
  cursor: pointer;
  border-radius: var(--radius-sm);
  color: var(--color-text-muted);
  text-decoration: none;
  transition: background 0.15s ease, color 0.15s ease;
}
.nav-icon-btn:hover {
  background: var(--color-primary-light);
  color: var(--color-primary);
  text-decoration: none;
}
.nav-icon-btn.--has-notifications {
  background: rgba(190, 16, 96, 0.08);
  border-color: rgba(190, 16, 96, 0.25);
  color: var(--color-primary);
}
.nav-bell-icon { width: 20px; height: 20px; display: block; }
.notifications-dot {
  position: absolute;
  top: 9px; right: 9px;
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--color-primary);
  border: 1.5px solid var(--color-surface);
}

/* --- Dropdown -------------------------------------------------------------- */
.dropdown { position: relative; }
.dropdown-menu {
  position: absolute;
  right: 0; top: calc(100% + 6px);
  min-width: 200px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  padding: 6px;
  display: none;
}
.dropdown-menu.--open { display: block; }
.dropdown-item {
  display: block;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  color: var(--color-text);
  font-size: 14px;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.12s ease, color 0.12s ease;
}
.dropdown-item:hover {
  background: var(--color-primary-light);
  color: var(--color-primary);
  text-decoration: none;
}

/* Avatar button — gradient border ring */
.avatar-btn {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--gradient-brand);
  color: #fff;
  font-weight: 700;
  font-size: 14px;
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.15s ease;
}
.avatar-btn:hover { opacity: 0.85; }

/* --- Modal ----------------------------------------------------------------- */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(22, 20, 42, 0.50);
  display: flex; align-items: center; justify-content: center;
  z-index: 100; padding: var(--space-md);
}
.modal {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  width: 100%; max-width: 480px;
  box-shadow: 0 20px 60px rgba(30, 45, 142, 0.18);
  display: flex; flex-direction: column;
  max-height: 90vh;
}
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: var(--space-lg);
  border-bottom: 1px solid var(--color-border);
}
.modal-header h2, .modal-header h3 {
  margin: 0;
  background: var(--gradient-brand);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.modal-body   { padding: var(--space-lg); overflow-y: auto; }
.modal-footer {
  display: flex; justify-content: flex-end; gap: var(--space-sm);
  padding: var(--space-lg);
  border-top: 1px solid var(--color-border);
}
.modal-close {
  background: transparent; border: none; cursor: pointer;
  font-size: 20px; color: var(--color-text-muted); line-height: 1;
  transition: color 0.12s ease;
}
.modal-close:hover { color: var(--color-primary); }

/* --- Toast ----------------------------------------------------------------- */
.toast-container {
  position: fixed; top: var(--space-md); right: var(--space-md);
  display: flex; flex-direction: column; gap: var(--space-xs);
  z-index: 200;
}
.toast {
  min-width: 260px; max-width: 360px;
  padding: var(--space-sm) var(--space-md);
  background: var(--color-surface);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
  border-left: 4px solid var(--brand-indigo);
  font-size: 14px;
  animation: toast-in 0.18s ease;
}
.toast-success { border-left-color: var(--color-success); }
.toast-error   { border-left-color: var(--color-danger); }
.toast-info    { border-left-color: var(--brand-indigo); }
@keyframes toast-in {
  from { opacity: 0; transform: translateX(12px); }
  to   { opacity: 1; transform: none; }
}

/* --- Spinner --------------------------------------------------------------- */
.spinner {
  width: 20px; height: 20px;
  border: 2px solid var(--color-border);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: inline-block;
}
.modal-spinner-container {
  display: flex; align-items: center; justify-content: center;
  padding: var(--space-xl);
}
@keyframes spin { to { transform: rotate(360deg); } }

/* --- Empty state ----------------------------------------------------------- */
.funnel-empty {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: var(--space-sm);
  padding: var(--space-xl);
  color: var(--color-text-muted);
  text-align: center;
}
.funnel-empty .icon { font-size: 40px; opacity: 0.5; }

/* --- Grid utility ---------------------------------------------------------- */
.grid { display: grid; gap: var(--space-md); }
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: var(--space-md);
}

/* --- Section header row --------------------------------------------------- */
.section-header-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-md);
  margin-bottom: var(--space-md);
}

/* --- Horizontal carousel --------------------------------------------------- */
.carousel-wrap {
  position: relative;
  display: flex;
  align-items: stretch;
  gap: var(--space-sm);
}

.carousel-track {
  display: flex;
  gap: var(--space-md);
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  flex: 1;
  min-width: 0;
  padding: 4px 2px var(--space-sm);
}

.carousel-track::-webkit-scrollbar {
  display: none;
}

.carousel-nav {
  flex-shrink: 0;
  align-self: center;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  color: var(--color-text);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, opacity 0.15s ease;
}

.carousel-nav:hover:not(:disabled) {
  background: var(--color-bg);
  border-color: var(--color-primary);
  color: var(--color-primary);
}

.carousel-nav:disabled {
  opacity: 0.35;
  cursor: default;
}

.carousel-wrap:not(.has-carousel) .carousel-nav {
  display: none;
}

.carousel-track > .suggestion-card {
  flex: 0 0 min(300px, calc(100vw - 120px));
  scroll-snap-align: start;
}

.carousel-track .funnel-empty {
  flex: 1 1 100%;
  min-width: 100%;
}

/* --- Target suggestion cards (dashboard + pipeline) ------------------------ */
.suggestion-card {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 220px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-lg);
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.15s ease, border-color 0.15s ease;
}
.suggestion-card:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--color-primary);
}
.suggestion-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-xs);
  margin-bottom: 8px;
}
.suggestion-match-score {
  display: inline-flex;
  align-items: center;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
  padding: 3px 8px;
  border-radius: 999px;
}
.suggestion-match-score--high {
  background: #dcfce7;
  color: #15803d;
}
.suggestion-match-score--medium {
  background: #fef3c7;
  color: #b45309;
}
.suggestion-match-score--low {
  background: var(--color-bg);
  color: var(--color-text-muted);
}
.suggestion-dismiss {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  margin: -4px -4px 0 0;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--color-text-muted);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease;
}
.suggestion-dismiss:hover {
  background: #fee2e2;
  color: #dc2626;
}
.suggestion-card h4 {
  font-size: 14px;
  margin: 0 0 4px;
  color: var(--color-primary);
}
.suggestion-industry {
  font-size: 12px;
  color: var(--color-text-muted);
  margin-bottom: 8px;
}
.suggestion-rationale {
  font-size: 12px;
  color: var(--color-text);
  flex: 1;
  line-height: 1.5;
}
.suggestion-keywords {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 8px;
  flex-shrink: 0;
}
.suggestion-tag {
  background: var(--color-primary-light);
  color: var(--color-primary);
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
}
.suggestion-use-btn {
  margin-top: 10px;
  flex-shrink: 0;
  width: 100%;
}

/* --- Auth pages (login / register / forgot / reset) ----------------------- */
.auth-body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--gradient-brand);
  padding: var(--space-lg);
}
.auth-card {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
  width: 100%;
  max-width: 400px;
  box-shadow: 0 20px 60px rgba(30, 45, 142, 0.22);
}
.auth-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: var(--space-lg);
}
.auth-brand .brand-logo {
  width: 40px; height: 40px;
  border-radius: 10px;
}
.auth-brand .brand-name {
  font-size: 22px;
  font-weight: 800;
}
.auth-links {
  margin-top: var(--space-md);
  text-align: center;
  font-size: 13px;
  color: var(--color-text-muted);
}
.auth-links p { margin: var(--space-xs) 0 0; }
.auth-links a { color: var(--color-primary); font-weight: 600; }

/* Legacy aliases for pages still using login-body / login-card */
.login-body  { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--gradient-brand); padding: var(--space-lg); }
.login-card  { background: var(--color-surface); border-radius: var(--radius-lg); padding: var(--space-xl); width: 100%; max-width: 400px; box-shadow: 0 20px 60px rgba(30, 45, 142, 0.22); border: none; }
.login-brand { display: flex; align-items: center; gap: 10px; margin-bottom: var(--space-lg); }
.login-brand .brand-logo { width: 40px; height: 40px; border-radius: 10px; }
.login-brand .brand-name { font-size: 22px; font-weight: 800; }
