/* Antigravity API Gateway - Styling */

:root {
  --bg-dark: #0a0815;
  --bg-surface: #100e26;
  --bg-surface-glow: #161334;
  --border-color: rgba(139, 92, 246, 0.15);
  --border-focus: #8b5cf6;

  --text-main: #f3f4f6;
  --text-muted: #9ca3af;
  --text-dark: #6b7280;

  --accent-purple: #8b5cf6;
  --accent-purple-glow: rgba(139, 92, 246, 0.3);
  --accent-cyan: #06b6d4;
  --accent-cyan-glow: rgba(6, 182, 212, 0.3);
  --accent-emerald: #10b981;
  --accent-emerald-glow: rgba(16, 185, 129, 0.2);
  --accent-rose: #f43f5e;
  --accent-rose-glow: rgba(244, 63, 94, 0.2);

  --font-display: 'Outfit', sans-serif;
  --font-sans: 'Inter', sans-serif;

  --shadow-glow: 0 0 25px rgba(139, 92, 246, 0.15);
  --shadow-glow-cyan: 0 0 25px rgba(6, 182, 212, 0.15);
  --shadow-card: 0 10px 30px -10px rgba(0, 0, 0, 0.5);

  --transition-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
  background-color: var(--bg-dark);
  color: var(--text-main);
  font-family: var(--font-sans);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

/* Auth Overlay Screen */
.auth-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: radial-gradient(circle at center, #1b163e 0%, var(--bg-dark) 70%);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9999;
}

.auth-card {
  background: rgba(16, 14, 38, 0.7);
  border: 1px solid var(--border-color);
  backdrop-filter: blur(16px);
  padding: 3rem 2.5rem;
  border-radius: 20px;
  width: 100%;
  max-width: 440px;
  box-shadow: var(--shadow-glow), var(--shadow-card);
  text-align: center;
  animation: fadeIn 0.6s ease-out;
}

.brand-header {
  margin-bottom: 2rem;
  position: relative;
}

.logo-glow {
  width: 80px;
  height: 80px;
  background: radial-gradient(circle, var(--accent-purple) 0%, transparent 70%);
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  filter: blur(8px);
  opacity: 0.6;
  z-index: -1;
}

.brand-name {
  display: block;
  font-family: var(--font-display);
  font-size: 2.2rem;
  font-weight: 800;
  letter-spacing: 0.25em;
  background: linear-gradient(135deg, #fff 0%, var(--accent-purple) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-sub {
  display: block;
  font-family: var(--font-sans);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.5em;
  color: var(--accent-cyan);
  margin-top: 0.25rem;
}

.auth-card h2 {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
}

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

/* App Header */
.main-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.25rem 2.5rem;
  background: rgba(10, 8, 21, 0.85);
  border-bottom: 1px solid var(--border-color);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  position: relative;
}

.logo-glow-small {
  width: 40px;
  height: 40px;
  background: radial-gradient(circle, var(--accent-cyan) 0%, transparent 70%);
  position: absolute;
  left: -10px;
  z-index: -1;
  filter: blur(4px);
  opacity: 0.5;
}

.logo-text {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: 0.15em;
}

.logo-badge {
  font-size: 0.65rem;
  font-weight: 700;
  padding: 0.2rem 0.5rem;
  border-radius: 6px;
  background: rgba(6, 182, 212, 0.1);
  color: var(--accent-cyan);
  border: 1px solid rgba(6, 182, 212, 0.2);
}

.nav-tabs {
  display: flex;
  gap: 0.5rem;
  background: rgba(255, 255, 255, 0.03);
  padding: 0.35rem;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.nav-tab {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-family: var(--font-sans);
  font-weight: 500;
  font-size: 0.9rem;
  padding: 0.6rem 1.2rem;
  border-radius: 9px;
  cursor: pointer;
  transition: var(--transition-fast);
}

.nav-tab:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.05);
}

.nav-tab.active {
  color: #fff;
  background: var(--accent-purple);
  box-shadow: 0 0 15px rgba(139, 92, 246, 0.3);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.status-indicator {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
}

.status-indicator::before {
  content: '';
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--text-dark);
}

.status-indicator.active::before {
  background-color: var(--accent-emerald);
  box-shadow: 0 0 10px var(--accent-emerald);
}

/* Layout Content */
.content-area {
  flex: 1;
  padding: 2.5rem;
  width: 100%;
  max-width: 1400px;
  margin: 0 auto;
  animation: fadeIn 0.4s ease-out;
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: flex;
  flex-direction: column;
  gap: 2.5rem;
}

/* Cards & Layout */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 1.75rem;
  box-shadow: var(--shadow-card);
  overflow: hidden;
  transition: border-color var(--transition-fast);
}

.card:hover {
  border-color: rgba(139, 92, 246, 0.25);
}

.card-header {
  margin-bottom: 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.card-header h4 {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 600;
  color: #fff;
}

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

.metric-card {
  background: linear-gradient(145deg, var(--bg-surface) 0%, rgba(20, 18, 42, 0.5) 100%);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 1.5rem;
  box-shadow: var(--shadow-card);
  position: relative;
  overflow: hidden;
}

.metric-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 4px;
  background: linear-gradient(90deg, var(--accent-purple), var(--accent-cyan));
  opacity: 0.7;
}

.metric-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.metric-value {
  font-family: var(--font-display);
  font-size: 2.2rem;
  font-weight: 700;
  margin: 0.5rem 0;
  letter-spacing: -0.02em;
}

.metric-trend {
  font-size: 0.8rem;
  font-weight: 500;
}

/* Charts Section */
.dashboard-charts-layout {
  display: grid;
  grid-template-columns: 2.5fr 1.2fr;
  gap: 1.5rem;
}

@media (max-width: 1024px) {
  .dashboard-charts-layout {
    grid-template-columns: 1fr;
  }
}

.chart-container {
  position: relative;
  height: 320px;
  width: 100%;
}

.summary-stats-list {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  margin-bottom: 1.5rem;
}

.summary-stat-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  font-size: 0.9rem;
}

.summary-stat-item span:first-child {
  color: var(--text-muted);
}

.summary-stat-item span:last-child {
  font-weight: 600;
}

.action-card {
  background: rgba(139, 92, 246, 0.05);
  border: 1px dashed var(--accent-purple);
  padding: 1.25rem;
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.action-card h5 {
  font-size: 0.95rem;
  font-weight: 600;
  color: #fff;
}

.action-card p {
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.4;
}

/* UI Elements */
.view-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.view-header h2 {
  font-family: var(--font-display);
  font-size: 1.8rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
}

.view-header p {
  color: var(--text-muted);
  font-size: 0.95rem;
}

/* Forms & Buttons */
.form-group {
  margin-bottom: 1.25rem;
  text-align: left;
}

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

.form-row {
  display: flex;
  gap: 1rem;
}

.col {
  flex: 1;
}

input[type="text"],
input[type="password"],
input[type="number"],
select {
  width: 100%;
  padding: 0.75rem 1rem;
  background-color: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  color: #fff;
  font-family: var(--font-sans);
  font-size: 0.95rem;
  transition: var(--transition-fast);
}

input:focus,
select:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 10px rgba(139, 92, 246, 0.25);
  background-color: rgba(255, 255, 255, 0.06);
}

.input-readonly {
  background-color: rgba(255, 255, 255, 0.01) !important;
  color: var(--text-muted) !important;
  border-color: rgba(255, 255, 255, 0.05) !important;
  cursor: not-allowed;
}

.btn {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 0.9rem;
  padding: 0.75rem 1.5rem;
  border-radius: 10px;
  border: none;
  cursor: pointer;
  transition: var(--transition-fast);
}

.btn-block {
  display: flex;
  width: 100%;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent-purple) 0%, #7c3aed 100%);
  color: #fff;
  box-shadow: 0 4px 15px rgba(139, 92, 246, 0.2);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(139, 92, 246, 0.35);
}

.btn-secondary {
  background-color: rgba(255, 255, 255, 0.05);
  color: var(--text-main);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.btn-secondary:hover {
  background-color: rgba(255, 255, 255, 0.08);
}

.btn-danger {
  background-color: rgba(244, 63, 94, 0.1);
  color: var(--accent-rose);
  border: 1px solid rgba(244, 63, 94, 0.2);
}

.btn-danger:hover {
  background-color: rgba(244, 63, 94, 0.25);
}

.btn-small {
  padding: 0.4rem 0.8rem;
  font-size: 0.8rem;
  border-radius: 6px;
}

/* Modals */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(5, 4, 10, 0.8);
  backdrop-filter: blur(8px);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  animation: fadeIn var(--transition-fast);
}

.modal-card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 18px;
  padding: 2.25rem;
  width: 100%;
  max-width: 600px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-glow), var(--shadow-card);
  animation: scaleIn var(--transition-fast) ease-out;
}

.modal-card h3 {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 600;
  margin-bottom: 1.5rem;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  margin-top: 2rem;
}

/* Checkbox */
.checkbox-container {
  display: flex;
  align-items: center;
  position: relative;
  padding-left: 2rem;
  cursor: pointer;
  font-size: 0.9rem;
  user-select: none;
}

.checkbox-container input {
  position: absolute;
  opacity: 0;
  cursor: pointer;
  height: 0;
  width: 0;
}

.checkmark {
  position: absolute;
  top: 50%;
  left: 0;
  transform: translateY(-50%);
  height: 20px;
  width: 20px;
  background-color: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  transition: var(--transition-fast);
}

.checkbox-container:hover input~.checkmark {
  background-color: rgba(255, 255, 255, 0.08);
}

.checkbox-container input:checked~.checkmark {
  background-color: var(--accent-purple);
  border-color: var(--accent-purple);
}

.checkmark:after {
  content: "";
  position: absolute;
  display: none;
}

.checkbox-container input:checked~.checkmark:after {
  display: block;
}

.checkbox-container .checkmark:after {
  left: 6px;
  top: 2px;
  width: 5px;
  height: 10px;
  border: solid white;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

/* Tables */
.gateway-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.gateway-table th {
  padding: 1rem 1.25rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border-color);
}

.gateway-table td {
  padding: 1.15rem 1.25rem;
  font-size: 0.9rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
  color: var(--text-main);
  vertical-align: middle;
}

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

.gateway-table tr:hover td {
  background-color: rgba(255, 255, 255, 0.01);
}

.table-empty {
  text-align: center;
  color: var(--text-muted);
  padding: 3rem !important;
}

/* Key Masking */
.key-masked {
  font-family: monospace;
  background-color: rgba(255, 255, 255, 0.04);
  padding: 0.25rem 0.5rem;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.25rem 0.6rem;
  border-radius: 9999px;
  border: 1px solid transparent;
}

.badge-green {
  background-color: var(--accent-emerald-glow);
  color: var(--accent-emerald);
  border-color: rgba(16, 185, 129, 0.3);
}

.badge-red {
  background-color: var(--accent-rose-glow);
  color: var(--accent-rose);
  border-color: rgba(244, 63, 94, 0.3);
}

.badge-cyan {
  background-color: var(--accent-cyan-glow);
  color: var(--accent-cyan);
  border-color: rgba(6, 182, 212, 0.3);
}

.badge-purple {
  background-color: rgba(139, 92, 246, 0.1);
  color: var(--accent-purple);
  border-color: rgba(139, 92, 246, 0.2);
}

/* Grid Layouts */
.rules-grid-layout,
.models-grid-layout {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.5rem;
}

/* Rule Card */
.rule-card {
  position: relative;
}

.rule-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1.25rem;
}

.rule-header h3 {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 600;
}

.rule-details {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  font-size: 0.88rem;
  margin-bottom: 1.5rem;
}

.rule-detail-item {
  display: flex;
  justify-content: space-between;
}

.rule-detail-item span:first-child {
  color: var(--text-muted);
}

.rule-detail-item span:last-child {
  font-weight: 500;
}

.rule-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 1rem;
}

/* Model Card styling */
.model-card-item {
  display: flex;
  flex-direction: column;
}

.model-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.provider-badge {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
}

.provider-deepseek {
  background: #4f46e5;
  color: #fff;
}

.provider-glm {
  background: #d97706;
  color: #fff;
}

.provider-minimax {
  background: #059669;
  color: #fff;
}

.model-card-item h3 {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 600;
  flex: 1;
}

.model-pricing-table {
  background: rgba(255, 255, 255, 0.015);
  border-radius: 10px;
  padding: 0.75rem 1rem;
  margin-bottom: 1.5rem;
  border: 1px solid rgba(255, 255, 255, 0.03);
}

.pricing-row {
  display: flex;
  justify-content: space-between;
  padding: 0.5rem 0;
  font-size: 0.85rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

.pricing-row:last-child {
  border-bottom: none;
}

.pricing-row span:first-child {
  color: var(--text-muted);
}

.pricing-row span:last-child {
  font-weight: 600;
}

/* Text glow utilities */
.text-glow-green {
  color: var(--accent-emerald) !important;
  text-shadow: 0 0 10px rgba(16, 185, 129, 0.2);
}

.text-glow-red {
  color: var(--accent-rose) !important;
  text-shadow: 0 0 10px rgba(244, 63, 94, 0.2);
}

.text-glow-cyan {
  color: var(--accent-cyan) !important;
  text-shadow: 0 0 10px rgba(6, 182, 212, 0.2);
}

.text-glow-purple {
  color: var(--accent-purple) !important;
  text-shadow: 0 0 10px rgba(139, 92, 246, 0.2);
}

.error-text {
  color: var(--accent-rose);
  font-size: 0.85rem;
  margin-top: 0.75rem;
}

/* Animations */
@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@keyframes scaleIn {
  from {
    transform: scale(0.95);
    opacity: 0;
  }

  to {
    transform: scale(1);
    opacity: 1;
  }
}