/* SPDX-FileCopyrightText: © 2025 Christoph Görn <goern@b4mad.net> */
/* SPDX-License-Identifier: GPL-3.0-only */

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

/* Bluloco Light theme (default) */
:root {
  --bg-primary: #f9f9f9;
  --bg-secondary: #ffffff;
  --bg-hover: #f0f4f7;
  --text-primary: #383a42;
  --text-secondary: #6a6c77;
  --text-muted: #959da5;
  --border: #e1e4e8;
  --border-light: #eff2f4;

  /* Bluloco signature colors */
  --blue: #0098dd;
  --blue-light: #40b8e7;
  --purple: #823ff1;
  --green: #23974a;
  --orange: #df631c;
  --red: #d52753;
  --cyan: #3a8ab0;
  --yellow: #c5a332;

  --accent: var(--blue);
  --method-bg: #ffffff;
  --stat-bg: #ffffff;
  --toggle-bg: #d6e5eb;
}

/* Bluloco Dark theme */
[data-theme="dark"] {
  --bg-primary: #282c34;
  --bg-secondary: #2d333b;
  --bg-hover: #373d48;
  --text-primary: #b9c0cb;
  --text-secondary: #8b92a0;
  --text-muted: #636d83;
  --border: #3e4451;
  --border-light: #353b45;

  /* Bluloco Dark signature colors */
  --blue: #3691ff;
  --blue-light: #5ca7ff;
  --purple: #a88aeb;
  --green: #3fc56b;
  --orange: #ff936a;
  --red: #ff6480;
  --cyan: #10b1fe;
  --yellow: #f9c859;

  --accent: var(--blue);
  --method-bg: #282c34;
  --stat-bg: #2d333b;
  --toggle-bg: #3e4451;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'SF Pro Display', Roboto, 'Helvetica Neue', sans-serif;
  line-height: 1.5;
  color: var(--text-primary);
  background: var(--bg-primary);
  font-size: 14px;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1.5rem;
}

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

.header-left {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.logo {
  font-size: 1.5rem;
  color: var(--blue);
  font-weight: 600;
}

.header h1 {
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, var(--blue), var(--purple));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.header-subtitle {
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.header-right {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.status-container {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.status {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 6px var(--green);
}

.status-dot.offline {
  background: var(--red);
  box-shadow: 0 0 6px var(--red);
}

/* Theme Toggle */
.theme-toggle {
  position: relative;
  width: 44px;
  height: 22px;
  background: var(--toggle-bg);
  border-radius: 11px;
  cursor: pointer;
  transition: all 0.3s ease;
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 3px;
}

.theme-toggle:hover {
  border-color: var(--blue);
}

.theme-toggle-slider {
  position: absolute;
  width: 16px;
  height: 16px;
  background: var(--blue);
  border-radius: 50%;
  transition: transform 0.3s ease;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

[data-theme="dark"] .theme-toggle-slider {
  transform: translateX(22px);
  background: var(--cyan);
}

/* Stats Bar */
.stats-bar {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.stat {
  background: var(--stat-bg);
  padding: 1.25rem 1rem;
  text-align: center;
  transition: all 0.2s ease;
  border: 1px solid var(--border);
  border-radius: 8px;
  position: relative;
  overflow: hidden;
}

.stat::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--blue), var(--purple));
  transform: scaleX(0);
  transition: transform 0.3s ease;
}

.stat:hover::before {
  transform: scaleX(1);
}

.stat:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.stat-value {
  font-size: 1.75rem;
  font-weight: 700;
  font-feature-settings: 'tnum';
  font-variant-numeric: tabular-nums;
  color: var(--blue);
}

.stat-label {
  font-size: 0.75rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 0.25rem;
}

/* Main Content */
.main-content {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
  gap: 2rem;
  margin-bottom: 2rem;
}

.section {
  border: 1px solid var(--border);
  background: var(--bg-secondary);
  transition: all 0.2s ease;
  border-radius: 8px;
  overflow: hidden;
}

.section:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.section-header {
  padding: 1rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-primary);
  background: linear-gradient(135deg, rgba(54, 145, 255, 0.05), rgba(130, 63, 241, 0.05));
}

.section-content {
  padding: 0.5rem 0;
}

.endpoint {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  transition: background 0.15s ease;
}

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

.method {
  font-size: 0.625rem;
  font-weight: 600;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  min-width: 42px;
  text-align: center;
  background: var(--method-bg);
  border: 1px solid;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.method:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.method.copied {
  animation: copyPulse 0.6s ease;
}

@keyframes copyPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}

.method.GET {
  color: var(--green);
  border-color: var(--green);
  background: rgba(35, 151, 74, 0.1);
}

.method.POST {
  color: var(--orange);
  border-color: var(--orange);
  background: rgba(223, 99, 28, 0.1);
}

.method.DELETE {
  color: var(--red);
  border-color: var(--red);
  background: rgba(213, 39, 83, 0.1);
}

[data-theme="dark"] .method {
  background: var(--method-bg);
}

[data-theme="dark"] .method.GET {
  background: rgba(63, 197, 107, 0.1);
}

[data-theme="dark"] .method.POST {
  background: rgba(255, 147, 106, 0.1);
}

[data-theme="dark"] .method.DELETE {
  background: rgba(255, 100, 128, 0.1);
}

.endpoint-path {
  font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Fira Code', monospace;
  font-size: 0.8125rem;
  color: var(--text-secondary);
  transition: color 0.15s ease;
  text-decoration: none;
}

a.endpoint-path {
  cursor: pointer;
}

a.endpoint-path:hover {
  color: var(--blue);
  text-decoration: underline;
}

/* Quick Links */
.quick-links {
  display: flex;
  gap: 1rem;
  padding: 1rem 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  margin-bottom: 2rem;
}

.link-button {
  font-size: 0.875rem;
  color: var(--text-secondary);
  text-decoration: none;
  transition: all 0.15s ease;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
}

.link-button:hover {
  color: var(--blue);
  background: var(--bg-hover);
}

/* Footer */
.footer {
  text-align: center;
  padding: 2rem 0 1rem;
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.footer a {
  color: var(--blue);
  text-decoration: none;
  transition: color 0.15s ease;
}

.footer a:hover {
  color: var(--purple);
  text-decoration: underline;
}

/* Responsive */
@media (max-width: 768px) {
  .container {
    padding: 1rem;
  }

  .header {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
  }

  .header-right {
    width: 100%;
    justify-content: space-between;
  }

  .stats-bar {
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
  }

  .main-content {
    grid-template-columns: 1fr;
  }

  .quick-links {
    flex-wrap: wrap;
  }
}

/* Subtle animations */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.stat {
  animation: fadeIn 0.4s ease backwards;
}

.stat:nth-child(1) {
  animation-delay: 0.05s;
}

.stat:nth-child(2) {
  animation-delay: 0.1s;
}

.stat:nth-child(3) {
  animation-delay: 0.15s;
}

.stat:nth-child(4) {
  animation-delay: 0.2s;
}

/* Compact list mode */
.endpoint-group {
  margin-bottom: 0.5rem;
}

.endpoint-group-title {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-muted);
  padding: 0.5rem 1rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Monospace numbers */
.mono {
  font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Fira Code', monospace;
  font-feature-settings: 'tnum';
  font-variant-numeric: tabular-nums;
}

/* Copy feedback */
.copied {
  position: relative;
}

.copied::after {
  content: '✓ Copied';
  position: absolute;
  top: -1.5rem;
  left: 0;
  font-size: 0.7rem;
  color: var(--green);
  background: var(--bg-secondary);
  padding: 0.25rem 0.5rem;
  border: 1px solid var(--green);
  border-radius: 4px;
  animation: fadeOut 1s ease forwards;
  font-weight: 600;
}

@keyframes fadeOut {
  0% {
    opacity: 0;
    transform: translateY(0.25rem);
  }

  20% {
    opacity: 1;
    transform: translateY(0);
  }

  80% {
    opacity: 1;
    transform: translateY(0);
  }

  100% {
    opacity: 0;
    transform: translateY(-0.25rem);
  }
}

/* Theme transition for all elements */
* {
  transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

/* Loading animation */
.loading-dot {
  display: inline-block;
  width: 4px;
  height: 4px;
  background: var(--blue);
  border-radius: 50%;
  animation: loading 1.4s infinite;
  margin: 0 2px;
}

.loading-dot:nth-child(2) {
  animation-delay: 0.2s;
}

.loading-dot:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes loading {

  0%,
  60%,
  100% {
    transform: translateY(0);
    opacity: 0.7;
  }

  30% {
    transform: translateY(-10px);
    opacity: 1;
  }
}
