
/* ========================================
   Private Relay — Modern UI Redesign
   Dark-first, Security-focused, Professional
   ======================================== */

:root {
  /* Surface ladder — deep navy tinted progression */
  --bg: #05070C;
  --surface-1: #0A0D12;
  --surface-2: #0F131C;
  --surface-3: #161D2B;
  --surface-4: #1E2636;

  /* Accent — luminous cyan for security/tech context */
  --accent: #38BDF8;
  --accent-hover: #22D3EE;
  --accent-dim: #0EA5E9;
  --accent-glow: rgba(56, 189, 248, 0.15);
  --accent-surface: rgba(56, 189, 248, 0.08);

  /* Supporting tint — emerald for success states */
  --success: #6EE7B7;
  --success-dim: #34D399;
  --success-surface: rgba(110, 231, 183, 0.08);

  /* Status colors */
  --warning: #FCD34D;
  --error: #F87171;
  --error-surface: rgba(248, 113, 113, 0.08);

  /* Text scale */
  --text: #F1F5F9;
  --text-2: #CBD5E1;
  --text-3: #94A3B8;
  --text-dim: #64748B;

  /* Borders */
  --border: rgba(241, 245, 249, 0.08);
  --border-2: rgba(241, 245, 249, 0.12);
  --border-hover: rgba(241, 245, 249, 0.16);

  /* Radius tokens */
  --radius-pill: 999px;
  --radius-lg: 16px;
  --radius: 12px;
  --radius-sm: 8px;

  /* Spacing scale */
  --space-xs: clamp(4px, 0.5vw, 6px);
  --space-sm: clamp(8px, 1vw, 12px);
  --space: clamp(16px, 2vw, 24px);
  --space-lg: clamp(24px, 3vw, 32px);
  --space-xl: clamp(32px, 4vw, 48px);

  /* Typography */
  --font-sans: 'Prompt', -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Inter', 'Segoe UI', system-ui, sans-serif;
  --font-mono: 'SF Mono', 'JetBrains Mono', 'Fira Code', ui-monospace, Menlo, Consolas, monospace;

  /* Fluid type scale */
  --text-xs: clamp(0.75rem, 0.7rem + 0.15vw, 0.8125rem);
  --text-sm: clamp(0.8125rem, 0.75rem + 0.2vw, 0.875rem);
  --text-base: clamp(0.875rem, 0.8rem + 0.25vw, 0.9375rem);
  --text-md: clamp(0.9375rem, 0.85rem + 0.3vw, 1rem);
  --text-lg: clamp(1rem, 0.9rem + 0.4vw, 1.125rem);
  --text-xl: clamp(1.125rem, 1rem + 0.5vw, 1.25rem);
  --text-2xl: clamp(1.5rem, 1.25rem + 0.8vw, 1.875rem);
  --text-3xl: clamp(2rem, 1.5rem + 1.5vw, 2.75rem);

  /* Shadows with depth */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow: 0 2px 8px rgba(0, 0, 0, 0.4), 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.5), 0 2px 8px rgba(0, 0, 0, 0.4);
  --shadow-glow: 0 0 0 1px var(--accent), 0 0 0 4px var(--accent-glow);

  /* Transitions */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --duration: 200ms;
}

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

body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-size: var(--text-base);
  line-height: 1.6;
  min-height: 100vh;
}

/* ========================================
   TOPBAR
   ======================================== */
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 var(--space-xl);
  height: 64px;
  background: var(--surface-1);
  border-bottom: 1px solid var(--border-2);
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(12px);
}

.brand {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-weight: 600;
  font-size: var(--text-md);
  letter-spacing: -0.02em;
  color: var(--accent);
}

.brand svg {
  filter: drop-shadow(0 0 8px var(--accent-glow));
}

.nav-right {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin-left: auto;
}

.domain-badge {
  font-size: var(--text-xs);
  color: var(--text-3);
  font-family: var(--font-mono);
  background: var(--surface-3);
  padding: 6px 12px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
}

/* ========================================
   BUTTONS
   ======================================== */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--accent);
  color: var(--bg);
  border: none;
  padding: 0 20px;
  height: 48px;
  border-radius: var(--radius-pill);
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  font-weight: 600;
  letter-spacing: -0.01em;
  cursor: pointer;
  transition: all var(--duration) var(--ease-out);
  white-space: nowrap;
  box-shadow: 0 0 0 0 var(--accent-glow), var(--shadow-sm);
}

.btn-primary:hover {
  background: var(--accent-hover);
  box-shadow: 0 0 0 4px var(--accent-glow), var(--shadow);
  transform: translateY(-1px);
}

.btn-primary:active {
  transform: translateY(0);
  transition-duration: 80ms;
}

.btn-primary:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
  box-shadow: var(--shadow-sm);
}

.btn-block {
  width: 100%;
}

.btn-ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: var(--surface-3);
  color: var(--text-2);
  border: 1px solid var(--border-2);
  padding: 0 16px;
  height: 40px;
  border-radius: var(--radius-pill);
  font-family: inherit;
  font-size: var(--text-sm);
  font-weight: 500;
  cursor: pointer;
  transition: all var(--duration) var(--ease-out);
}

.btn-ghost:hover {
  background: var(--surface-4);
  border-color: var(--border-hover);
  color: var(--text);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.btn-ghost:active {
  transform: translateY(0);
}

.btn-sm {
  height: 36px;
  padding: 0 14px;
  font-size: var(--text-xs);
}

/* CONTINUATION_MARKER_1 */
/* ========================================
   LAYOUT
   ======================================== */
.container {
  max-width: 820px;
  margin: 0 auto;
  padding: var(--space-xl) var(--space);
}

/* ========================================
   HERO
   ======================================== */
.hero {
  position: relative;
  text-align: center;
  padding: var(--space) 0 var(--space-xl);
  overflow: hidden;
}

.hero-text {
  position: relative;
  z-index: 1;
}

.hero-eyebrow {
  font-size: var(--text-xs);
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: var(--space-sm);
}

.badge-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  background: var(--success);
  border-radius: 50%;
  box-shadow: 0 0 0 3px var(--success-surface);
  animation: pulse 2.5s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

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

.hero h1 {
  font-size: var(--text-3xl);
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1.1;
  margin: var(--space-sm) 0;
  color: var(--text);
}

.hero h1 em {
  font-style: normal;
  background: linear-gradient(135deg, var(--accent), var(--success));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  display: block;
}

.hero-sub {
  color: var(--text-2);
  font-size: var(--text-md);
  max-width: 540px;
  margin: 0 auto;
}

.hero-glow {
  position: absolute;
  top: -100px;
  left: 50%;
  transform: translateX(-50%);
  width: 600px;
  height: 400px;
  background: radial-gradient(
    ellipse at center,
    var(--accent-glow) 0%,
    transparent 70%
  );
  pointer-events: none;
  z-index: 0;
}

/* ========================================
   CARDS
   ======================================== */
.card {
  background: var(--surface-2);
  border: 1px solid var(--border-2);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

.create-card {
  padding: var(--space-lg);
  margin-bottom: var(--space-xl);
}

.create-form {
  display: grid;
  grid-template-columns: 1fr 180px auto;
  gap: var(--space-sm);
  align-items: end;
}

/* ========================================
   FORM FIELDS
   ======================================== */
.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.field label {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--text-2);
  letter-spacing: 0.01em;
}

.field input,
.field select {
  height: 48px;
  padding: 0 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-3);
  color: var(--text);
  font-family: inherit;
  font-size: var(--text-sm);
  transition: all var(--duration) var(--ease-out);
  width: 100%;
}

.field input::placeholder {
  color: var(--text-dim);
}

.field input:focus,
.field select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: var(--shadow-glow);
  background: var(--surface-4);
}

.field select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2394A3B8' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 40px;
}

/* CONTINUATION_MARKER_2 */
/* ========================================
   TOAST NOTIFICATIONS
   ======================================== */
.toast {
  font-size: var(--text-sm);
  font-weight: 500;
  min-height: 20px;
  margin-top: var(--space-sm);
  transition: opacity var(--duration) var(--ease-out);
  opacity: 0;
  padding: var(--space-sm) var(--space);
  border-radius: var(--radius);
  background: var(--surface-3);
}

.toast.show {
  opacity: 1;
}

.toast.success {
  color: var(--success);
  background: var(--success-surface);
  border: 1px solid var(--success-dim);
}

.toast.error {
  color: var(--error);
  background: var(--error-surface);
  border: 1px solid var(--error);
}

/* ========================================
   ALIAS LIST
   ======================================== */
.list-section {
  margin-bottom: var(--space-xl);
}

.list-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space);
}

.list-head h2 {
  font-size: var(--text-xl);
  font-weight: 600;
  letter-spacing: -0.02em;
}

.alias-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.alias {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space) var(--space-lg);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  transition: all var(--duration) var(--ease-out);
  animation: slideUp 0.4s var(--ease-out);
}

.alias:hover {
  background: var(--surface-3);
  border-color: var(--border-hover);
  box-shadow: var(--shadow);
  transform: translateY(-1px);
}

.alias.off {
  opacity: 0.5;
}

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

.alias-info {
  min-width: 0;
  flex: 1;
}

.alias-label {
  font-size: var(--text-sm);
  font-weight: 600;
  margin-bottom: 4px;
  color: var(--text);
}

.alias-address {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  color: var(--accent);
  font-weight: 500;
  word-break: break-all;
}

.alias.off .alias-address {
  color: var(--text-dim);
}

.alias-meta {
  font-size: var(--text-xs);
  color: var(--text-3);
  margin-top: 6px;
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.alias-meta .sep {
  opacity: 0.3;
}

.alias-meta .expiring {
  color: var(--warning);
  font-weight: 600;
}

.alias-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-shrink: 0;
  margin-left: var(--space);
}

/* CONTINUATION_MARKER_3 */
/* ========================================
   ICON BUTTONS
   ======================================== */
.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background: var(--surface-3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all var(--duration) var(--ease-out);
  color: var(--text-2);
}

.btn-icon:hover {
  background: var(--surface-4);
  border-color: var(--accent);
  color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.btn-icon.copied {
  background: var(--success-surface);
  border-color: var(--success);
  color: var(--success);
}

/* ========================================
   TOGGLE SWITCH
   ======================================== */
.toggle {
  position: relative;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
  cursor: pointer;
}

.toggle input {
  display: none;
}

.toggle-slider {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--surface-4);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  transition: all var(--duration) var(--ease-out);
}

.toggle-slider::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  background: var(--text-3);
  border-radius: 50%;
  box-shadow: var(--shadow-sm);
  transition: all var(--duration) var(--ease-spring);
}

.toggle input:checked + .toggle-slider {
  background: var(--success-dim);
  border-color: var(--success);
}

.toggle input:checked + .toggle-slider::after {
  transform: translateX(20px);
  background: var(--bg);
}

/* ========================================
   EMPTY STATE
   ======================================== */
.empty {
  text-align: center;
  padding: var(--space-xl) var(--space-lg);
  color: var(--text-3);
  font-size: var(--text-sm);
  background: var(--surface-2);
  border: 1px dashed var(--border);
  border-radius: var(--radius-lg);
}

/* ========================================
   FOOTER
   ======================================== */
.footer {
  text-align: center;
  padding: var(--space-lg) 0 0;
  font-size: var(--text-xs);
  color: var(--text-dim);
}

/* CONTINUATION_MARKER_4 */
/* ========================================
   AUTH PAGES
   ======================================== */
.auth {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background:
    radial-gradient(ellipse 800px 600px at 50% 0%, var(--accent-glow) 0%, transparent 60%),
    var(--bg);
  position: relative;
  overflow: hidden;
}

.auth::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background:
    repeating-linear-gradient(
      0deg,
      transparent,
      transparent 2px,
      var(--border) 2px,
      var(--border) 3px
    );
  opacity: 0.03;
  animation: gridMove 20s linear infinite;
  pointer-events: none;
}

@keyframes gridMove {
  0% { transform: translate(0, 0); }
  100% { transform: translate(50px, 50px); }
}

.auth-card {
  max-width: 420px;
  width: calc(100% - 32px);
  background: var(--surface-2);
  border: 1px solid var(--border-2);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: var(--space-xl) var(--space-lg);
  text-align: center;
  position: relative;
  z-index: 1;
}

.auth-icon {
  width: 72px;
  height: 72px;
  margin: 0 auto var(--space-lg);
  background: var(--accent-surface);
  border: 1px solid var(--accent-glow);
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
}

.auth-card h1 {
  font-size: var(--text-2xl);
  font-weight: 700;
  letter-spacing: -0.03em;
  margin-bottom: 6px;
}

.auth-sub {
  font-size: var(--text-sm);
  color: var(--text-3);
  font-family: var(--font-mono);
  margin-bottom: var(--space-lg);
}

.auth-form {
  text-align: left;
  margin-bottom: var(--space);
}

.auth-form .field {
  margin-bottom: var(--space);
}

.auth-form input {
  height: 52px;
}

.auth-form .btn-ghost {
  height: 48px;
  margin-top: var(--space-sm);
}

.auth-form .cf-turnstile {
  display: flex;
  justify-content: center;
  margin: var(--space-lg) 0;
}

.hint {
  font-weight: 400;
  color: var(--text-dim);
  font-size: var(--text-xs);
}

/* ========================================
   RESPONSIVE
   ======================================== */
@media (max-width: 640px) {
  .topbar {
    padding: 0 var(--space);
    height: 56px;
  }

  .domain-badge {
    display: none;
  }

  .container {
    padding: var(--space-lg) var(--space);
  }

  .create-form {
    grid-template-columns: 1fr;
  }

  .field-sm {
    grid-column: 1;
  }

  .hero {
    padding: var(--space-sm) 0 var(--space-lg);
  }

  .alias {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space);
  }

  .alias-actions {
    margin-left: 0;
    width: 100%;
    justify-content: flex-end;
  }

  .auth-card {
    padding: var(--space-lg) var(--space);
  }
}
