/* ============================================================
   INVESTOR PRO CRM — GLOBAL DESIGN SYSTEM
   Premium light theme · Inter font · Consistent across modules
   ============================================================ */

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

/* ── Design Tokens ── */
:root {
  --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

  /* Colors — Light Premium */
  --bg-primary: #f8f9fb;
  --bg-white: #ffffff;
  --bg-surface: #ffffff;
  --bg-surface-hover: #f1f3f5;
  --bg-nav: #ffffff;

  /* Text */
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  --text-inverse: #ffffff;

  /* Brand */
  --brand-primary: #2563eb;
  --brand-primary-hover: #1d4ed8;
  --brand-primary-light: rgba(37, 99, 235, 0.08);
  --brand-gradient: linear-gradient(135deg, #2563eb 0%, #7c3aed 100%);

  /* Accent */
  --accent-green: #10b981;
  --accent-green-light: rgba(16, 185, 129, 0.08);
  --accent-orange: #f59e0b;
  --accent-orange-light: rgba(245, 158, 11, 0.08);
  --accent-red: #ef4444;
  --accent-red-light: rgba(239, 68, 68, 0.08);
  --accent-purple: #8b5cf6;
  --accent-purple-light: rgba(139, 92, 246, 0.08);
  --accent-linkedin: #0077b5;

  /* Borders & Shadows */
  --border-color: #e2e8f0;
  --border-light: #f1f5f9;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.06);
  --shadow-lg: 0 8px 30px rgba(0,0,0,0.08);
  --shadow-xl: 0 20px 60px rgba(0,0,0,0.1);
  --shadow-card: 0 1px 3px rgba(0,0,0,0.04), 0 0 0 1px rgba(0,0,0,0.02);

  /* Radius */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;
  --radius-full: 9999px;

  /* Transitions */
  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 250ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-spring: 400ms cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

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

html {
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  scroll-behavior: smooth;
  overflow-x: hidden;
}

body {
  font-family: var(--font-family);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
  width: 100%;
}

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

/* ── Global Navigation Bar ── */
.nav-global {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255,255,255,0.85);
  backdrop-filter: blur(16px) saturate(180%);
  -webkit-backdrop-filter: blur(16px) saturate(180%);
  border-bottom: 1px solid var(--border-color);
  padding: 0 32px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 1.15rem;
  color: var(--text-primary);
  text-decoration: none;
  letter-spacing: -0.5px;
}

.nav-brand .logo-icon {
  width: 32px;
  height: 32px;
  background: var(--brand-gradient);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 1rem;
  font-weight: 900;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 4px;
  list-style: none;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 4px; /* for scrollbar spacing */
}

/* Hide scrollbar for nav-links on mobile */
.nav-links::-webkit-scrollbar {
  display: none;
}
.nav-links {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

.nav-links a {
  padding: 8px 16px;
  border-radius: var(--radius-full);
  font-size: 0.87rem;
  font-weight: 500;
  color: var(--text-secondary);
  text-decoration: none;
  transition: all var(--transition-fast);
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.nav-links a:hover {
  background: var(--bg-surface-hover);
  color: var(--text-primary);
}

.nav-links a.active {
  background: var(--brand-primary-light);
  color: var(--brand-primary);
  font-weight: 600;
}

.nav-links .material-icons-round {
  font-size: 18px;
}

.nav-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.nav-meta .status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent-green);
  display: inline-block;
  animation: pulse-dot 2s infinite;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(1.3); }
}

/* ── Page Layout ── */
.page-wrapper {
  max-width: 1440px;
  margin: 0 auto;
  padding: 32px 40px;
}

.page-header {
  margin-bottom: 32px;
}

.page-header h1 {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.5px;
  margin-bottom: 4px;
}

.page-header p {
  color: var(--text-secondary);
  font-size: 0.93rem;
}

/* ── Cards ── */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  transition: all var(--transition-normal);
  overflow: hidden;
}

.card:hover {
  box-shadow: var(--shadow-md);
  border-color: #cbd5e1;
}

.card-link {
  display: block;
  padding: 28px;
  text-decoration: none;
  color: inherit;
  height: 100%;
}

.card-link:hover { color: inherit; }

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.87rem;
  border: none;
  cursor: pointer;
  transition: all var(--transition-fast);
  font-family: var(--font-family);
  line-height: 1;
}

.btn-primary {
  background: var(--brand-primary);
  color: white;
}
.btn-primary:hover {
  background: var(--brand-primary-hover);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
  transform: translateY(-1px);
}

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

.btn-success {
  background: var(--accent-green);
  color: white;
}
.btn-success:hover {
  filter: brightness(1.1);
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.btn-linkedin {
  background: var(--accent-linkedin);
  color: white;
  font-size: 0.78rem;
  padding: 5px 10px;
  border-radius: 4px;
}
.btn-linkedin:hover { background: #005a8c; }

.btn-sm {
  padding: 6px 12px;
  font-size: 0.8rem;
}

.btn-lg {
  padding: 14px 28px;
  font-size: 1rem;
  border-radius: var(--radius-md);
}

/* ── Tags & Badges ── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.badge-blue { background: var(--brand-primary-light); color: var(--brand-primary); }
.badge-green { background: var(--accent-green-light); color: var(--accent-green); }
.badge-orange { background: var(--accent-orange-light); color: var(--accent-orange); }
.badge-purple { background: var(--accent-purple-light); color: var(--accent-purple); }
.badge-red { background: var(--accent-red-light); color: var(--accent-red); }

/* ── Tables ── */
.table-container {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-card);
  width: 100%;
}

.table-scroll {
  overflow-x: auto;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  max-height: 72vh;
  width: 100%;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.87rem;
}

thead th {
  background: var(--bg-primary);
  padding: 12px 18px;
  text-align: left;
  font-weight: 600;
  font-size: 0.73rem;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 10;
  white-space: nowrap;
}

tbody td {
  padding: 12px 18px;
  border-bottom: 1px solid var(--border-light);
  color: var(--text-secondary);
  white-space: nowrap;
}

tbody tr {
  transition: background var(--transition-fast);
}

tbody tr:hover td {
  background: var(--brand-primary-light);
}

tbody tr:last-child td {
  border-bottom: none;
}

/* ── Search Input ── */
.search-wrapper {
  position: relative;
  margin-bottom: 20px;
}

.search-wrapper .material-icons-round {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 20px;
}

.search-input {
  width: 100%;
  padding: 12px 18px 12px 44px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  font-family: var(--font-family);
  font-size: 0.9rem;
  color: var(--text-primary);
  background: var(--bg-surface);
  transition: all var(--transition-fast);
  outline: none;
}

.search-input:focus {
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 3px var(--brand-primary-light);
}

.search-input::placeholder {
  color: var(--text-muted);
}

/* ── Stat Cards ── */
.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

.stat-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 20px;
  box-shadow: var(--shadow-card);
}

.stat-card .stat-label {
  font-size: 0.73rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  font-weight: 600;
  margin-bottom: 6px;
}

.stat-card .stat-value {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.5px;
}

.stat-card .stat-change {
  font-size: 0.78rem;
  margin-top: 4px;
  display: flex;
  align-items: center;
  gap: 3px;
}

.stat-card .stat-change.positive { color: var(--accent-green); }
.stat-card .stat-change.negative { color: var(--accent-red); }

/* ── Tabs ── */
.tabs {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 2px;
  margin-bottom: 24px;
  border-bottom: 1px solid var(--border-color);
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar {
  display: none;
}

.tab-item {
  padding: 10px 18px;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary);
  text-decoration: none;
  border-bottom: 2px solid transparent;
  transition: all var(--transition-fast);
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 6px;
}

.tab-item:hover {
  color: var(--text-primary);
}

.tab-item.active {
  color: var(--brand-primary);
  border-bottom-color: var(--brand-primary);
  font-weight: 600;
}

.tab-item .tab-count {
  background: var(--bg-primary);
  padding: 2px 7px;
  border-radius: var(--radius-full);
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-muted);
}

.tab-item.active .tab-count {
  background: var(--brand-primary-light);
  color: var(--brand-primary);
}

/* ── Alert / Tip Box ── */
.alert-box {
  padding: 14px 18px;
  border-radius: var(--radius-md);
  font-size: 0.87rem;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 24px;
}

.alert-box.info {
  background: var(--brand-primary-light);
  border: 1px solid rgba(37, 99, 235, 0.15);
  color: var(--brand-primary);
}

.alert-box.success {
  background: var(--accent-green-light);
  border: 1px solid rgba(16, 185, 129, 0.15);
  color: #047857;
}

.alert-box.warning {
  background: var(--accent-orange-light);
  border: 1px solid rgba(245, 158, 11, 0.15);
  color: #b45309;
}

/* ── Empty State ── */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

.empty-state .empty-icon {
  font-size: 3rem;
  margin-bottom: 16px;
  opacity: 0.4;
}

.empty-state h3 {
  font-weight: 700;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.empty-state p {
  max-width: 400px;
  margin: 0 auto;
}

/* ── Loading Spinner ── */
.spinner {
  width: 20px;
  height: 20px;
  border: 2.5px solid rgba(0,0,0,0.1);
  border-top-color: var(--brand-primary);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  display: inline-block;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ── Fade-in Animation ── */
.fade-in {
  animation: fadeIn 0.4s ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ── Responsive ── */
@media (max-width: 768px) {
  .nav-global { padding: 0 16px; height: auto; flex-direction: column; align-items: stretch; gap: 10px; padding-top: 12px; }
  .nav-brand { justify-content: space-between; }
  .nav-meta { display: none; }
  
  .page-wrapper { padding: 12px; }
  .page-header h1 { font-size: 1.4rem; }
  
  .stats-row { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .stat-card { padding: 16px; min-width: 0; }
  .stat-card .stat-value { font-size: 1.3rem; }
  
  .header-actions { flex-wrap: wrap; margin-top: 10px; }
  
  /* Tables horizontally scrollable but cells shouldn't be too small */
  tbody td { padding: 12px; font-size: 0.85rem; }
  thead th { padding: 12px; font-size: 0.75rem; }
  
  /* Remove sticky columns on mobile to fix touch-drag scrolling */
  th:first-child, td:first-child { position: static !important; }
}

@media (max-width: 480px) {
  .nav-global { padding-top: 8px; }
  .nav-brand { margin-bottom: 4px; }
  .nav-links { justify-content: flex-start; }
  .nav-links a span { display: none; } /* hide text, show only icons if tight */
  .nav-links a { padding: 8px 12px; }
  
  .stats-row { grid-template-columns: 1fr; }
  .stat-card { padding: 14px; display: flex; justify-content: space-between; align-items: center; }
  .stat-card .stat-label { margin-bottom: 0; }
  .stat-card .stat-value { font-size: 1.2rem; }
  
  .page-header h1 { font-size: 1.25rem; }
  
  .header-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
  .header-actions .btn { flex-grow: 1; justify-content: center; width: 100%; }
}



/* ── Scrollbar ── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }
