/* ==========================================================
   InnovGMaps Dashboard - Light Theme (shadcn blue)
   ========================================================== */

:root {
  /* Background - soft grays */
  --background: #ffffff;
  --background-secondary: #f8fafc;
  --background-muted: #f1f5f9;

  /* Text - softer than pure black */
  --foreground: #0f172a;
  --foreground-secondary: #475569;
  --foreground-muted: #64748b;
  --foreground-subtle: #94a3b8;

  /* Border */
  --border: #e2e8f0;
  --border-strong: #cbd5e1;

  /* Primary - Blue */
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-foreground: #ffffff;
  --primary-muted: #eff6ff;

  /* Secondary - Light gray */
  --secondary: #f1f5f9;
  --secondary-hover: #e2e8f0;
  --secondary-foreground: #475569;

  /* Success */
  --success: #16a34a;
  --success-muted: #f0fdf4;

  /* Warning */
  --warning: #d97706;
  --warning-muted: #fffbeb;

  /* Destructive */
  --destructive: #dc2626;
  --destructive-muted: #fef2f2;

  /* Ring */
  --ring: #2563eb;

  /* Radius */
  --radius: 0.5rem;

  /* Shadows */
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
}

/* ---------- Base ---------- */
* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Inter', Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  background: var(--background-secondary);
  color: var(--foreground);
  line-height: 1.5;
}

/* ---------- Scrollbar ---------- */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--background-muted);
}

::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--foreground-subtle);
}

/* ---------- Focus ---------- */
:focus {
  outline: none;
}

:focus-visible {
  outline: 2px solid var(--ring);
  outline-offset: 2px;
}

/* ---------- Selection ---------- */
::selection {
  background: var(--primary);
  color: var(--primary-foreground);
}

/* ---------- Typography ---------- */
h1, h2, h3, h4, h5, h6 {
  color: var(--foreground);
  font-weight: 600;
  letter-spacing: -0.025em;
}

p {
  color: var(--foreground-secondary);
}

a {
  color: var(--primary);
  text-decoration: none;
  transition: color 150ms;
}

a:hover {
  color: var(--primary-hover);
}

/* ---------- Header ---------- */
header {
  background: var(--background) !important;
  border-bottom: 1px solid var(--border) !important;
}

/* Logo icon */
header svg.text-blue-500 {
  color: var(--primary) !important;
}

/* ---------- Navigation ---------- */
nav a {
  color: var(--foreground-muted) !important;
  font-size: 0.875rem;
  font-weight: 500;
  transition: all 150ms;
}

nav a:hover {
  color: var(--foreground) !important;
  background: var(--background-muted) !important;
}

/* Active nav link - Blue */
nav a.bg-blue-600 {
  background: var(--primary) !important;
  color: var(--primary-foreground) !important;
  border-radius: var(--radius);
}

nav a.bg-blue-600:hover {
  background: var(--primary-hover) !important;
}

/* ---------- Cards ---------- */
.bg-dark-card {
  background: var(--background) !important;
  border: 1px solid var(--border) !important;
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

/* ---------- Buttons ---------- */
button {
  cursor: pointer;
  font-weight: 500;
  border-radius: var(--radius);
  transition: all 150ms;
}

/* Primary Button - Blue */
.bg-blue-600,
button.bg-blue-600 {
  background: var(--primary) !important;
  color: var(--primary-foreground) !important;
  border: none !important;
}

.bg-blue-600:hover,
button.bg-blue-600:hover {
  background: var(--primary-hover) !important;
}

/* Green Button */
.bg-green-600,
.bg-green-700,
button.bg-green-600,
button.bg-green-700 {
  background: #16a34a !important;
  color: white !important;
  border: none !important;
}

.bg-green-600:hover,
.bg-green-700:hover,
button.bg-green-600:hover,
button.bg-green-700:hover {
  background: #15803d !important;
}

/* Yellow/Amber Button */
.bg-yellow-600,
.bg-yellow-700,
button.bg-yellow-600,
button.bg-yellow-700 {
  background: #d97706 !important;
  color: white !important;
  border: none !important;
}

.bg-yellow-600:hover,
.bg-yellow-700:hover,
button.bg-yellow-600:hover,
button.bg-yellow-700:hover {
  background: #b45309 !important;
}

/* Red Button */
.bg-red-600,
.bg-red-700,
button.bg-red-600,
button.bg-red-700 {
  background: #dc2626 !important;
  color: white !important;
  border: none !important;
}

.bg-red-600:hover,
.bg-red-700:hover,
button.bg-red-600:hover,
button.bg-red-700:hover {
  background: #b91c1c !important;
}

/* Purple Button */
.bg-purple-600,
.bg-purple-700,
button.bg-purple-600,
button.bg-purple-700 {
  background: #9333ea !important;
  color: white !important;
  border: none !important;
}

.bg-purple-600:hover,
.bg-purple-700:hover,
button.bg-purple-600:hover,
button.bg-purple-700:hover {
  background: #7c3aed !important;
}

/* Orange Button */
.bg-orange-600,
.bg-orange-700,
button.bg-orange-600,
button.bg-orange-700 {
  background: #ea580c !important;
  color: white !important;
  border: none !important;
}

.bg-orange-600:hover,
.bg-orange-700:hover,
button.bg-orange-600:hover,
button.bg-orange-700:hover {
  background: #c2410c !important;
}

/* Secondary Button - Gray outline */
button.hover\:bg-dark-border,
.hover\:bg-dark-border {
  background: var(--background) !important;
  color: var(--foreground-secondary) !important;
  border: 1px solid var(--border) !important;
}

button.hover\:bg-dark-border:hover,
.hover\:bg-dark-border:hover {
  background: var(--background-muted) !important;
  border-color: var(--border-strong) !important;
}

button:disabled,
button[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ---------- Form Elements ---------- */
input[type="text"],
input[type="password"],
input[type="number"],
input[type="email"],
input[type="url"],
input[type="search"],
textarea,
select {
  background: var(--background) !important;
  border: 1px solid var(--border) !important;
  color: var(--foreground) !important;
  border-radius: var(--radius);
  font-size: 0.875rem;
  transition: border-color 150ms, box-shadow 150ms;
}

input::placeholder,
textarea::placeholder {
  color: var(--foreground-subtle) !important;
}

input:hover,
textarea:hover,
select:hover {
  border-color: var(--border-strong) !important;
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--primary) !important;
  box-shadow: 0 0 0 3px var(--primary-muted) !important;
}

select {
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2364748b'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'/%3E%3C/svg%3E") !important;
  background-repeat: no-repeat !important;
  background-position: right 0.75rem center !important;
  background-size: 1rem !important;
  padding-right: 2.5rem !important;
  -webkit-appearance: none;
  -moz-appearance: none;
}

input[type="checkbox"] {
  width: 1rem;
  height: 1rem;
  cursor: pointer;
  accent-color: var(--primary);
}

input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
}

/* ---------- Status Badges ---------- */
.bg-yellow-500\/20,
[class*="bg-yellow"] {
  background: var(--warning-muted) !important;
  color: var(--warning) !important;
}

.bg-blue-500\/20,
.bg-blue-600\/20 {
  background: var(--primary-muted) !important;
  color: var(--primary) !important;
}

.bg-green-500\/20,
[class*="bg-green-500\/"] {
  background: var(--success-muted) !important;
  color: var(--success) !important;
}

.bg-red-500\/20,
[class*="bg-red"] {
  background: var(--destructive-muted) !important;
  color: var(--destructive) !important;
}

/* ---------- Tables ---------- */
table {
  border-collapse: separate;
  border-spacing: 0;
}

thead th {
  background: var(--background-muted) !important;
  color: var(--foreground-muted) !important;
  font-weight: 500;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

tbody tr {
  transition: background 150ms;
}

tbody tr:hover {
  background: var(--background-muted) !important;
}

tbody td {
  border-bottom: 1px solid var(--border) !important;
  color: var(--foreground-secondary) !important;
}

/* ---------- Modal ---------- */
.modal-overlay,
#configModal,
#generateModal {
  background: rgba(15, 23, 42, 0.4) !important;
  backdrop-filter: blur(4px);
}

.modal-overlay > div,
#configModal > div,
#generateModal > div {
  animation: modalFade 150ms ease;
  background: var(--background) !important;
  border: 1px solid var(--border) !important;
  box-shadow: var(--shadow-md) !important;
  border-radius: var(--radius);
}

@keyframes modalFade {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

/* Modal text */
#configModal h3,
#generateModal h3 {
  color: var(--foreground) !important;
}

#configModal label,
#generateModal label {
  color: var(--foreground-secondary) !important;
}

#configModal p,
#generateModal p {
  color: var(--foreground-muted) !important;
}

/* ---------- Toast ---------- */
#toast > div {
  background: var(--background) !important;
  border: 1px solid var(--border) !important;
  box-shadow: var(--shadow-md) !important;
  border-radius: var(--radius);
}

#toast .border-green-500 { border-left: 3px solid var(--success) !important; }
#toast .border-red-500 { border-left: 3px solid var(--destructive) !important; }
#toast .border-yellow-500 { border-left: 3px solid var(--warning) !important; }

#toast p, #toast span {
  color: var(--foreground-secondary) !important;
}

/* ---------- Loading ---------- */
@keyframes spin {
  to { transform: rotate(360deg); }
}

.animate-spin {
  animation: spin 0.8s linear infinite;
}

/* Loading spinner - blue */
svg.text-blue-500,
.text-blue-500 svg {
  color: var(--primary) !important;
}

/* ---------- Icons ---------- */
svg.text-blue-400,
.text-blue-400 {
  color: var(--primary) !important;
}

svg.text-yellow-400,
.text-yellow-400 {
  color: var(--warning) !important;
}

svg.text-green-400,
.text-green-400 {
  color: var(--success) !important;
}

svg.text-red-400,
.text-red-400 {
  color: var(--destructive) !important;
}

/* ---------- Text Colors Override ---------- */
.text-gray-100,
.text-white {
  color: var(--foreground) !important;
}

.text-gray-300 {
  color: var(--foreground-secondary) !important;
}

.text-gray-400 {
  color: var(--foreground-muted) !important;
}

.text-gray-500 {
  color: var(--foreground-subtle) !important;
}

.text-blue-400,
.text-blue-500 {
  color: var(--primary) !important;
}

/* ---------- Background Override ---------- */
.bg-dark-bg {
  background: var(--background-secondary) !important;
}

.bg-dark-card {
  background: var(--background) !important;
}

.border-dark-border {
  border-color: var(--border) !important;
}

/* ---------- Tabs ---------- */
.tab-btn {
  font-weight: 500;
  transition: all 150ms;
  color: var(--foreground-muted) !important;
  background: transparent !important;
}

.tab-btn:hover {
  background: var(--background-muted) !important;
  color: var(--foreground) !important;
}

.tab-btn.bg-blue-600 {
  background: var(--primary) !important;
  color: var(--primary-foreground) !important;
}

/* ---------- Cards in lists ---------- */
#placesList a,
#reviewsList > div,
#sessionsList > div,
#recentSearchesList > div {
  background: var(--background) !important;
  border: 1px solid var(--border) !important;
  transition: all 150ms;
}

#placesList a:hover,
#reviewsList > div:hover,
#sessionsList > div:hover,
#recentSearchesList > div:hover {
  border-color: var(--border-strong) !important;
  box-shadow: var(--shadow) !important;
}

/* Card text */
#placesList span,
#placesList p,
#reviewsList span,
#reviewsList p {
  color: var(--foreground-secondary) !important;
}

#placesList h3,
#placesList strong,
#reviewsList h3,
#reviewsList strong {
  color: var(--foreground) !important;
}

/* ---------- Stats cards on jobs page ---------- */
.bg-dark-card p.text-3xl,
.bg-dark-card .text-3xl {
  color: var(--foreground) !important;
}

.bg-dark-card p.text-gray-400,
.bg-dark-card .text-sm.text-gray-400 {
  color: var(--foreground-muted) !important;
}

/* Colored stats */
.text-yellow-400.font-bold,
.text-yellow-400.text-3xl {
  color: var(--warning) !important;
}

.text-blue-400.font-bold,
.text-blue-400.text-3xl {
  color: var(--primary) !important;
}

.text-green-400.font-bold,
.text-green-400.text-3xl {
  color: var(--success) !important;
}

.text-red-400.font-bold,
.text-red-400.text-3xl {
  color: var(--destructive) !important;
}

/* ---------- Rating stars ---------- */
.text-yellow-400 svg,
svg.text-yellow-400 {
  color: #f59e0b !important;
}

/* ---------- Worker indicator ---------- */
#workerIndicator {
  background: var(--foreground-subtle) !important;
}

#workerIndicator.bg-green-500 {
  background: var(--success) !important;
}

/* ---------- Progress bar ---------- */
.progress-bar {
  background: var(--primary) !important;
}

.bg-blue-500 {
  background: var(--primary) !important;
}

/* Progress bar container */
.bg-gray-700,
.bg-dark-bg {
  background: var(--background-muted) !important;
}

/* ---------- Pagination ---------- */
#pagination button {
  background: var(--background) !important;
  border: 1px solid var(--border) !important;
  color: var(--foreground-muted) !important;
}

#pagination button:hover:not([disabled]) {
  background: var(--background-muted) !important;
  color: var(--foreground) !important;
}

#pagination button[disabled] {
  opacity: 0.5;
}

/* ---------- Code ---------- */
code {
  font-family: 'SF Mono', 'Fira Code', ui-monospace, monospace;
  background: var(--background-muted) !important;
  border: 1px solid var(--border) !important;
  padding: 0.125rem 0.375rem;
  border-radius: calc(var(--radius) - 2px);
  font-size: 0.85em;
  color: var(--foreground) !important;
}

/* ---------- Search form specifics ---------- */
#queryCount {
  color: var(--primary) !important;
}

/* Generate button */
#generateQueriesBtn {
  background: var(--success) !important;
  color: white !important;
}

#generateQueriesBtn:hover {
  opacity: 0.9;
}

/* ---------- Config button in header ---------- */
button[title="Configuration"] {
  color: var(--foreground-muted) !important;
}

button[title="Configuration"]:hover {
  background: var(--background-muted) !important;
  color: var(--foreground) !important;
}

/* ---------- Responsive ---------- */
@media (max-width: 768px) {
  header nav {
    flex-wrap: wrap;
    gap: 0.5rem;
  }

  .container {
    padding-left: 1rem;
    padding-right: 1rem;
  }
}

/* ---------- Print ---------- */
@media print {
  header, nav, button, .no-print {
    display: none !important;
  }
}

/* ---------- Reduced Motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
