:root {
  --bg-main: #090d16;
  --bg-card: rgba(15, 23, 42, 0.75);
  --bg-card-hover: rgba(30, 41, 59, 0.85);
  --border-color: rgba(255, 255, 255, 0.09);
  --border-focus: rgba(16, 185, 129, 0.5);
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --emerald: #10b981;
  --emerald-glow: rgba(16, 185, 129, 0.25);
  --cyan: #06b6d4;
  --blue: #3b82f6;
  --violet: #8b5cf6;
  --amber: #f59e0b;
  --red: #ef4444;
  --font-main: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
}

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

body {
  font-family: var(--font-main);
  background: radial-gradient(circle at 10% 10%, rgba(13, 148, 136, 0.08), transparent 30%),
              radial-gradient(circle at 90% 20%, rgba(59, 130, 246, 0.08), transparent 35%),
              var(--bg-main);
  color: var(--text-main);
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* Ecosystem & Language Banner */
.ecosystem-banner {
  background: rgba(15, 23, 42, 0.95);
  border-bottom: 1px solid var(--border-color);
  padding: 6px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.78rem;
  backdrop-filter: blur(8px);
  flex-wrap: wrap;
  gap: 8px;
}

.banner-left {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.pulse-dot {
  width: 8px;
  height: 8px;
  background: var(--emerald);
  border-radius: 50%;
  box-shadow: 0 0 10px var(--emerald);
  animation: pulseAnim 2s infinite;
}

@keyframes pulseAnim {
  0% { transform: scale(0.95); opacity: 0.7; }
  50% { transform: scale(1.2); opacity: 1; }
  100% { transform: scale(0.95); opacity: 0.7; }
}

.banner-label {
  color: var(--text-muted);
  font-weight: 500;
  margin-right: 4px;
}

.badge-app {
  padding: 2px 8px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 4px;
  color: var(--text-muted);
}

.badge-app.active {
  background: rgba(16, 185, 129, 0.15);
  border-color: rgba(16, 185, 129, 0.4);
  color: var(--emerald);
  font-weight: 600;
}

.banner-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.locale-selector {
  display: flex;
  align-items: center;
  gap: 8px;
}

.locale-badge {
  background: rgba(6, 182, 212, 0.12);
  border: 1px solid rgba(6, 182, 212, 0.3);
  color: var(--cyan);
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.72rem;
  font-family: var(--font-mono);
}

.locale-selector select {
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 0.75rem;
  outline: none;
  cursor: pointer;
}

.endpoint-status {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-muted);
}

.status-indicator.online {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--emerald);
}

/* Main Header */
.main-header {
  background: rgba(15, 23, 42, 0.7);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-color);
  padding: 14px 24px;
}

.header-container {
  max-width: 1440px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-logo {
  display: flex;
  align-items: center;
  filter: drop-shadow(0 0 12px var(--emerald-glow));
}

.brand-title {
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 8px;
}

.tag-version {
  font-size: 0.68rem;
  background: rgba(16, 185, 129, 0.15);
  color: var(--emerald);
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid rgba(16, 185, 129, 0.3);
  font-family: var(--font-mono);
}

.brand-subtitle {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.public-nav-links {
  display: flex;
  align-items: center;
  gap: 20px;
}

.public-nav-links a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.84rem;
  font-weight: 500;
  transition: color 0.2s;
}

.public-nav-links a:hover {
  color: var(--text-main);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 14px;
}

.guest-actions, .tenant-actions, .admin-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.badge-admin {
  background: rgba(245, 158, 11, 0.2);
  color: var(--amber);
  border: 1px solid rgba(245, 158, 11, 0.4);
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.05em;
}

.env-selector {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 3px;
  display: flex;
  gap: 4px;
}

.env-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 0.8rem;
  padding: 5px 12px;
  border-radius: 4px;
  cursor: pointer;
  font-weight: 500;
  transition: all 0.2s ease;
}

.env-btn.active {
  background: rgba(16, 185, 129, 0.2);
  color: var(--emerald);
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.2);
}

.tenant-profile {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  transition: all 0.2s;
}

.tenant-profile:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--border-color);
}

.tenant-avatar {
  width: 34px;
  height: 34px;
  background: linear-gradient(135deg, #059669, #2563eb);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.82rem;
  font-weight: 700;
  color: #fff;
}

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

.tenant-name {
  font-size: 0.84rem;
  font-weight: 600;
}

.tenant-plan {
  font-size: 0.7rem;
  color: var(--text-muted);
}

/* Sub Navigation */
.sub-nav {
  background: rgba(10, 16, 28, 0.6);
  border-bottom: 1px solid var(--border-color);
  padding: 0 24px;
}

.nav-container {
  max-width: 1440px;
  margin: 0 auto;
  display: flex;
  gap: 4px;
  overflow-x: auto;
}

.nav-tab {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 12px 16px;
  font-size: 0.84rem;
  font-weight: 500;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s;
  white-space: nowrap;
}

.nav-tab:hover {
  color: var(--text-main);
}

.nav-tab.active {
  color: var(--emerald);
  border-bottom-color: var(--emerald);
  font-weight: 600;
}

/* Content Area */
.content-wrapper {
  max-width: 1440px;
  margin: 0 auto;
  padding: 24px;
}

.tab-content, .admin-tab-content {
  display: none;
}

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

/* Cards & Glassmorphism */
.glass {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
}

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

.card-header h3 {
  font-size: 1.05rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-body {
  padding: 24px;
}

/* Metrics Grid */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px;
}

.metric-card {
  padding: 20px;
}

.metric-header {
  display: flex;
  justify-content: space-between;
  color: var(--text-muted);
  font-size: 0.82rem;
  font-weight: 500;
}

.metric-value {
  font-size: 1.8rem;
  font-weight: 800;
  margin: 10px 0 4px;
  letter-spacing: -0.02em;
}

.metric-desc {
  font-size: 0.74rem;
  color: var(--text-muted);
}

.text-gradient {
  background: linear-gradient(90deg, #10b981, #06b6d4);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.text-emerald { color: var(--emerald); }
.text-cyan { color: var(--cyan); }
.text-amber { color: var(--amber); }
.text-red { color: var(--red); }
.text-muted { color: var(--text-muted); }
.text-center { text-align: center; }

/* Landing Page Hero */
.landing-hero {
  padding: 60px 40px;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.3);
  padding: 6px 16px;
  border-radius: 20px;
  font-size: 0.82rem;
  color: var(--emerald);
  margin-bottom: 24px;
}

.hero-title {
  font-size: 2.8rem;
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.03em;
  max-width: 900px;
  margin: 0 auto 18px;
  background: linear-gradient(135deg, #ffffff 40%, #a7f3d0 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-desc {
  font-size: 1.1rem;
  color: var(--text-muted);
  max-width: 760px;
  margin: 0 auto 32px;
  line-height: 1.6;
}

.hero-cta-group {
  display: flex;
  justify-content: center;
  gap: 14px;
  flex-wrap: wrap;
}

.btn-hero-primary {
  background: linear-gradient(135deg, #059669, #0d9488);
  border: none;
  color: white;
  padding: 14px 28px;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 1rem;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(16, 185, 129, 0.35);
  transition: all 0.2s;
}

.btn-hero-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 28px rgba(16, 185, 129, 0.5);
}

.btn-hero-secondary {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border-color);
  color: white;
  padding: 14px 24px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-hero-secondary:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: var(--emerald);
}

.btn-hero-outline {
  background: transparent;
  border: 1px solid rgba(245, 158, 11, 0.4);
  color: var(--amber);
  padding: 14px 20px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.92rem;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-hero-outline:hover {
  background: rgba(245, 158, 11, 0.15);
}

.hero-stats-ribbon {
  display: flex;
  justify-content: space-around;
  align-items: center;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px 24px;
  max-width: 960px;
  margin-left: auto;
  margin-right: auto;
  flex-wrap: wrap;
  gap: 16px;
}

.ribbon-item {
  display: flex;
  flex-direction: column;
}

.ribbon-item strong {
  font-size: 1.15rem;
  color: #fff;
}

.ribbon-item span {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.ribbon-divider {
  width: 1px;
  height: 28px;
  background: var(--border-color);
}

/* Features Grid */
.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 20px;
}

.feature-card {
  padding: 24px;
  transition: transform 0.2s, border-color 0.2s;
}

.feature-card:hover {
  transform: translateY(-4px);
  border-color: rgba(16, 185, 129, 0.4);
}

.feature-icon {
  font-size: 2rem;
  margin-bottom: 12px;
}

.feature-card h3 {
  font-size: 1.05rem;
  margin-bottom: 8px;
}

.feature-card p {
  font-size: 0.84rem;
  color: var(--text-muted);
  line-height: 1.5;
}

/* Pricing Grid */
.pricing-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 24px;
}

.pricing-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 32px 24px;
  display: flex;
  flex-direction: column;
  position: relative;
  transition: all 0.2s;
}

.pricing-card.popular {
  border-color: var(--emerald);
  box-shadow: 0 0 24px rgba(16, 185, 129, 0.2);
}

.popular-badge {
  position: absolute;
  top: -12px;
  right: 24px;
  background: var(--emerald);
  color: #000;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 12px;
}

.plan-name {
  font-size: 1.2rem;
  font-weight: 700;
}

.plan-target {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.plan-price-box {
  margin: 20px 0;
}

.plan-price {
  font-size: 2.2rem;
  font-weight: 800;
  color: #fff;
}

.plan-period {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.plan-quota-info {
  font-size: 0.82rem;
  color: var(--cyan);
  margin-bottom: 20px;
}

.plan-features-list {
  list-style: none;
  margin-bottom: 28px;
  flex: 1;
}

.plan-features-list li {
  font-size: 0.84rem;
  color: var(--text-main);
  padding: 6px 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.plan-features-list li::before {
  content: '✓';
  color: var(--emerald);
  font-weight: bold;
}

/* Plugins Hub Grid */
.plugins-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 20px;
}

.plugin-card {
  padding: 24px;
}

.plugin-logo {
  font-size: 2rem;
  margin-bottom: 10px;
}

.plugin-card h3, .plugin-card h4 {
  font-size: 1.05rem;
  margin-bottom: 6px;
}

.plugin-card p {
  font-size: 0.84rem;
  color: var(--text-muted);
  line-height: 1.5;
}

/* Form Controls */
.form-group label {
  display: block;
  font-size: 0.82rem;
  font-weight: 500;
  margin-bottom: 6px;
  color: var(--text-muted);
}

.form-control {
  width: 100%;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 9px 14px;
  color: var(--text-main);
  font-size: 0.85rem;
  outline: none;
  font-family: var(--font-main);
  transition: border-color 0.2s;
}

.form-control:focus {
  border-color: var(--emerald);
}

/* Code Editor & Viewer */
.code-editor, .code-viewer {
  width: 100%;
  background: #060913;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-sm);
  padding: 14px;
  color: #e2e8f0;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  line-height: 1.6;
  outline: none;
  resize: vertical;
}

.code-viewer {
  min-height: 280px;
  max-height: 480px;
  overflow: auto;
  white-space: pre-wrap;
}

/* API Target Bar */
.api-target-bar {
  display: flex;
  align-items: center;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 6px 12px;
  gap: 12px;
}

.http-method {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 0.78rem;
  padding: 3px 8px;
  border-radius: 4px;
}

.http-method.post {
  background: rgba(16, 185, 129, 0.2);
  color: var(--emerald);
}

.http-url {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  flex: 1;
}

/* Buttons */
.btn-primary {
  background: linear-gradient(135deg, #059669, #0d9488);
  border: none;
  color: white;
  padding: 8px 18px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.3);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(16, 185, 129, 0.4);
}

.btn-block {
  width: 100%;
}

.btn-outline {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-outline:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--emerald);
}

.btn-danger {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.4);
  color: var(--red);
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 0.75rem;
  cursor: pointer;
}

.btn-danger:hover {
  background: rgba(239, 68, 68, 0.3);
}

.btn-subtle {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  font-size: 0.78rem;
  padding: 4px 10px;
  border-radius: 4px;
  cursor: pointer;
}

.btn-subtle:hover {
  color: var(--text-main);
  border-color: rgba(255, 255, 255, 0.2);
}

.btn-sm {
  padding: 4px 10px;
  font-size: 0.75rem;
}

.tab-labels {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.latency-text {
  color: var(--emerald);
  font-family: var(--font-mono);
}

/* Badges */
.badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 0.72rem;
  font-weight: 600;
}

.badge-emerald {
  background: rgba(16, 185, 129, 0.15);
  color: var(--emerald);
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.badge-cyan {
  background: rgba(6, 182, 212, 0.15);
  color: var(--cyan);
  border: 1px solid rgba(6, 182, 212, 0.3);
}

/* Modals */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 16px;
}

.modal-card {
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 0;
}

.modal-card.modal-lg {
  max-width: 760px;
}

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

.modal-header h3 {
  font-size: 1.1rem;
}

.modal-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.2rem;
  cursor: pointer;
}

.modal-body {
  padding: 24px;
}

.legal-content {
  font-size: 0.88rem;
  line-height: 1.6;
  color: #cbd5e1;
}

.legal-content h4 {
  color: #fff;
}

.demo-login-box {
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--border-color);
  padding: 12px;
  border-radius: var(--radius-sm);
}

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

/* Tables */
.table-responsive {
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}

.data-table th {
  text-align: left;
  padding: 12px 14px;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-color);
  font-weight: 600;
  background: rgba(0, 0, 0, 0.2);
}

.data-table td {
  padding: 12px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.data-table tr:hover {
  background: rgba(255, 255, 255, 0.02);
}

/* Layout helpers */
.grid-2-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

@media (max-width: 992px) {
  .grid-2-col {
    grid-template-columns: 1fr;
  }
}

.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 14px; }
.mt-4 { margin-top: 20px; }
.mt-6 { margin-top: 28px; }
.hidden { display: none !important; }

.divider {
  border: none;
  border-top: 1px solid var(--border-color);
}

/* Footer */
.app-footer {
  margin-top: 40px;
  padding: 24px;
  border-top: 1px solid var(--border-color);
  font-size: 0.78rem;
  color: var(--text-muted);
}

.footer-content {
  max-width: 1440px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}

.footer-links a {
  color: var(--text-muted);
  text-decoration: none;
}

.footer-links a:hover {
  color: var(--text-main);
}
