/* ==========================================================================
   CASA0017 Flickr API — Clean, Simple, Modern Stylesheet
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500;600&display=swap');

:root {
  --bg-page: #f8fafc;
  --bg-surface: #ffffff;
  --bg-subtle: #f1f5f9;
  --bg-code: #0f172a;
  --bg-code-header: #1e293b;

  --text-main: #0f172a;
  --text-secondary: #334155;
  --text-muted: #64748b;

  --border-color: #e2e8f0;
  --border-strong: #cbd5e1;

  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-light: #eff6ff;
  --primary-border: #bfdbfe;

  --success: #059669;
  --success-light: #ecfdf5;
  --warning: #d97706;
  --warning-light: #fffbeb;
  --danger: #e11d48;
  --danger-light: #fff1f2;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 12px;

  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
  --shadow-md: 0 4px 12px rgba(15, 23, 42, 0.06);

  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

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

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: var(--font-sans);
  background-color: var(--bg-page);
  color: var(--text-main);
  line-height: 1.6;
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
}

code, pre, .mono {
  font-family: var(--font-mono);
}

p code, li code, td code {
  font-size: 0.85em;
  background: var(--bg-subtle);
  color: var(--text-main);
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
}

/* ==========================================================================
   Navigation
   ========================================================================== */
.navbar {
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 1000;
}

.nav-container {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 1.5rem;
  height: 60px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.nav-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  text-decoration: none;
  color: var(--text-main);
  font-weight: 700;
  font-size: 1rem;
}

.brand-badge {
  font-family: var(--font-mono);
  background: var(--primary-light);
  color: var(--primary);
  font-size: 0.72rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 99px;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  list-style: none;
}

.nav-link {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 500;
  padding: 0.45rem 0.85rem;
  border-radius: var(--radius-sm);
  transition: all 0.15s ease;
}

.nav-link:hover {
  color: var(--text-main);
  background: var(--bg-subtle);
}

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

/* ==========================================================================
   Layout & Page Header
   ========================================================================== */
.main-wrapper, #container {
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  padding: 2.25rem 1.5rem 4rem;
  flex: 1;
}

.page-intro {
  margin-bottom: 2rem;
}

.page-eyebrow {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.35rem;
}

.page-title {
  font-size: 1.85rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-main);
}

.page-desc {
  color: var(--text-muted);
  font-size: 1rem;
  max-width: 680px;
  margin-top: 0.4rem;
}

/* ==========================================================================
   API Tester / Playground Grid
   ========================================================================== */
.tester-grid {
  display: grid;
  grid-template-columns: 420px 1fr;
  gap: 1.5rem;
  align-items: start;
  margin-bottom: 3rem;
}

.card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.card-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
}

.card-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-main);
}

.card-body {
  padding: 1.25rem;
}

/* Endpoint Selector List */
.endpoint-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
}

.endpoint-item {
  width: 100%;
  text-align: left;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.75rem 0.9rem;
  cursor: pointer;
  transition: all 0.15s ease;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.endpoint-item:hover {
  border-color: var(--border-strong);
  background: var(--bg-page);
}

.endpoint-item.active {
  border-color: var(--primary);
  background: var(--primary-light);
  box-shadow: 0 0 0 1px var(--primary);
}

.endpoint-item-route {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-main);
}

.endpoint-item-desc {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* Badges */
.method-badge {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  text-transform: uppercase;
  background: var(--success-light);
  color: var(--success);
}

.status-badge {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 4px;
}

.status-200 {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
}

.status-400 {
  background: rgba(245, 158, 11, 0.18);
  color: #fbbf24;
}

.status-500 {
  background: rgba(239, 68, 68, 0.18);
  color: #f87171;
}

/* Form Controls */
.param-box {
  background: var(--bg-page);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1rem;
  margin-bottom: 1rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.form-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.form-input {
  width: 100%;
  padding: 0.55rem 0.75rem;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
  color: var(--text-main);
}

.form-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.inputs-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.65rem;
}

.quick-pills {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
  margin-top: 0.75rem;
}

.pill-label {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.quick-pill {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  font-size: 0.75rem;
  font-weight: 500;
  padding: 0.2rem 0.6rem;
  border-radius: 99px;
  cursor: pointer;
  transition: all 0.12s ease;
}

.quick-pill:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-light);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 0.6rem 1.1rem;
  font-family: var(--font-sans);
  font-size: 0.86rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.15s ease;
}

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

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

.btn-secondary {
  background: var(--bg-surface);
  color: var(--text-secondary);
  border-color: var(--border-strong);
}

.btn-secondary:hover {
  background: var(--bg-subtle);
  color: var(--text-main);
}

.btn-dark {
  background: rgba(255, 255, 255, 0.08);
  color: #e2e8f0;
  border-color: rgba(255, 255, 255, 0.14);
}

.btn-dark:hover {
  background: rgba(255, 255, 255, 0.15);
  color: #ffffff;
}

.btn-sm {
  padding: 0.35rem 0.7rem;
  font-size: 0.78rem;
}

/* ==========================================================================
   Response Viewer Panel (Right Side of Tester)
   ========================================================================== */
.response-card {
  background: var(--bg-code);
  color: #f8fafc;
  border-radius: var(--radius-lg);
  border: 1px solid #1e293b;
  overflow: hidden;
  box-shadow: var(--shadow-md);
}

.url-bar {
  background: var(--bg-code-header);
  padding: 0.85rem 1.15rem;
  border-bottom: 1px solid #334155;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-wrap: wrap;
}

.url-box {
  flex: 1;
  min-width: 200px;
  font-family: var(--font-mono);
  font-size: 0.84rem;
  color: #38bdf8;
  background: rgba(0, 0, 0, 0.3);
  padding: 0.45rem 0.75rem;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255, 255, 255, 0.1);
  overflow-x: auto;
  white-space: nowrap;
}

.response-toolbar {
  padding: 0.5rem 1.15rem;
  background: rgba(15, 23, 42, 0.8);
  border-bottom: 1px solid #1e293b;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.dark-tabs {
  display: flex;
  gap: 0.25rem;
}

.dark-tab {
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: #94a3b8;
  font-size: 0.82rem;
  font-weight: 500;
  padding: 0.5rem 0.85rem;
  cursor: pointer;
}

.dark-tab:hover {
  color: #ffffff;
}

.dark-tab.active {
  color: #38bdf8;
  border-bottom-color: #38bdf8;
}

.dark-panel {
  display: none;
  padding: 1.15rem;
}

.dark-panel.active {
  display: block;
}

.json-pre, .code-block {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  line-height: 1.55;
  color: #e2e8f0;
  max-height: 440px;
  overflow: auto;
  margin: 0;
}

.json-key { color: #7dd3fc; }
.json-string { color: #86efac; }
.json-number { color: #fcd34d; }
.json-boolean { color: #f472b6; }
.json-null { color: #94a3b8; }

/* ==========================================================================
   Bottom Info & Downloads Grid
   ========================================================================== */
.info-grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 1.5rem;
}

.simple-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.simple-table th {
  text-align: left;
  padding: 0.55rem 0.75rem;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-muted);
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.simple-table td {
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-secondary);
}

.simple-table tr:last-child td {
  border-bottom: none;
}

.download-list {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.download-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 0.9rem;
  background: var(--bg-page);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  gap: 1rem;
}

/* ==========================================================================
   Map Demo Layout (/examples/map)
   ========================================================================== */
.map-layout {
  display: grid;
  grid-template-columns: 350px 1fr;
  gap: 1.25rem;
  height: calc(100vh - 190px);
  min-height: 540px;
}

.map-controls-panel {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  overflow-y: auto;
}

.map-view-panel {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
  position: relative;
}

#map-container {
  width: 100%;
  height: 100%;
  min-height: 460px;
}

/* ==========================================================================
   Camera Ranking List (/examples/cameras)
   ========================================================================== */
.camera-rank-list {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.camera-rank-item {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.65rem 0.9rem;
  display: flex;
  align-items: center;
  gap: 0.85rem;
  cursor: pointer;
  transition: all 0.12s ease;
}

.camera-rank-item:hover, .camera-rank-item.active {
  border-color: var(--primary);
  background: var(--primary-light);
}

.rank-number {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  min-width: 26px;
}

.rank-details {
  flex: 1;
  min-width: 0;
}

.rank-device {
  font-weight: 600;
  font-size: 0.86rem;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.rank-bar-bg {
  width: 100%;
  height: 5px;
  background: var(--bg-subtle);
  border-radius: 99px;
  margin-top: 0.3rem;
  overflow: hidden;
}

.rank-bar-fill {
  height: 100%;
  background: var(--primary);
  border-radius: 99px;
}

.rank-count-badge {
  font-family: var(--font-mono);
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--primary);
  background: var(--primary-light);
  padding: 2px 8px;
  border-radius: 99px;
}

.tag-chip {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.74rem;
  background: var(--bg-subtle);
  color: var(--text-secondary);
  padding: 2px 8px;
  border-radius: 4px;
  margin: 2px;
}

/* Light Tabs */
.response-tabs {
  display: flex;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-page);
}

.tab-btn {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 0.65rem 1rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
}

.tab-btn.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  background: var(--bg-surface);
}

.tab-panel {
  padding: 1.25rem;
  display: none;
}

.tab-panel.active {
  display: block;
}

/* ==========================================================================
   Footer, Toast & Modal
   ========================================================================== */
.footer {
  border-top: 1px solid var(--border-color);
  background: var(--bg-surface);
  padding: 1.5rem;
  color: var(--text-muted);
  font-size: 0.82rem;
  margin-top: auto;
}

.footer-content {
  max-width: 1180px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

.toast-container {
  position: fixed;
  bottom: 1.25rem;
  right: 1.25rem;
  z-index: 100000;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.toast-item {
  background: var(--bg-code);
  color: #ffffff;
  border-radius: var(--radius-sm);
  padding: 0.6rem 0.95rem;
  font-size: 0.82rem;
  font-weight: 500;
  box-shadow: var(--shadow-md);
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  opacity: 0;
  transform: translateY(8px);
  transition: all 0.2s ease;
}

.toast-item.visible {
  opacity: 1;
  transform: translateY(0);
}

.toast-icon { color: #34d399; display: inline-flex; }

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 99999;
  opacity: 0;
  visibility: hidden;
  transition: all 0.15s ease;
  padding: 1rem;
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal-box {
  background: var(--bg-surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  max-width: 460px;
  width: 100%;
  overflow: hidden;
}

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

.modal-title { font-weight: 600; font-size: 0.95rem; }
.modal-close { background: none; border: none; cursor: pointer; color: var(--text-muted); }
.modal-body { padding: 1.25rem; font-size: 0.9rem; color: var(--text-secondary); }
.modal-footer { padding: 0.75rem 1.25rem; border-top: 1px solid var(--border-color); display: flex; justify-content: flex-end; }

@media (max-width: 960px) {
  .tester-grid, .info-grid, .map-layout {
    grid-template-columns: 1fr;
  }
  .map-layout {
    height: auto;
  }
  #map-container {
    height: 450px;
  }
}
