/* Scottish Planning DB — Live Event Feed Stylesheet */

:root {
  --bg-dark: #0f172a;
  --bg-card: #1e293b;
  --bg-card-hover: #334155;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --border-color: #334155;
  
  --primary: #3b82f6;
  --primary-hover: #2563eb;
  --accent: #8b5cf6;
  
  --status-approved: #10b981;
  --status-refused: #ef4444;
  --status-inflight: #f59e0b;
  --status-withdrawn: #6b7280;
  --status-discovered: #06b6d4;
  
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  
  --radius: 10px;
  --shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.3), 0 8px 10px -6px rgba(0, 0, 0, 0.2);
}

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

body {
  font-family: var(--font-sans);
  background-color: var(--bg-dark);
  color: var(--text-main);
  line-height: 1.5;
  min-height: 100vh;
  padding: 24px;
}

.feed-container {
  max-width: 1280px;
  margin: 0 auto;
}

/* Header Navigation */
.feed-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border-color);
}

.brand-wrapper {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-wrapper .flag {
  font-size: 2rem;
}

.brand-wrapper h1 {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: -0.02em;
}

.brand-wrapper .subtitle {
  font-size: 0.875rem;
  color: var(--text-muted);
}

.header-nav {
  display: flex;
  gap: 10px;
}

.nav-link {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  padding: 8px 16px;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  transition: all 0.2s ease;
}

.nav-link:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.1);
}

.nav-link.active {
  color: #ffffff;
  background: var(--primary);
  border-color: var(--primary-hover);
}

/* Controls & Tabs Card */
.controls-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 20px;
  box-shadow: var(--shadow);
}

.tab-buttons {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 16px;
}

.tab-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  font-family: var(--font-sans);
  font-size: 0.95rem;
  font-weight: 600;
  padding: 12px 20px;
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.2s ease;
}

.tab-btn:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.08);
}

.tab-btn.active {
  background: rgba(59, 130, 246, 0.15);
  border-color: var(--primary);
  color: #60a5fa;
}

.tab-btn .count-badge {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-main);
  font-size: 0.75rem;
  padding: 2px 8px;
  border-radius: 12px;
  font-family: var(--font-mono);
}

.tab-btn.active .count-badge {
  background: var(--primary);
  color: #ffffff;
}

.filters-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.filter-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.filter-item label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.filter-select {
  background: #0f172a;
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 8px 14px;
  border-radius: var(--radius);
  font-family: var(--font-sans);
  font-size: 0.875rem;
  min-width: 240px;
  outline: none;
}

.filter-checkbox {
  flex-direction: row;
  align-items: center;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.875rem;
  color: var(--text-main);
  cursor: pointer;
  user-select: none;
}

.checkbox-label input {
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
  cursor: pointer;
}

.filter-actions {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-left: auto;
}

.auto-refresh-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  color: var(--text-muted);
  cursor: pointer;
}

.auto-refresh-label input {
  accent-color: var(--primary);
}

.btn-refresh {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--primary);
  color: #ffffff;
  border: none;
  padding: 8px 16px;
  border-radius: var(--radius);
  font-family: var(--font-sans);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s ease;
}

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

/* Status Bar */
.feed-status-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  padding: 0 4px;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.status-info {
  display: flex;
  align-items: center;
  gap: 8px;
}

.status-indicator {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #64748b;
}

.status-indicator.live {
  background: #10b981;
  box-shadow: 0 0 8px #10b981;
}

/* Feed Timeline Cards Grid */
.feed-grid {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.feed-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 18px 22px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.feed-card:hover {
  border-color: #475569;
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}

.card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.card-title-group {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.card-ref {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 1rem;
  color: #60a5fa;
}

.card-council {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #e2e8f0;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 6px;
}

.card-apptype {
  background: rgba(139, 92, 246, 0.15);
  color: #c084fc;
  border: 1px solid rgba(139, 92, 246, 0.3);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 6px;
}

.card-meta-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.event-type-badge {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 12px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.event-type-badge.discovered {
  background: rgba(6, 182, 212, 0.15);
  color: #22d3ee;
  border: 1px solid rgba(6, 182, 212, 0.3);
}

.event-type-badge.resolved {
  background: rgba(59, 130, 246, 0.15);
  color: #60a5fa;
  border: 1px solid rgba(59, 130, 246, 0.3);
}

.event-type-badge.determined {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.card-time {
  font-size: 0.8rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.card-proposal {
  font-size: 0.95rem;
  color: #f1f5f9;
  line-height: 1.45;
}

.card-address {
  font-size: 0.85rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}

.timestamp-breakdown {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  font-size: 0.775rem;
  color: #94a3b8;
  background: rgba(15, 23, 42, 0.4);
  padding: 6px 12px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.04);
}

.card-transition-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(30, 41, 59, 0.5);
  border: 1px solid rgba(96, 165, 250, 0.2);
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 0.825rem;
  margin-top: 4px;
}

.transition-label {
  font-weight: 700;
  color: #60a5fa;
  white-space: nowrap;
}

.transition-value {
  color: #f1f5f9;
  font-weight: 600;
}

.active-sort-key {
  color: #60a5fa !important;
  font-weight: 600;
}

.active-sort-key strong {
  color: #93c5fd !important;
}

.card-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-top: 8px;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 0.825rem;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 20px;
  font-weight: 600;
  font-size: 0.8rem;
  max-width: 65%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.status-badge.approved {
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.3);
  color: #34d399;
}

.status-badge.refused {
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #f87171;
}

.status-badge.inflight {
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.3);
  color: #fbbf24;
}

.status-badge.withdrawn {
  background: rgba(148, 163, 184, 0.12);
  border: 1px solid rgba(148, 163, 184, 0.3);
  color: #94a3b8;
}

.status-badge.discovered-pending {
  background: rgba(56, 189, 248, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.3);
  color: #38bdf8;
}

.card-links {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.card-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 12px;
  border-radius: 6px;
  background: rgba(59, 130, 246, 0.12);
  border: 1px solid rgba(59, 130, 246, 0.3);
  color: #60a5fa;
  font-weight: 600;
  font-size: 0.8rem;
  text-decoration: none;
  white-space: nowrap;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.card-link:hover {
  background: rgba(59, 130, 246, 0.25);
  border-color: #60a5fa;
  color: #ffffff;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.25);
  text-decoration: none;
}

/* Loading & Empty States */
.loading-state, .empty-state {
  text-align: center;
  padding: 48px 24px;
  background: var(--bg-card);
  border: 1px dashed var(--border-color);
  border-radius: var(--radius);
  color: var(--text-muted);
}

.spinner {
  width: 36px;
  height: 36px;
  border: 3px solid rgba(255, 255, 255, 0.1);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 16px auto;
}

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

/* Quick Legend Bar */
.quick-legend-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  background: rgba(30, 41, 59, 0.6);
  border: 1px solid var(--border-color);
  padding: 10px 16px;
  border-radius: var(--radius);
  margin-bottom: 16px;
  font-size: 0.825rem;
}

.legend-title {
  font-weight: 700;
  color: #60a5fa;
}

.legend-pill {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 3px 10px;
  border-radius: 12px;
  color: var(--text-muted);
  cursor: help;
}

.legend-pill strong {
  color: #f1f5f9;
}

.btn-text-link {
  background: none;
  border: none;
  color: var(--primary);
  font-family: var(--font-sans);
  font-size: 0.825rem;
  font-weight: 600;
  cursor: pointer;
  margin-left: auto;
  padding: 0;
  transition: color 0.15s ease;
}

.btn-text-link:hover {
  color: #93c5fd;
  text-decoration: underline;
}

.help-btn {
  background: rgba(139, 92, 246, 0.15) !important;
  border-color: rgba(139, 92, 246, 0.4) !important;
  color: #c084fc !important;
  cursor: pointer;
}

.help-btn:hover {
  background: rgba(139, 92, 246, 0.25) !important;
  color: #e9d5ff !important;
}

/* Modal Drawer Overlay */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  justify-content: flex-end;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.modal-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.modal-drawer {
  width: 100%;
  max-width: 680px;
  height: 100%;
  background: #0f172a;
  border-left: 1px solid var(--border-color);
  box-shadow: -10px 0 30px rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-overlay.open .modal-drawer {
  transform: translateX(0);
}

.modal-header {
  padding: 24px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.modal-title h2 {
  font-size: 1.35rem;
  color: #f8fafc;
}

.modal-sub {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.close-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.close-btn:hover {
  background: rgba(239, 68, 68, 0.2);
  color: #ef4444;
}

.modal-body {
  padding: 24px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.glossary-section h3 {
  font-size: 1.05rem;
  color: #60a5fa;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.glossary-section p {
  font-size: 0.9rem;
  color: #cbd5e1;
  line-height: 1.6;
}

.glossary-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 8px;
  font-size: 0.85rem;
}

.glossary-table th, .glossary-table td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.glossary-table th {
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.75rem;
}

.code-badge {
  font-family: var(--font-mono);
  background: rgba(59, 130, 246, 0.15);
  color: #60a5fa;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 600;
}

.badge-guide-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 12px;
  font-size: 0.875rem;
  color: #cbd5e1;
}

@media (max-width: 768px) {
  .feed-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
  }
  
  .tab-buttons {
    flex-direction: column;
  }
  
  .filters-row {
    flex-direction: column;
    align-items: stretch;
  }
  
  .filter-actions {
    margin-left: 0;
    justify-content: space-between;
  }

  .btn-text-link {
    margin-left: 0;
    width: 100%;
  }
}
