/* ==========================================================================
   VibeVPN - Modern WireGuard Control Panel Stylesheet
   Strictly adheres to AGENTS.md tokens, RTL Persian layout, and dark aesthetic.
   ========================================================================== */

:root {
  /* Surface & Base Colors */
  --bg: #090d16;
  --bg-gradient: radial-gradient(circle at 50% 0%, #151e34 0%, #090d16 65%);
  --surface: #111827;
  --surface-hover: #172237;
  --surface-2: #1e293b;
  --surface-3: #27354a;
  --border: #243044;
  --border-strong: #374761;
  --border-focus: #6366f1;

  /* Typography */
  --fg: #f8fafc;
  --fg-muted: #94a3b8;
  --fg-subtle: #64748b;
  --font-family: 'Vazirmatn', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --font-mono: 'JetBrains Mono', Consolas, Monaco, monospace;

  /* Accent Colors */
  --primary: #6366f1;
  --primary-hover: #4f46e5;
  --primary-glow: rgba(99, 102, 241, 0.25);
  --cyan: #06b6d4;
  --cyan-glow: rgba(6, 182, 212, 0.2);
  --emerald: #10b981;
  --emerald-hover: #059669;
  --emerald-glow: rgba(16, 185, 129, 0.2);
  --purple: #a855f7;
  --danger: #ef4444;
  --danger-hover: #dc2626;
  --warning: #f59e0b;

  /* Shape & Elevation */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-full: 9999px;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 14px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 12px 36px -4px rgba(0, 0, 0, 0.5), 0 4px 16px rgba(0, 0, 0, 0.3);

  /* Animation */
  --dur-micro: 120ms;
  --dur-normal: 180ms;
  --dur-slow: 260ms;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

/* Base Reset */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  min-height: 100%;
  font-family: var(--font-family);
  background: var(--bg);
  background-image: var(--bg-gradient);
  background-attachment: fixed;
  color: var(--fg);
  line-height: 1.6;
  direction: rtl;
  text-align: right;
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea {
  font-family: inherit;
  font-size: 0.9375rem;
  color: inherit;
}

code, pre {
  font-family: var(--font-mono);
}

.container {
  width: 100%;
  max-width: 1280px;
  margin-left: auto;
  margin-right: auto;
  padding-left: 1.5rem;
  padding-right: 1.5rem;
}

/* ==================== BUTTONS ==================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.55rem 1.1rem;
  font-weight: 600;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--dur-normal) var(--ease-out);
  text-decoration: none;
  line-height: 1.25;
  user-select: none;
}

.btn svg {
  width: 1.125rem;
  height: 1.125rem;
  flex-shrink: 0;
}

.btn-primary {
  background: var(--primary);
  color: #ffffff;
  box-shadow: 0 2px 10px var(--primary-glow);
}
.btn-primary:hover {
  background: var(--primary-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 14px var(--primary-glow);
}

.btn-emerald {
  background: var(--emerald);
  color: #ffffff;
  box-shadow: 0 2px 10px var(--emerald-glow);
}
.btn-emerald:hover {
  background: var(--emerald-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 16px var(--emerald-glow);
}

.btn-secondary {
  background: var(--surface-2);
  color: var(--fg);
  border-color: var(--border);
}
.btn-secondary:hover {
  background: var(--surface-3);
  border-color: var(--border-strong);
}

.btn-outline {
  background: transparent;
  color: var(--fg);
  border-color: var(--border-strong);
}
.btn-outline:hover {
  background: var(--surface-2);
  color: #ffffff;
}

.btn-outline-danger {
  background: transparent;
  color: var(--fg-muted);
  border-color: var(--border);
}
.btn-outline-danger:hover {
  background: rgba(239, 68, 68, 0.15);
  color: var(--danger);
  border-color: var(--danger);
}

.btn-sm {
  padding: 0.35rem 0.75rem;
  font-size: 0.8125rem;
  border-radius: var(--radius-sm);
}
.btn-sm svg {
  width: 0.95rem;
  height: 0.95rem;
}

.btn-lg {
  padding: 0.8rem 1.4rem;
  font-size: 1.05rem;
}

.btn-block {
  width: 100%;
}

.btn-icon {
  padding: 0.55rem;
  border-radius: var(--radius-md);
}

.btn-icon-only {
  padding: 0.4rem;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--fg-muted);
}
.btn-icon-only:hover {
  color: #ffffff;
  border-color: var(--border-strong);
  background: var(--surface-3);
}

/* ==================== 1. AUTH SCREEN ==================== */
.auth-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  position: relative;
  overflow: hidden;
}

.auth-backdrop {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, rgba(99, 102, 241, 0.18) 0%, rgba(6, 182, 212, 0.08) 50%, transparent 70%);
  filter: blur(80px);
  pointer-events: none;
}

.auth-card {
  position: relative;
  width: 100%;
  max-width: 440px;
  background: rgba(17, 24, 39, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-xl);
  padding: 2.5rem 2rem;
  box-shadow: var(--shadow-lg);
  animation: cardFadeIn 0.4s var(--ease-out);
}

@keyframes cardFadeIn {
  from { opacity: 0; transform: translateY(12px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.auth-brand {
  text-align: center;
  margin-bottom: 2rem;
}

.brand-logo {
  width: 54px;
  height: 54px;
  margin: 0 auto 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--primary) 0%, var(--cyan) 100%);
  border-radius: var(--radius-lg);
  box-shadow: 0 4px 20px var(--primary-glow);
  color: #ffffff;
}

.brand-logo svg {
  width: 28px;
  height: 28px;
}

.brand-title {
  font-size: 1.85rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: #ffffff;
}

.brand-title span {
  color: var(--cyan);
}

.brand-tagline {
  font-size: 0.875rem;
  color: var(--fg-muted);
  margin-top: 0.4rem;
}

.form-group {
  margin-bottom: 1.25rem;
}

.form-group label {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--fg);
  margin-bottom: 0.45rem;
}

.form-group label .req {
  color: var(--danger);
}

.input-icon {
  width: 1rem;
  height: 1rem;
  color: var(--fg-subtle);
}

.form-group input {
  width: 100%;
  padding: 0.7rem 0.9rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--fg);
  transition: all var(--dur-normal) var(--ease-out);
}

.form-group input:focus {
  outline: none;
  border-color: var(--border-focus);
  background: var(--surface-3);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

.password-wrapper {
  position: relative;
}

.password-wrapper input {
  padding-left: 2.75rem;
}

.btn-toggle-pwd {
  position: absolute;
  left: 0.65rem;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--fg-subtle);
  cursor: pointer;
  padding: 0.25rem;
  display: flex;
}
.btn-toggle-pwd:hover {
  color: var(--fg);
}
.btn-toggle-pwd svg {
  width: 1.15rem;
  height: 1.15rem;
}

.auth-hint {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(99, 102, 241, 0.08);
  border: 1px dashed rgba(99, 102, 241, 0.35);
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.75rem;
  font-size: 0.8125rem;
  color: var(--fg-muted);
  margin-bottom: 1.5rem;
}

.auth-hint code {
  color: var(--cyan);
  font-weight: 600;
  direction: ltr;
}

/* ==================== 2. APP HEADER ==================== */
.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(11, 15, 23, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 72px;
  gap: 1rem;
}

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

.brand-badge {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--primary) 0%, var(--cyan) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  box-shadow: 0 2px 10px var(--primary-glow);
}
.brand-badge svg {
  width: 22px;
  height: 22px;
}

.brand-text {
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: #ffffff;
  line-height: 1.2;
}
.brand-text span {
  color: var(--cyan);
}

.header-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.75rem;
  color: var(--fg-muted);
  margin-top: 2px;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--emerald);
}

.status-dot.pulse {
  box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
  animation: pulseGreen 2s infinite;
}

@keyframes pulseGreen {
  0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
  70% { box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
  100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

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

.user-pill {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  padding: 0.4rem 0.85rem;
  border-radius: var(--radius-full);
  font-size: 0.8125rem;
  color: var(--fg-muted);
}
.user-pill svg {
  width: 1rem;
  height: 1rem;
  color: var(--cyan);
}
.user-pill span {
  font-family: var(--font-mono);
  direction: ltr;
}

/* ==================== STATS ROW ==================== */
.main-content {
  padding-top: 2rem;
  padding-bottom: 3.5rem;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 1.25rem;
  margin-bottom: 2rem;
}

.stat-card {
  display: flex;
  align-items: center;
  gap: 1.15rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.4rem;
  transition: transform var(--dur-normal) var(--ease-out), border-color var(--dur-normal);
}

.stat-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-strong);
}

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.stat-icon svg {
  width: 24px;
  height: 24px;
}

.icon-cyan {
  background: rgba(6, 182, 212, 0.12);
  color: var(--cyan);
}
.icon-indigo {
  background: rgba(99, 102, 241, 0.12);
  color: var(--primary);
}
.icon-purple {
  background: rgba(168, 85, 247, 0.12);
  color: var(--purple);
}
.icon-emerald {
  background: rgba(16, 185, 129, 0.12);
  color: var(--emerald);
}

.stat-meta {
  display: flex;
  flex-direction: column;
}

.stat-label {
  font-size: 0.8125rem;
  color: var(--fg-muted);
  font-weight: 500;
}

.stat-value {
  font-size: 1.5rem;
  font-weight: 800;
  color: #ffffff;
  margin-top: 0.2rem;
  font-variant-numeric: tabular-nums;
}

.text-emerald {
  color: var(--emerald) !important;
}

/* ==================== DASHBOARD GRID ==================== */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 1.15fr;
  gap: 1.5rem;
  margin-bottom: 2rem;
}

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

.panel-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  box-shadow: var(--shadow-sm);
}

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

.card-title-group {
  display: flex;
  align-items: flex-start;
  gap: 0.85rem;
}

.header-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.header-icon svg {
  width: 20px;
  height: 20px;
}

.card-title-group h2 {
  font-size: 1.15rem;
  font-weight: 700;
  color: #ffffff;
  line-height: 1.3;
}

.card-title-group p {
  font-size: 0.8125rem;
  color: var(--fg-muted);
  margin-top: 0.25rem;
}

/* ==================== CREATE FORM ==================== */
.form-row {
  display: flex;
  gap: 1rem;
}

.col-half {
  flex: 1;
}

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

.input-with-stepper input {
  padding-left: 3rem;
  font-weight: 600;
  font-size: 1rem;
}

.input-suffix {
  position: absolute;
  left: 0.85rem;
  color: var(--fg-subtle);
  font-size: 0.8125rem;
  font-weight: 600;
  pointer-events: none;
}

.field-hint {
  display: block;
  font-size: 0.75rem;
  color: var(--fg-subtle);
  margin-top: 0.35rem;
}

.quick-presets {
  margin-bottom: 1.25rem;
}

.presets-title {
  display: block;
  font-size: 0.75rem;
  color: var(--fg-muted);
  margin-bottom: 0.45rem;
}

.preset-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.btn-preset {
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--fg-muted);
  border-radius: var(--radius-sm);
  padding: 0.3rem 0.65rem;
  font-size: 0.8125rem;
  cursor: pointer;
  transition: all var(--dur-micro);
}

.btn-preset:hover {
  background: var(--surface-3);
  color: var(--fg);
  border-color: var(--border-strong);
}

.btn-preset.active {
  background: rgba(99, 102, 241, 0.2);
  border-color: var(--primary);
  color: #ffffff;
  font-weight: 600;
}

.wg-info-banner {
  display: flex;
  gap: 0.75rem;
  background: rgba(16, 185, 129, 0.08);
  border: 1px solid rgba(16, 185, 129, 0.25);
  border-radius: var(--radius-md);
  padding: 0.85rem 1rem;
  margin-bottom: 1.5rem;
}

.wg-info-icon {
  color: var(--emerald);
  flex-shrink: 0;
  margin-top: 2px;
}
.wg-info-icon svg {
  width: 1.25rem;
  height: 1.25rem;
}

.wg-info-text {
  font-size: 0.8125rem;
  color: var(--fg-muted);
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}
.wg-info-text strong {
  color: var(--emerald);
}

/* ==================== SERVERS LIST ==================== */
.servers-list {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.server-node-card {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 1rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1rem 1.15rem;
  transition: border-color var(--dur-normal), transform var(--dur-normal);
}

.server-node-card:hover {
  border-color: var(--border-strong);
  transform: translateX(-2px);
}

.node-indicator {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--emerald);
  box-shadow: 0 0 8px rgba(16, 185, 129, 0.6);
}

.server-main-col {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.server-head {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.server-badge {
  font-size: 0.875rem;
  font-weight: 700;
  color: #ffffff;
}

.server-file-tag {
  background: var(--surface-3);
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-family: var(--font-mono);
  color: var(--cyan);
  direction: ltr;
}

.server-endpoint {
  font-size: 0.78125rem;
  color: var(--fg-muted);
}
.server-endpoint code {
  color: var(--fg-muted);
}

.server-specs {
  display: flex;
  gap: 0.85rem;
  font-size: 0.71875rem;
  color: var(--fg-subtle);
}

.server-actions-col {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

@media (max-width: 640px) {
  .server-node-card {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }
  .server-actions-col {
    justify-content: flex-end;
  }
}

/* ==================== SUBSCRIPTION TABLE ==================== */
.table-section {
  padding: 1.5rem 1.75rem;
}

.table-header-row {
  align-items: center;
}

.table-search-box {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.4rem 0.85rem;
  width: 260px;
}
.table-search-box svg {
  width: 1rem;
  height: 1rem;
  color: var(--fg-subtle);
  flex-shrink: 0;
}
.table-search-box input {
  background: none;
  border: none;
  outline: none;
  width: 100%;
  color: var(--fg);
  font-size: 0.84375rem;
}

.table-responsive {
  width: 100%;
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: right;
  font-size: 0.875rem;
}

.data-table th {
  padding: 0.9rem 1rem;
  background: var(--surface-2);
  color: var(--fg-muted);
  font-weight: 600;
  border-bottom: 1px solid var(--border);
}

.data-table th:first-child {
  border-top-right-radius: var(--radius-md);
}
.data-table th:last-child {
  border-top-left-radius: var(--radius-md);
}

.data-table td {
  padding: 1rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.data-table tr:hover td {
  background: var(--surface-hover);
}

.sub-name-cell {
  display: flex;
  flex-direction: column;
}
.sub-name-text {
  font-weight: 700;
  color: #ffffff;
}
.sub-id-text {
  font-size: 0.71875rem;
  font-family: var(--font-mono);
  color: var(--fg-subtle);
  direction: ltr;
}

.badge-pill {
  display: inline-block;
  padding: 0.2rem 0.65rem;
  border-radius: var(--radius-full);
  background: rgba(99, 102, 241, 0.15);
  color: #818cf8;
  font-size: 0.78125rem;
  font-weight: 600;
}

.badge-pill-vol {
  display: inline-block;
  padding: 0.2rem 0.65rem;
  border-radius: var(--radius-full);
  background: rgba(6, 182, 212, 0.15);
  color: var(--cyan);
  font-size: 0.78125rem;
  font-weight: 700;
  font-family: var(--font-mono);
  direction: ltr;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.2rem 0.65rem;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
}
.status-badge.active {
  background: rgba(16, 185, 129, 0.15);
  color: var(--emerald);
}
.status-badge.disabled {
  background: rgba(239, 68, 68, 0.15);
  color: var(--danger);
}

.table-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.text-center {
  text-align: center;
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 3.5rem 1rem;
}
.empty-icon {
  width: 56px;
  height: 56px;
  margin: 0 auto 1rem;
  color: var(--fg-subtle);
}
.empty-icon svg {
  width: 100%;
  height: 100%;
}
.empty-state h3 {
  font-size: 1.15rem;
  color: #ffffff;
  margin-bottom: 0.4rem;
}
.empty-state p {
  font-size: 0.875rem;
  color: var(--fg-muted);
  max-width: 400px;
  margin: 0 auto;
}

/* ==================== MODALS ==================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(5, 8, 15, 0.8);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  animation: fadeInOverlay 0.2s ease-out;
}

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

.modal-dialog {
  width: 100%;
  max-width: 540px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  animation: modalScaleUp 0.25s var(--ease-out);
}

.modal-lg {
  max-width: 720px;
}
.modal-sm {
  max-width: 400px;
}

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

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

.modal-title-wrap {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.badge-success-icon {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(16, 185, 129, 0.2);
  color: var(--emerald);
  display: flex;
  align-items: center;
  justify-content: center;
}
.badge-success-icon svg {
  width: 20px;
  height: 20px;
}

.modal-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: #ffffff;
}

.modal-subtitle {
  font-size: 0.8125rem;
  color: var(--fg-muted);
  margin-top: 0.15rem;
}

.modal-close-btn {
  background: none;
  border: none;
  color: var(--fg-subtle);
  font-size: 1.75rem;
  cursor: pointer;
  line-height: 1;
  padding: 0 0.5rem;
}
.modal-close-btn:hover {
  color: #ffffff;
}

.modal-body {
  padding: 1.5rem;
  max-height: 75vh;
  overflow-y: auto;
}

.modal-footer {
  padding: 1rem 1.5rem;
  background: var(--surface-2);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
}

/* Modal details */
.created-summary-card {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1rem;
  margin-bottom: 1.25rem;
}

.summary-item {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}
.summary-item .lbl {
  font-size: 0.75rem;
  color: var(--fg-muted);
}
.summary-item .val {
  font-size: 0.95rem;
}

.download-all-cta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.15) 0%, rgba(6, 182, 212, 0.1) 100%);
  border: 1px solid rgba(16, 185, 129, 0.4);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.4rem;
  margin-bottom: 1.5rem;
}

.cta-info {
  display: flex;
  align-items: center;
  gap: 1rem;
}
.cta-info svg {
  width: 32px;
  height: 32px;
  color: var(--emerald);
  flex-shrink: 0;
}
.cta-info strong {
  display: block;
  font-size: 1rem;
  color: #ffffff;
}
.cta-info span {
  font-size: 0.8125rem;
  color: var(--fg-muted);
}

.sub-heading {
  font-size: 0.95rem;
  font-weight: 700;
  color: #ffffff;
  margin-bottom: 0.85rem;
}

.created-configs-grid {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.created-config-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.75rem 1rem;
}

.config-item-meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.server-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--cyan);
}

.config-title {
  font-weight: 600;
  font-size: 0.875rem;
  color: #ffffff;
}

.config-endpoint {
  font-size: 0.75rem;
  font-family: var(--font-mono);
  color: var(--fg-subtle);
  direction: ltr;
}

.config-item-btns {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.guide-box {
  background: rgba(99, 102, 241, 0.08);
  border: 1px dashed rgba(99, 102, 241, 0.3);
  border-radius: var(--radius-md);
  padding: 0.9rem 1.15rem;
}
.guide-box h5 {
  font-size: 0.84375rem;
  color: var(--primary);
  margin-bottom: 0.4rem;
}
.guide-box ol {
  padding-right: 1.25rem;
  font-size: 0.8125rem;
  color: var(--fg-muted);
  line-height: 1.7;
}

/* QR Modal */
.qr-code-wrapper {
  background: #ffffff;
  border-radius: var(--radius-md);
  padding: 1.25rem;
  display: inline-block;
  margin: 0.5rem auto 1rem;
  min-width: 240px;
  min-height: 240px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.qr-code-wrapper img {
  max-width: 100%;
  height: auto;
  display: block;
}

.qr-hint {
  font-size: 0.8125rem;
  color: var(--fg-muted);
}
.qr-hint strong {
  color: var(--cyan);
  direction: ltr;
  display: inline-block;
}

/* Code Preview */
.config-code-box pre {
  background: #060911;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1rem;
  max-height: 320px;
  overflow: auto;
  font-size: 0.8125rem;
  color: #e2e8f0;
  line-height: 1.5;
}

/* Spinner */
.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid rgba(99, 102, 241, 0.2);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* ==================== TOAST NOTIFICATIONS ==================== */
.toast-container {
  position: fixed;
  bottom: 1.5rem;
  left: 1.5rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  min-width: 280px;
  max-width: 420px;
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  padding: 0.85rem 1.15rem;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.875rem;
  color: #ffffff;
  animation: toastSlideUp 0.25s var(--ease-out);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

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

.toast-success {
  border-right: 4px solid var(--emerald);
}
.toast-error {
  border-right: 4px solid var(--danger);
}
.toast-info {
  border-right: 4px solid var(--cyan);
}

.toast-icon {
  width: 1.25rem;
  height: 1.25rem;
  flex-shrink: 0;
}
.toast-success .toast-icon { color: var(--emerald); }
.toast-error .toast-icon { color: var(--danger); }
.toast-info .toast-icon { color: var(--cyan); }

/* Footer */
.app-footer {
  border-top: 1px solid var(--border);
  padding: 1.5rem 0;
  font-size: 0.8125rem;
  color: var(--fg-subtle);
}

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
}

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

