/* ReRBN Styles */

:root {
  --color-primary: #3b82f6;
  --color-primary-hover: #2563eb;
  --color-success: #22c55e;
  --color-warning: #f59e0b;
  --color-error: #ef4444;
  --color-bg: #ffffff;
  --color-bg-secondary: #f3f4f6;
  --color-text: #1f2937;
  --color-text-muted: #6b7280;
  --color-border: #e5e7eb;
  --radius: 6px;
  --shadow: 0 1px 3px rgba(0,0,0,0.1);
  --shadow-lg: 0 4px 6px rgba(0,0,0,0.1);
}

@media (prefers-color-scheme: dark) {
  :root {
    --color-bg: #111827;
    --color-bg-secondary: #1f2937;
    --color-text: #f9fafb;
    --color-text-muted: #9ca3af;
    --color-border: #374151;
  }
}

/* Reset */
*, *::before, *::after {
  box-sizing: border-box;
}

body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.5;
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Layout */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1rem;
}

.main {
  flex: 1;
  padding: 2rem 0;
}

/* Header */
.header {
  background: var(--color-bg-secondary);
  border-bottom: 1px solid var(--color-border);
  padding: 1rem 0;
}

.header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--color-primary);
  text-decoration: none;
}

.nav {
  display: flex;
  gap: 1.5rem;
}

.nav a {
  color: var(--color-text);
  text-decoration: none;
}

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

/* Footer */
.footer {
  background: var(--color-bg-secondary);
  border-top: 1px solid var(--color-border);
  padding: 1.5rem 0;
  text-align: center;
  color: var(--color-text-muted);
  font-size: 0.875rem;
}

.footer a {
  color: var(--color-primary);
}

/* Content links (exclude navigation and special links) */
.about-container section a,
.docs-main a,
section p a,
section li a {
  color: #3b82f6;
  text-decoration: underline;
}

.about-container section a:hover,
.docs-main a:hover,
section p a:hover,
section li a:hover {
  color: #2563eb;
}

@media (prefers-color-scheme: dark) {
  .about-container section a,
  .docs-main a,
  section p a,
  section li a {
    color: #60a5fa;
  }

  .about-container section a:hover,
  .docs-main a:hover,
  section p a:hover,
  section li a:hover {
    color: #93c5fd;
  }
}

.footer-developer {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--color-border);
}

.footer-developer p {
  margin-bottom: 0.5rem;
}

.footer-support {
  margin-top: 0.75rem;
  display: flex;
  justify-content: center;
  align-items: center;
}

/* Buy Me a Coffee button styling */
.bmc-button {
  display: inline-flex !important;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1.25rem;
  background-color: #5F7FFF;
  color: #ffffff !important;
  border-radius: 0.5rem;
  text-decoration: none !important;
  font-family: 'Poppins', Arial, sans-serif;
  font-weight: 500;
  font-size: 0.9rem;
  transition: background-color 0.2s ease, transform 0.1s ease;
  border: 2px solid #000000;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.bmc-button:hover {
  background-color: #4e6eef;
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.bmc-button:active {
  transform: translateY(0);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.bmc-button span:first-child {
  font-size: 1.2rem;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem 1rem;
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.15s, box-shadow 0.15s;
}

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

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

.btn-secondary {
  background: var(--color-bg-secondary);
  color: var(--color-text);
  border: 1px solid var(--color-border);
}

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

.btn-small {
  padding: 0.25rem 0.5rem;
  font-size: 0.75rem;
}

/* Search Page */
.search-container {
  max-width: 800px;
}

.search-container h1 {
  margin-bottom: 0.5rem;
}

.subtitle {
  color: var(--color-text-muted);
  margin-bottom: 2rem;
}

.search-form {
  margin-bottom: 2rem;
}

.search-box {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.search-box input {
  flex: 1;
  padding: 0.75rem 1rem;
  font-size: 1rem;
  border: 2px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-bg);
  color: var(--color-text);
}

.search-box input:focus {
  outline: none;
  border-color: var(--color-primary);
}

.search-box .btn {
  padding: 0.75rem 1.5rem;
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: flex-start;
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.filter-group legend,
.filter-group label {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--color-text-muted);
  text-transform: uppercase;
}

.filter-group select {
  padding: 0.5rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-bg);
  color: var(--color-text);
}

fieldset.filter-group {
  border: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: row;
  gap: 0.75rem;
  flex-wrap: wrap;
}

fieldset.filter-group legend {
  margin-bottom: 0.5rem;
  width: 100%;
}

.checkbox {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  cursor: pointer;
}

.checkbox input {
  margin: 0;
}

/* Loading Indicator */
.htmx-indicator {
  display: none;
  align-items: center;
  gap: 0.5rem;
  padding: 1rem;
  color: var(--color-text-muted);
}

.htmx-request .htmx-indicator {
  display: flex;
}

.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--color-border);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* Results */
.results {
  margin-top: 1rem;
}

.results-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.results-header h2 {
  margin: 0;
  font-size: 1.125rem;
}

.results-count {
  color: var(--color-text-muted);
  font-size: 0.875rem;
}

.no-results {
  padding: 2rem;
  text-align: center;
  background: var(--color-bg-secondary);
  border-radius: var(--radius);
  color: var(--color-text-muted);
}

.table-wrapper {
  overflow-x: auto;
}

.spots-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.spots-table th,
.spots-table td {
  padding: 0.75rem;
  text-align: left;
  border-bottom: 1px solid var(--color-border);
}

.spots-table th {
  font-weight: 600;
  color: var(--color-text-muted);
  font-size: 0.75rem;
  text-transform: uppercase;
}

.spots-table tbody tr:hover {
  background: var(--color-bg-secondary);
}

/* Mode Badges */
.mode-badge {
  display: inline-block;
  padding: 0.125rem 0.5rem;
  border-radius: var(--radius);
  font-size: 0.75rem;
  font-weight: 600;
}

.mode-cw {
  background: #dbeafe;
  color: #1d4ed8;
}

.mode-ft8, .mode-ft4 {
  background: #fef3c7;
  color: #b45309;
}

.mode-rtty {
  background: #dcfce7;
  color: #166534;
}

@media (prefers-color-scheme: dark) {
  .mode-cw { background: #1e3a5f; color: #93c5fd; }
  .mode-ft8, .mode-ft4 { background: #451a03; color: #fcd34d; }
  .mode-rtty { background: #052e16; color: #86efac; }
}

.load-more {
  margin-top: 1rem;
  text-align: center;
}

/* Docs Page */
.docs-container {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 2rem;
}

.docs-nav {
  position: sticky;
  top: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.docs-nav a {
  color: var(--color-text-muted);
  text-decoration: none;
  padding: 0.25rem 0;
}

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

.docs-content h1 {
  margin-top: 0;
}

.docs-content section {
  margin-bottom: 2rem;
}

.docs-content pre {
  background: var(--color-bg-secondary);
  padding: 1rem;
  border-radius: var(--radius);
  overflow-x: auto;
}

.docs-content code {
  font-family: 'SF Mono', Monaco, monospace;
  font-size: 0.875rem;
}

.endpoint {
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 1rem;
  margin-bottom: 1rem;
}

.endpoint-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.method {
  padding: 0.25rem 0.5rem;
  border-radius: var(--radius);
  font-size: 0.75rem;
  font-weight: 700;
}

.method.get {
  background: #dcfce7;
  color: #166534;
}

.params-table {
  width: 100%;
  font-size: 0.875rem;
  margin: 0.5rem 0;
}

.params-table td {
  padding: 0.5rem;
  border-bottom: 1px solid var(--color-border);
}

.params-table td:first-child code {
  background: var(--color-bg-secondary);
  padding: 0.125rem 0.25rem;
  border-radius: 3px;
}

/* Error display */
.error {
  padding: 1rem;
  background: #fef2f2;
  color: #991b1b;
  border-radius: var(--radius);
}

@media (prefers-color-scheme: dark) {
  .error { background: #450a0a; color: #fca5a5; }
}

/* Charts Section */
.charts-section {
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid var(--color-border);
}

.charts-section h2 {
  margin-bottom: 1.5rem;
  color: var(--color-text);
}

.charts-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.5rem;
}

.chart-card {
  background: var(--color-bg-secondary);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 1rem;
}

.chart-card h3 {
  margin: 0 0 1rem 0;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--color-text-muted);
  text-transform: uppercase;
}

.chart-card canvas {
  max-height: 250px;
}

/* Responsive */
@media (max-width: 768px) {
  .search-box {
    flex-direction: column;
  }

  .docs-container {
    grid-template-columns: 1fr;
  }

  .docs-nav {
    position: static;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 1rem;
  }

  .charts-grid {
    grid-template-columns: 1fr;
  }
}

/* Expand container for charts */
.search-container {
  max-width: 1000px;
}

/* Skeleton loading states */
.chart-card.loading canvas {
  display: none;
}

.chart-card.loading::before {
  content: '';
  display: block;
  height: 250px;
  background: linear-gradient(90deg,
    var(--color-bg-secondary) 0%,
    var(--color-border) 50%,
    var(--color-bg-secondary) 100%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 4px;
  margin-top: 1rem;
}

@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}
