/* CSS Variables for Light and Dark Mode */
:root {
  /* Light Mode Colors */
  --bg-primary: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  --bg-secondary: #ffffff;
  --bg-glass: rgba(255, 255, 255, 0.25);
  --bg-overlay: rgba(255, 255, 255, 0.9);
  --text-primary: #1e293b;
  --text-secondary: #64748b;
  --text-accent: #3b82f6;
  --accent-primary: #667eea;
  --accent-secondary: #764ba2;
  --accent-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  --border-color: rgba(255, 255, 255, 0.3);
  --shadow-light: rgba(0, 0, 0, 0.1);
  --shadow-medium: rgba(0, 0, 0, 0.15);
  --shadow-strong: rgba(0, 0, 0, 0.25);
  --glow-color: rgba(102, 126, 234, 0.6);
  --card-bg: rgba(255, 255, 255, 0.9);
  --code-bg: rgba(248, 249, 250, 0.9);
  --success-color: #28a745;
  --error-color: #dc3545;
  --warning-color: #ffc107;
}

/* Dark Mode Colors */
body.dark-mode {
  --bg-primary: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
  --bg-secondary: #1e293b;
  --bg-glass: rgba(30, 41, 59, 0.25);
  --bg-overlay: rgba(30, 41, 59, 0.9);
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-accent: #60a5fa;
  --accent-primary: #60a5fa;
  --accent-secondary: #a78bfa;
  --accent-gradient: linear-gradient(135deg, #60a5fa 0%, #a78bfa 100%);
  --border-color: rgba(255, 255, 255, 0.1);
  --shadow-light: rgba(0, 0, 0, 0.3);
  --shadow-medium: rgba(0, 0, 0, 0.5);
  --shadow-strong: rgba(0, 0, 0, 0.8);
  --glow-color: rgba(96, 165, 250, 0.6);
  --card-bg: rgba(30, 41, 59, 0.9);
  --code-bg: rgba(15, 23, 42, 0.9);
  --success-color: #10b981;
  --error-color: #ef4444;
  --warning-color: #f59e0b;
}

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  overflow-x: hidden;
  transition: all 0.3s ease;
  opacity: 0;
  animation: fadeIn 0.8s ease forwards;
  min-height: 100vh;
}

body.loaded {
  opacity: 1;
}

@keyframes fadeIn {
  to {
    opacity: 1;
  }
}

/* Animated Background */
.bg-animation {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  overflow: hidden;
}

.floating-shapes {
  position: absolute;
  width: 100%;
  height: 100%;
}

.floating-shapes::before,
.floating-shapes::after {
  content: '';
  position: absolute;
  border-radius: 50%;
  background: var(--accent-gradient);
  opacity: 0.05;
  animation: float 20s infinite ease-in-out;
}

.floating-shapes::before {
  width: 400px;
  height: 400px;
  top: -200px;
  right: -200px;
  animation-delay: 0s;
}

.floating-shapes::after {
  width: 300px;
  height: 300px;
  bottom: -150px;
  left: -150px;
  animation-delay: 10s;
}

@keyframes float {
  0%, 100% {
    transform: translate(0, 0) rotate(0deg);
  }
  33% {
    transform: translate(30px, -30px) rotate(120deg);
  }
  66% {
    transform: translate(-20px, 20px) rotate(240deg);
  }
}

@keyframes subtle-bob {
  0% {
    transform: translateY(0px);
  }
  50% {
    transform: translateY(-6px);
  }
  100% {
    transform: translateY(0px);
  }
}

/* Theme Toggle */
.theme-toggle {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 9999;
  background: var(--bg-glass);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border-color);
  border-radius: 50px;
  width: 50px;
  height: 25px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 4px;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px var(--shadow-light);
}

.theme-toggle:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 25px var(--shadow-strong), 0 0 20px var(--glow-color);
  border-color: var(--accent-primary);
}

.sun-icon, .moon-icon {
  font-size: 16px;
  transition: all 0.3s ease;
  filter: drop-shadow(0 2px 4px var(--shadow-light));
}

.moon-icon {
  display: none;
}

/* Container */
.container {
  max-width: 95%;
  margin: 40px auto;
  background: var(--bg-overlay);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  padding: 40px;
  box-shadow: 0 20px 40px var(--shadow-medium);
  position: relative;
  z-index: 1;
}

/* Headers */
h1 {
  color: var(--text-primary);
  text-align: center;
  margin-bottom: 40px;
  font-size: 2.5rem;
  font-weight: 700;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  position: relative;
}

h1::after {
  content: '';
  position: absolute;
  bottom: -10px;
  left: 50%;
  transform: translateX(-50%);
  width: 100px;
  height: 3px;
  background: var(--accent-gradient);
  border-radius: 2px;
}

h2 {
  color: var(--accent-primary);
  margin-top: 40px;
  margin-bottom: 20px;
  font-size: 1.8rem;
  font-weight: 600;
  position: relative;
  padding-left: 20px;
}

h2::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 8px;
  height: 8px;
  background: var(--accent-gradient);
  border-radius: 50%;
}

h3 {
  color: var(--text-primary);
  margin-top: 30px;
  margin-bottom: 15px;
  font-size: 1.4rem;
  font-weight: 600;
}

/* Table of Contents */
.toc {
  background: var(--bg-glass);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border-color);
  border-radius: 15px;
  padding: 25px;
  margin-bottom: 30px;
  position: relative;
  overflow: hidden;
}

.toc::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--accent-gradient);
}

.toc h2 {
  margin-top: 0;
  margin-bottom: 20px;
  color: var(--text-primary);
  font-size: 1.5rem;
}

.toc h2::before {
  display: none;
}

.toc ul {
  padding-left: 0;
  list-style: none;
}

.toc li {
  margin: 10px 0;
}

.toc a {
  color: var(--text-secondary);
  text-decoration: none;
  transition: all 0.3s ease;
  padding: 8px 12px;
  border-radius: 8px;
  display: block;
  position: relative;
}

.toc a::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 0;
  background: var(--accent-gradient);
  border-radius: 2px;
  transition: height 0.3s ease;
}

.toc a:hover {
  color: var(--accent-primary);
  background: var(--bg-glass);
  transform: translateX(5px);
}

.toc a:hover::before {
  height: 70%;
}

/* Sections */
section {
  margin-bottom: 50px;
  padding: 30px;
  background: var(--bg-glass);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border-color);
  border-radius: 15px;
  transition: all 0.3s ease;
  box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.1);
  transform-style: preserve-3d;
}

section:hover {
  transform: translateY(-10px) rotateX(5deg);
  box-shadow: 0 0 30px var(--glow-color), 0 10px 20px var(--shadow-strong);
}

/* Endpoints */
.endpoint {
  background: var(--bg-glass);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border-color);
  border-radius: 15px;
  padding: 25px;
  margin-bottom: 25px;
  position: relative;
  overflow: hidden;
  transition: all 0.3s ease;
}

.endpoint::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: var(--accent-gradient);
}

.endpoint:hover {
  transform: translateY(-3px);
  box-shadow: 0 15px 35px var(--shadow-medium);
}

.endpoint h3 {
  margin-top: 0;
  color: var(--text-primary);
}

/* Method Badges */
.method {
  display: inline-block;
  padding: 6px 12px;
  border-radius: 20px;
  color: white;
  font-weight: 600;
  margin-right: 12px;
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  transition: all 0.3s ease;
}

.method:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.3);
}

.get { 
  background: linear-gradient(135deg, #28a745, #20c997);
}

.post { 
  background: linear-gradient(135deg, #007bff, #6610f2);
}

.path {
  font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Roboto Mono', monospace;
  background: var(--code-bg);
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 16px;
  border: 1px solid var(--border-color);
  transition: all 0.3s ease;
}

.path:hover {
  background: var(--accent-primary);
  color: white;
  transform: scale(1.05);
}

/* Tables */
table {
  width: 100%;
  border-collapse: collapse;
  margin: 20px 0;
  background: var(--bg-glass);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  overflow: hidden;
}

th, td {
  padding: 15px;
  text-align: left;
  border-bottom: 1px solid var(--border-color);
  transition: all 0.3s ease;
}

th {
  background: var(--accent-gradient);
  color: white;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-size: 14px;
}

tr:hover td {
  background: var(--bg-glass);
  transform: scale(1.01);
}

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

/* Code Blocks */
.example, .response {
  background: var(--code-bg);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 20px;
  margin: 20px 0;
  font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Roboto Mono', monospace;
  white-space: pre-wrap;
  overflow-x: auto;
  position: relative;
  transition: all 0.3s ease;
}

.example:hover, .response:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 25px var(--shadow-medium);
}

.example::before, .response::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--accent-gradient);
  border-radius: 12px 12px 0 0;
}

/* Notes */
.note {
  background: linear-gradient(135deg, rgba(255, 193, 7, 0.1), rgba(255, 193, 7, 0.05));
  border-left: 4px solid var(--warning-color);
  padding: 15px 20px;
  margin: 20px 0;
  border-radius: 0 12px 12px 0;
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 193, 7, 0.2);
  transition: all 0.3s ease;
}

.note:hover {
  transform: translateX(5px);
  box-shadow: 0 5px 15px rgba(255, 193, 7, 0.2);
}

/* Tabs */
.tab {
  overflow: hidden;
  background: var(--bg-glass);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border-color);
  border-radius: 12px 12px 0 0;
  display: flex;
  margin-bottom: 0;
}

.tab button {
  background: transparent;
  border: none;
  outline: none;
  cursor: pointer;
  padding: 15px 20px;
  transition: all 0.3s ease;
  font-size: 16px;
  font-weight: 500;
  color: var(--text-secondary);
  flex: 1;
  position: relative;
}

.tab button::before {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--accent-gradient);
  transform: scaleX(0);
  transition: transform 0.3s ease;
}

.tab button:hover {
  background: var(--bg-glass);
  color: var(--text-primary);
}

.tab button.active {
  background: var(--bg-glass);
  color: var(--accent-primary);
}

.tab button.active::before {
  transform: scaleX(1);
}

.tabcontent {
  display: none;
  padding: 25px;
  border: 1px solid var(--border-color);
  border-top: none;
  border-radius: 0 0 12px 12px;
  background: var(--bg-glass);
  backdrop-filter: blur(20px);
  animation: slideIn 0.3s ease;
}

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

/* Description */
.description {
  margin: 20px 0;
  padding: 15px;
  background: var(--bg-glass);
  border-radius: 8px;
  border-left: 3px solid var(--accent-primary);
}

/* Parameters */
.parameters {
  margin: 25px 0;
}

.parameters h4 {
  color: var(--accent-primary);
  margin-bottom: 15px;
  font-size: 1.2rem;
}

/* Responsive Design */
@media (max-width: 768px) {
  .container {
    margin: 20px 40px;
    padding: 20px;
  }
  
  h1 {
    font-size: 2rem;
  }
  
  h2 {
    font-size: 1.5rem;
  }
  
  .tab {
    flex-direction: column;
  }
  
  .tab button {
    border-bottom: 1px solid var(--border-color);
  }
  
  .tab button:last-child {
    border-bottom: none;
  }
  
  table {
    font-size: 14px;
  }
  
  th, td {
    padding: 10px;
  }
}

/* Performance Optimizations */
.endpoint,
section,
.tabcontent {
  will-change: transform;
}

/* Reduce motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}