/* Token System & Variables */
:root {
  --font-title: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  
  --bg-main: #060913;
  --bg-card: rgba(15, 22, 42, 0.45);
  --bg-card-hover: rgba(20, 30, 55, 0.55);
  --border-color: rgba(255, 255, 255, 0.08);
  --border-hover: rgba(255, 255, 255, 0.15);
  
  --color-primary: #3b82f6;
  --color-secondary: #8b5cf6;
  --color-accent: #ec4899;
  --color-success: #10b981;
  --color-text-main: #f8fafc;
  --color-text-muted: #94a3b8;
  
  --transition-speed: 0.3s;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

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

body {
  background-color: var(--bg-main);
  color: var(--color-text-main);
  font-family: var(--font-body);
  overflow-x: hidden;
  min-height: 100vh;
  position: relative;
}

/* Background Glow Effects */
.bg-glow {
  position: absolute;
  top: -10%;
  left: 50%;
  transform: translateX(-50%);
  width: 90vw;
  height: 60vh;
  background: radial-gradient(circle, rgba(139, 92, 246, 0.15) 0%, rgba(59, 130, 246, 0.08) 40%, rgba(0, 0, 0, 0) 70%);
  z-index: -1;
  pointer-events: none;
  filter: blur(80px);
}

.app-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Header */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 3.5rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.logo-wrapper {
  width: 42px;
  height: 42px;
}

.logo {
  width: 100%;
  height: 100%;
}

.brand-text {
  display: flex;
  flex-direction: column;
}

.brand-name {
  font-family: var(--font-title);
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  background: linear-gradient(90deg, #fff 0%, var(--color-text-muted) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-subtitle {
  font-size: 0.75rem;
  color: var(--color-text-muted);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.header-status {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(255, 255, 255, 0.04);
  padding: 0.5rem 1rem;
  border-radius: 9999px;
  border: 1px solid var(--border-color);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.status-dot.green {
  background-color: var(--color-success);
  box-shadow: 0 0 10px var(--color-success);
}

.status-text {
  font-size: 0.85rem;
  font-weight: 500;
  color: #e2e8f0;
}

/* Hero Section */
.hero-section {
  text-align: center;
  max-width: 800px;
  margin: 0 auto 4rem;
}

.hero-title {
  font-family: var(--font-title);
  font-size: clamp(2.5rem, 5vw, 4rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.1;
  margin-bottom: 1.5rem;
}

.gradient-text {
  background: linear-gradient(135deg, #60a5fa 0%, #a78bfa 50%, #f472b6 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-desc {
  font-size: clamp(1rem, 2vw, 1.15rem);
  line-height: 1.6;
  color: var(--color-text-muted);
}

/* Grid & Cards */
.grid-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  margin-bottom: 2.5rem;
}

@media (max-width: 768px) {
  .grid-container {
    grid-template-columns: 1fr;
  }
}

.glass-card {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-color);
  border-radius: 1.25rem;
  padding: 2.25rem;
  transition: all var(--transition-speed) var(--ease);
}

.glass-card:hover {
  border-color: var(--border-hover);
  background: var(--bg-card-hover);
  transform: translateY(-2px);
}

.card-title {
  font-family: var(--font-title);
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  letter-spacing: -0.01em;
}

.card-subtitle {
  font-size: 0.95rem;
  color: var(--color-text-muted);
  margin-bottom: 2rem;
  line-height: 1.5;
}

/* Scope Selector */
.scope-selector {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-bottom: 2rem;
}

.scope-item {
  cursor: pointer;
  position: relative;
}

.scope-item input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.scope-box {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  padding: 1.25rem;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-color);
  border-radius: 0.85rem;
  transition: all 0.2s var(--ease);
}

.scope-icon {
  font-size: 1.5rem;
  background: rgba(255, 255, 255, 0.04);
  padding: 0.5rem;
  border-radius: 0.5rem;
  border: 1px solid var(--border-color);
}

.scope-info {
  display: flex;
  flex-direction: column;
}

.scope-name {
  font-family: var(--font-title);
  font-weight: 600;
  font-size: 1.05rem;
  color: var(--color-text-main);
  margin-bottom: 0.25rem;
}

.scope-desc {
  font-size: 0.82rem;
  color: var(--color-text-muted);
  line-height: 1.4;
}

.scope-item input:checked + .scope-box {
  border-color: rgba(139, 92, 246, 0.5);
  background: rgba(139, 92, 246, 0.05);
}

.scope-item input:checked + .scope-box .scope-icon {
  background: rgba(139, 92, 246, 0.15);
  border-color: rgba(139, 92, 246, 0.3);
}

/* Primary Button */
.btn-primary {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-secondary) 100%);
  border: none;
  border-radius: 0.85rem;
  padding: 1.1rem;
  color: white;
  font-family: var(--font-title);
  font-size: 1.1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s var(--ease);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 25px -5px rgba(139, 92, 246, 0.4);
}

.btn-arrow {
  width: 18px;
  height: 18px;
  transition: transform 0.2s var(--ease);
}

.btn-primary:hover .btn-arrow {
  transform: translateX(4px);
}

/* Connected Accounts List */
.connections-list {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  max-height: 480px;
  overflow-y: auto;
  padding-right: 0.5rem;
}

.connection-card {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-color);
  border-radius: 0.85rem;
  padding: 1.25rem;
  transition: border-color 0.2s var(--ease);
}

.connection-card:hover {
  border-color: rgba(255, 255, 255, 0.12);
}

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

.conn-email {
  font-family: var(--font-title);
  font-weight: 600;
  font-size: 1.1rem;
  word-break: break-all;
}

.conn-badge {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  background: rgba(16, 185, 129, 0.1);
  color: var(--color-success);
  padding: 0.25rem 0.6rem;
  border-radius: 9999px;
  border: 1px solid rgba(16, 185, 129, 0.2);
}

.conn-scopes {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.scope-badge {
  font-size: 0.75rem;
  background: rgba(255, 255, 255, 0.04);
  color: var(--color-text-muted);
  padding: 0.2rem 0.5rem;
  border-radius: 0.25rem;
  border: 1px solid var(--border-color);
}

.conn-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 1px solid rgba(255, 255, 255, 0.04);
  padding-top: 0.75rem;
  font-size: 0.78rem;
  color: var(--color-text-muted);
}

.conn-disconnect {
  background: transparent;
  border: none;
  color: #ef4444;
  font-size: 0.78rem;
  font-weight: 500;
  cursor: pointer;
  transition: opacity 0.2s;
}

.conn-disconnect:hover {
  opacity: 0.8;
  text-decoration: underline;
}

/* Loader & States */
.loader-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  padding: 4rem 0;
  color: var(--color-text-muted);
}

.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid rgba(255, 255, 255, 0.05);
  border-top-color: var(--color-secondary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 4rem 1.5rem;
}

.empty-icon {
  font-size: 3rem;
  margin-bottom: 1.25rem;
  opacity: 0.6;
}

.empty-state h3 {
  font-family: var(--font-title);
  font-size: 1.2rem;
  margin-bottom: 0.5rem;
}

.empty-state p {
  font-size: 0.88rem;
  color: var(--color-text-muted);
  max-width: 280px;
  line-height: 1.5;
}

.hidden {
  display: none !important;
}

/* SDK Docs */
.sdk-docs {
  margin-top: 1rem;
}

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

@media (max-width: 600px) {
  .docs-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
  }
}

.tabs-buttons {
  display: flex;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
  padding: 0.25rem;
  border-radius: 0.5rem;
}

.tab-btn {
  background: transparent;
  border: none;
  color: var(--color-text-muted);
  padding: 0.5rem 1rem;
  font-family: var(--font-title);
  font-weight: 500;
  font-size: 0.9rem;
  cursor: pointer;
  border-radius: 0.35rem;
  transition: all 0.2s;
}

.tab-btn.active {
  background: rgba(255, 255, 255, 0.08);
  color: white;
}

.tab-content {
  display: none;
}

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

.docs-intro {
  font-size: 0.95rem;
  color: var(--color-text-muted);
  margin-bottom: 1.25rem;
}

/* Code highlight */
pre {
  background: #030712;
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 0.75rem;
  padding: 1.5rem;
  overflow-x: auto;
  font-family: "Courier New", Courier, monospace;
  font-size: 0.9rem;
  line-height: 1.5;
}

.code-comment { color: #6b7280; }
.code-keyword { color: #f43f5e; }
.code-string { color: #10b981; }

/* Footer */
.app-footer {
  margin-top: auto;
  padding: 4rem 0 1rem;
  text-align: center;
  font-size: 0.82rem;
  color: rgba(255, 255, 255, 0.25);
  border-top: 1px solid rgba(255, 255, 255, 0.02);
}

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

.fade-in {
  animation: fadeIn 0.8s var(--ease) forwards;
}

.fade-in-up {
  opacity: 0;
  transform: translateY(20px);
  animation: fadeInUp 0.8s var(--ease) forwards;
}

.delay-1 { animation-delay: 0.15s; }
.delay-2 { animation-delay: 0.3s; }

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

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