/* OOH Intel - Dashboard Styles */

:root {
  --bg-primary: #0f1117;
  --bg-secondary: #1a1d27;
  --bg-card: #222533;
  --bg-hover: #2a2d3d;
  --border: #2e3247;
  --text-primary: #e8e9ed;
  --text-secondary: #9399b2;
  --text-muted: #6c7293;
  --accent: #6366f1;
  --accent-hover: #818cf8;
  --accent-dim: rgba(99, 102, 241, 0.15);
  --green: #22c55e;
  --green-dim: rgba(34, 197, 94, 0.15);
  --yellow: #eab308;
  --yellow-dim: rgba(234, 179, 8, 0.15);
  --red: #ef4444;
  --red-dim: rgba(239, 68, 68, 0.15);
  --blue: #3b82f6;
  --blue-dim: rgba(59, 130, 246, 0.15);
  --orange: #f97316;
  --orange-dim: rgba(249, 115, 22, 0.15);
  --radius: 8px;
  --radius-lg: 12px;
  --sidebar-width: 220px;
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'SF Mono', 'Fira Code', 'Fira Mono', monospace;
}

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

body {
  font-family: var(--font);
  background: var(--bg-primary);
  color: var(--text-primary);
  display: flex;
  min-height: 100vh;
  overflow-x: hidden;
}

/* Sidebar */
.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 100;
}

.logo {
  padding: 20px 20px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 8px;
}

.logo-icon {
  background: var(--accent);
  color: white;
  font-weight: 800;
  font-size: 11px;
  letter-spacing: 1px;
  padding: 4px 8px;
  border-radius: 4px;
}

.logo-text {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
}

.nav-links {
  list-style: none;
  padding: 12px 8px;
  flex: 1;
}

.nav-links li { margin: 2px 0; }

.nav-links a {
  display: block;
  padding: 10px 14px;
  border-radius: var(--radius);
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.15s;
}

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

.nav-links a.active {
  background: var(--accent-dim);
  color: var(--accent-hover);
}

.nav-footer {
  padding: 16px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
}

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

/* Main Content */
.content {
  margin-left: var(--sidebar-width);
  flex: 1;
  padding: 32px;
  max-width: 1200px;
}

/* Views */
.view { display: none; }
.view.active { display: block; }

.view-header {
  margin-bottom: 28px;
}

.view-header h1 {
  font-size: 28px;
  font-weight: 700;
  margin-bottom: 4px;
}

.subtitle {
  color: var(--text-secondary);
  font-size: 14px;
}

/* Stats Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 28px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
}

.stat-value {
  font-size: 32px;
  font-weight: 700;
  font-family: var(--font-mono);
  margin-bottom: 4px;
}

.stat-label {
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
}

/* Cards */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-bottom: 20px;
}

.card h2 {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 16px;
  color: var(--text-primary);
}

.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 20px;
}

.dashboard-grid .card { margin-bottom: 0; }

/* Tables */
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

thead th {
  text-align: left;
  padding: 10px 12px;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border);
}

tbody td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  color: var(--text-secondary);
}

tbody tr:hover {
  background: var(--bg-hover);
}

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

/* Badges / Tags */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.badge-source {
  background: var(--blue-dim);
  color: var(--blue);
}

.badge-confidence-high {
  background: var(--green-dim);
  color: var(--green);
}

.badge-confidence-med {
  background: var(--yellow-dim);
  color: var(--yellow);
}

.badge-confidence-low {
  background: var(--red-dim);
  color: var(--red);
}

.badge-status-new {
  background: var(--accent-dim);
  color: var(--accent-hover);
}

.badge-status-contacted {
  background: var(--yellow-dim);
  color: var(--yellow);
}

.badge-status-qualified {
  background: var(--green-dim);
  color: var(--green);
}

.badge-status-converted {
  background: var(--green-dim);
  color: var(--green);
  font-weight: 700;
}

.badge-status-dead {
  background: var(--red-dim);
  color: var(--red);
}

.badge-vendor {
  background: var(--orange-dim);
  color: var(--orange);
}

/* Priority bar */
.priority-bar {
  width: 60px;
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
}

.priority-bar-fill {
  height: 100%;
  border-radius: 3px;
  background: var(--accent);
}

/* Advertiser name link */
.advertiser-link {
  color: var(--text-primary);
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
}

.advertiser-link:hover {
  color: var(--accent-hover);
  text-decoration: underline;
}

/* List items for dashboard */
.list-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

.list-item:last-child { border-bottom: none; }

.list-item-name {
  font-weight: 500;
  font-size: 14px;
}

.list-item-value {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text-muted);
}

/* Inputs & Buttons */
.input {
  background: var(--bg-primary);
  border: 1px solid var(--border);
  color: var(--text-primary);
  padding: 8px 12px;
  border-radius: var(--radius);
  font-size: 13px;
  font-family: var(--font);
  outline: none;
  transition: border-color 0.15s;
}

.input:focus {
  border-color: var(--accent);
}

.input-lg {
  width: 100%;
  padding: 12px 16px;
  font-size: 15px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 16px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-primary);
  transition: all 0.15s;
}

.btn:hover {
  background: var(--bg-hover);
}

.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

.btn-primary:hover {
  background: var(--accent-hover);
}

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

/* Filters */
.filters {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
}

/* Pagination */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-top: 20px;
  font-size: 13px;
  color: var(--text-muted);
}

/* Search */
.search-bar {
  margin-bottom: 24px;
}

/* Modal */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal.hidden { display: none; }

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
}

.modal-content {
  position: relative;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
  max-width: 720px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 16px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 24px;
  cursor: pointer;
}

.modal-close:hover { color: var(--text-primary); }

.detail-header {
  margin-bottom: 20px;
}

.detail-header h2 {
  font-size: 22px;
  margin-bottom: 4px;
}

.detail-meta {
  display: flex;
  gap: 16px;
  color: var(--text-muted);
  font-size: 13px;
}

.detail-section {
  margin-bottom: 20px;
}

.detail-section h3 {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 10px;
  color: var(--text-secondary);
}

.vendor-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.vendor-chip {
  background: var(--orange-dim);
  color: var(--orange);
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}

/* Empty state */
.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
  font-size: 14px;
}

/* Scraper status toast */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 20px;
  font-size: 13px;
  color: var(--text-primary);
  z-index: 300;
  animation: slideIn 0.2s ease-out;
}

.toast-success { border-color: var(--green); }
.toast-error { border-color: var(--red); }

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

/* Image thumbnail */
.img-thumb {
  width: 48px;
  height: 48px;
  border-radius: 4px;
  object-fit: cover;
  background: var(--bg-primary);
  border: 1px solid var(--border);
}

/* Source URL */
.source-link {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 12px;
  max-width: 200px;
  display: inline-block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.source-link:hover {
  color: var(--accent-hover);
}

/* Responsive */
@media (max-width: 900px) {
  .sidebar {
    width: 60px;
    overflow: hidden;
  }
  .logo-text, .nav-links a, .nav-footer .version { display: none; }
  .logo { justify-content: center; padding: 16px 8px; }
  .nav-links a { padding: 10px; text-align: center; }
  .content { margin-left: 60px; padding: 20px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .dashboard-grid { grid-template-columns: 1fr; }
  .nav-footer { padding: 8px; }
  .btn-sm { font-size: 10px; padding: 4px 6px; }
}

@media (max-width: 600px) {
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .stat-value { font-size: 24px; }
}
