:root {
  --bg-dark: #040810;
  --card-bg: rgba(10, 18, 32, 0.85);
  --card-border: rgba(0, 240, 255, 0.25);
  --sidebar-bg: rgba(6, 12, 22, 0.95);
  --cyan-primary: #00f0ff;
  --cyan-hover: #00c8d7;
  --cyan-glow: rgba(0, 240, 255, 0.35);
  --purple-accent: #a855f7;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --danger: #ef4444;
  --success: #10b981;
  --warning: #f59e0b;
  --radius-lg: 16px;
  --radius-md: 10px;
  --radius-sm: 6px;
}

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

body {
  background-color: var(--bg-dark);
  color: var(--text-main);
  font-family: 'Plus Jakarta Sans', sans-serif;
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
}

body.not-authenticated {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.hidden {
  display: none !important;
}

/* Background Cyber Atmosphere */
.bg-glow {
  position: fixed;
  top: -15%;
  left: 50%;
  transform: translateX(-50%);
  width: 700px;
  height: 500px;
  background: radial-gradient(circle, rgba(0, 240, 255, 0.15) 0%, rgba(168, 85, 247, 0.08) 50%, transparent 80%);
  filter: blur(80px);
  pointer-events: none;
  z-index: 0;
}

.cyber-grid {
  position: fixed;
  inset: 0;
  background-image: 
    linear-gradient(to right, rgba(255, 255, 255, 0.02) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
  background-size: 40px 40px;
  mask-image: radial-gradient(circle at 50% 50%, black 40%, transparent 80%);
  pointer-events: none;
  z-index: 0;
}

/* ======================================================== */
/* 1. AUTH CARD (PUBLIC GATE)                               */
/* ======================================================== */
.auth-container {
  width: 100%;
  max-width: 480px;
  position: relative;
  z-index: 2;
}

.auth-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  padding: 28px 32px 32px;
  backdrop-filter: blur(24px);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.7), 0 0 40px rgba(0, 240, 255, 0.1);
}

.auth-3d-header-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 8px;
}

.auth-3d-canvas-wrap {
  width: 120px;
  height: 120px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle, rgba(0, 240, 255, 0.12) 0%, transparent 70%);
  border-radius: 50%;
}

.auth-header-3d-canvas {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  cursor: grab;
  outline: none;
}

/* 👑 High-Impact Tagline */
.portal-tagline-box {
  text-align: center;
  margin-bottom: 20px;
}

.portal-tagline-title {
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, #ffffff 30%, var(--cyan-primary) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  line-height: 1.3;
}

.portal-tagline-sub {
  font-size: 0.76rem;
  color: var(--text-muted);
  margin-top: 4px;
}

.tab-switcher {
  display: flex;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-md);
  padding: 4px;
  margin-bottom: 24px;
  gap: 4px;
}

.tab-btn {
  flex: 1;
  padding: 8px 12px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s ease;
}

.tab-btn.active {
  background: rgba(0, 240, 255, 0.15);
  color: var(--cyan-primary);
  box-shadow: 0 0 12px rgba(0, 240, 255, 0.2);
}

.auth-view { display: none; }
.auth-view.active { display: block; animation: fadeIn 0.25s ease-out; }

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

.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.input-wrapper input, .custom-select {
  width: 100%;
  padding: 12px 14px;
  background: rgba(4, 8, 16, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-md);
  color: #fff;
  font-size: 0.9rem;
  font-family: inherit;
  transition: all 0.2s ease;
}

.custom-select {
  background-color: #040810;
  cursor: pointer;
}

.input-wrapper input:focus, .custom-select:focus {
  outline: none;
  border-color: var(--cyan-primary);
  box-shadow: 0 0 16px rgba(0, 240, 255, 0.25);
}

.input-icon {
  position: absolute;
  left: 12px;
  font-size: 0.9rem;
  opacity: 0.6;
}

.btn-toggle-pw {
  position: absolute;
  right: 12px;
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: 0.95rem;
  opacity: 0.6;
}

.btn-primary {
  padding: 11px 18px;
  background: linear-gradient(135deg, var(--cyan-primary), #00b4d8);
  border: none;
  border-radius: var(--radius-md);
  color: #040810;
  font-weight: 700;
  font-size: 0.88rem;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 4px 18px rgba(0, 240, 255, 0.3);
}

.btn-primary:hover {
  background: linear-gradient(135deg, #38f8ff, var(--cyan-primary));
  box-shadow: 0 6px 24px rgba(0, 240, 255, 0.45);
  transform: translateY(-1px);
}

.btn-secondary {
  padding: 10px 16px;
  background: rgba(0, 240, 255, 0.12);
  border: 1px solid var(--cyan-primary);
  color: var(--cyan-primary);
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 0.84rem;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-secondary:hover {
  background: var(--cyan-primary);
  color: #040810;
}

.btn-ghost {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 0.84rem;
  cursor: pointer;
  padding: 8px 12px;
}

.btn-ghost:hover {
  color: #fff;
}

.divider {
  display: flex;
  align-items: center;
  text-align: center;
  margin: 20px 0 16px;
  color: rgba(255, 255, 255, 0.3);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.divider::before, .divider::after {
  content: '';
  flex: 1;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.divider span { padding: 0 10px; }

.provider-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.btn-provider {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 11px 16px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-md);
  color: #f1f5f9;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-provider:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(0, 240, 255, 0.4);
}

.gate-notice {
  background: rgba(0, 240, 255, 0.06);
  border: 1px solid rgba(0, 240, 255, 0.25);
  border-radius: var(--radius-md);
  padding: 14px;
  margin-bottom: 18px;
}

.gate-notice.success {
  background: rgba(16, 185, 129, 0.08);
  border-color: rgba(16, 185, 129, 0.35);
}

.notice-badge {
  font-size: 0.68rem;
  font-weight: 800;
  color: var(--cyan-primary);
  letter-spacing: 0.05em;
  margin-bottom: 4px;
}

.gate-notice.success .notice-badge { color: var(--success); }

.gate-notice p {
  font-size: 0.78rem;
  color: #cbd5e1;
  line-height: 1.4;
}

.register-steps {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 16px;
}

.step-card {
  display: flex;
  align-items: center;
  gap: 14px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-md);
  padding: 12px;
  cursor: pointer;
  transition: all 0.2s;
}

.step-card:hover {
  background: rgba(0, 240, 255, 0.08);
  border-color: var(--cyan-primary);
}

.step-number {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(0, 240, 255, 0.15);
  color: var(--cyan-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
}

.step-info h3 { font-size: 0.86rem; color: #fff; }
.step-info p { font-size: 0.74rem; color: var(--text-muted); }
.step-info b { color: var(--cyan-primary); }
.step-arrow { margin-left: auto; color: var(--cyan-primary); }

.device-flow-box {
  background: rgba(0, 0, 0, 0.4);
  border: 1px dashed rgba(0, 240, 255, 0.35);
  border-radius: var(--radius-md);
  padding: 16px;
  text-align: center;
}

.code-display-box {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: rgba(0, 0, 0, 0.6);
  border: 1px solid rgba(0, 240, 255, 0.2);
  border-radius: var(--radius-md);
  padding: 10px;
  margin-bottom: 14px;
}

.device-code-highlight {
  font-family: 'JetBrains Mono', monospace;
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--cyan-primary);
}

.alert-box {
  padding: 10px 14px;
  border-radius: var(--radius-md);
  font-size: 0.8rem;
  font-weight: 600;
  margin-bottom: 16px;
}
.alert-box.hidden { display: none; }
.alert-box.error { background: rgba(239, 68, 68, 0.15); border: 1px solid var(--danger); color: #fca5a5; }
.alert-box.success { background: rgba(16, 185, 129, 0.15); border: 1px solid var(--success); color: #6ee7b7; }

/* ======================================================== */
/* 2. MEMBER AREA: DEVELOPER DASHBOARD LAYOUT               */
/* ======================================================== */
.dashboard-layout {
  display: flex;
  min-height: 100vh;
  position: relative;
  z-index: 2;
}

.dashboard-sidebar {
  width: 260px;
  background: var(--sidebar-bg);
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  flex-direction: column;
  padding: 24px 16px;
  backdrop-filter: blur(20px);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 32px;
  padding-left: 4px;
}

.sidebar-3d-canvas-wrap {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(0, 240, 255, 0.15) 0%, transparent 70%);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.sidebar-3d-canvas {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  cursor: grab;
}

.sidebar-brand-text h2 {
  font-size: 0.95rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  color: #fff;
}

.badge-router {
  font-size: 0.65rem;
  color: var(--cyan-primary);
  font-family: 'JetBrains Mono', monospace;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  text-align: left;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.04);
  color: #fff;
}

.nav-item.active {
  background: rgba(0, 240, 255, 0.12);
  color: var(--cyan-primary);
  border: 1px solid rgba(0, 240, 255, 0.25);
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-md);
  margin-top: auto;
}

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(0, 240, 255, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
}

.user-info {
  flex: 1;
  overflow: hidden;
}

.user-name {
  font-size: 0.82rem;
  font-weight: 700;
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
}

.user-role {
  font-size: 0.65rem;
  color: var(--cyan-primary);
  font-weight: 700;
}

.btn-logout {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1rem;
  transition: color 0.2s;
}

.btn-logout:hover {
  color: var(--danger);
}

/* Dashboard Content */
.dashboard-content {
  flex: 1;
  padding: 32px 40px;
  overflow-y: auto;
}

.dash-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 28px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding-bottom: 20px;
}

.topbar-title h1 {
  font-size: 1.45rem;
  font-weight: 800;
  color: #fff;
}

.topbar-title p {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-top: 4px;
}

.dash-tab-pane {
  display: none;
}

.dash-tab-pane.active {
  display: block;
  animation: fadeIn 0.2s ease-out;
}

/* Apps Grid & Cards */
.apps-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 20px;
}

.app-card {
  background: var(--card-bg);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-lg);
  padding: 22px;
  backdrop-filter: blur(16px);
  transition: all 0.2s;
}

.app-card:hover {
  border-color: var(--cyan-primary);
  box-shadow: 0 8px 30px rgba(0, 240, 255, 0.15);
}

.app-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.app-card-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: #fff;
}

.app-badge-status {
  font-size: 0.68rem;
  font-weight: 700;
  padding: 4px 8px;
  border-radius: 12px;
  background: rgba(16, 185, 129, 0.15);
  color: var(--success);
  border: 1px solid var(--success);
}

.app-info-row {
  margin-bottom: 12px;
}

.app-info-label {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-bottom: 4px;
  text-transform: uppercase;
  font-weight: 700;
}

.app-key-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.78rem;
  color: var(--cyan-primary);
}

.btn-mini-copy {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.8rem;
}

.btn-mini-copy:hover { color: #fff; }

.app-fallback-badge {
  font-size: 0.74rem;
  background: rgba(245, 158, 11, 0.12);
  color: var(--warning);
  border: 1px solid rgba(245, 158, 11, 0.3);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  margin-top: 10px;
}

.app-snippet-wrap {
  margin-top: 14px;
  background: rgba(0, 0, 0, 0.6);
  border: 1px solid rgba(0, 240, 255, 0.2);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.app-snippet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: rgba(0, 240, 255, 0.08);
  border-bottom: 1px solid rgba(0, 240, 255, 0.15);
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--cyan-primary);
}

.app-snippet-code {
  margin: 0;
  padding: 12px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.72rem;
  line-height: 1.45;
  color: #a7f3d0;
  max-height: 180px;
  overflow-y: auto;
  white-space: pre;
}

.app-actions-row {
  display: flex;
  gap: 8px;
  margin-top: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  padding-top: 14px;
}

.empty-state-box {
  text-align: center;
  padding: 60px 20px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px dashed rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-lg);
}

.empty-icon { font-size: 2.5rem; margin-bottom: 12px; }

/* Catalog Grid & Providers */
.catalog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}

.catalog-card {
  background: var(--card-bg);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-md);
  padding: 16px;
  backdrop-filter: blur(16px);
  transition: all 0.2s;
}

.catalog-card:hover {
  border-color: var(--cyan-primary);
  box-shadow: 0 4px 20px rgba(0, 240, 255, 0.12);
}

.catalog-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.models-count-badge {
  font-size: 0.65rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 12px;
  background: rgba(0, 240, 255, 0.12);
  color: var(--cyan-primary);
  border: 1px solid rgba(0, 240, 255, 0.25);
}

.models-pills-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 10px 0;
}

.model-pill {
  font-size: 0.68rem;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 3px 8px;
  border-radius: 4px;
  color: #cbd5e1;
}

.model-pill.more {
  color: var(--cyan-primary);
  background: rgba(0, 240, 255, 0.08);
}

.btn-copy-provider-id {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: var(--text-muted);
  font-size: 0.68rem;
  padding: 3px 8px;
  border-radius: 4px;
  cursor: pointer;
}

.btn-copy-provider-id:hover {
  border-color: var(--cyan-primary);
  color: #fff;
}

/* Doc & SDK Snippets */
.doc-card {
  background: var(--card-bg);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 24px;
}

.doc-card h3 { font-size: 1.1rem; color: #fff; margin-bottom: 6px; }
.doc-card p { font-size: 0.84rem; color: var(--text-muted); margin-bottom: 18px; }

.code-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(0, 0, 0, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-bottom: none;
  border-radius: var(--radius-md) var(--radius-md) 0 0;
  padding: 8px 14px;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--cyan-primary);
}

.code-block {
  background: #020408;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 0 0 var(--radius-md) var(--radius-md);
  padding: 16px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.82rem;
  color: #e2e8f0;
  overflow-x: auto;
  line-height: 1.5;
}

.btn-copy-code {
  background: rgba(0, 240, 255, 0.2);
  border: 1px solid var(--cyan-primary);
  color: var(--cyan-primary);
  border-radius: var(--radius-sm);
  padding: 4px 8px;
  cursor: pointer;
  font-size: 0.72rem;
  font-weight: 700;
}

/* Tier Visual Flow */
.tier-flow {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 18px;
}

.tier-card {
  flex: 1;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-md);
  padding: 16px;
  position: relative;
}

.tier-card.active {
  border-color: var(--cyan-primary);
  box-shadow: 0 0 16px rgba(0, 240, 255, 0.15);
}

.tier-num {
  font-size: 0.68rem;
  font-weight: 800;
  color: var(--cyan-primary);
  text-transform: uppercase;
}

.tier-card h4 { font-size: 0.92rem; color: #fff; margin: 4px 0 6px; }
.tier-card p { font-size: 0.76rem; color: var(--text-muted); line-height: 1.3; }
.tier-arrow { font-size: 1.2rem; color: var(--cyan-primary); }

/* ======================================================== */
/* 3. MODAL DIALOGS                                         */
/* ======================================================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
}

.modal-card {
  background: #08101e;
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  padding: 28px;
  width: 100%;
  max-width: 520px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8), 0 0 40px rgba(0, 240, 255, 0.15);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.modal-header h2 { font-size: 1.25rem; font-weight: 800; color: #fff; }
.btn-close-modal { background: transparent; border: none; color: var(--text-muted); font-size: 1.2rem; cursor: pointer; }
.btn-close-modal:hover { color: #fff; }

.helper-text {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 4px;
  display: block;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 24px;
}
