/* ============================================
   ProxyHub - Main Styles (iori-nav inspired)
   ============================================ */

/* ---- CSS Variables ---- */
:root {
  /* Colors */
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-light: #60a5fa;
  --bg-light: #f0f4f8;
  --bg-dark: #0f172a;
  --card-bg: rgba(255, 255, 255, 0.52);
  --card-border: rgba(255, 255, 255, 0.65);
  --card-bg-hover: rgba(255, 255, 255, 0.72);
  --text-primary: #1f2937;
  --text-secondary: #6b7280;
  --text-light: #ffffff;
  --success: #10b981;
  --warning: #f59e0b;
  --error: #ef4444;
  
  /* Frosted Glass */
  --frosted-blur: 15px;
  --frosted-blur-hover: 20px;
  
  /* Border Radius */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-pill: 9999px;
  
  /* Shadows */
  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.07);
  --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.1);
  --shadow-hover: 0 15px 30px rgba(0, 0, 0, 0.15);
  
  /* Transitions */
  --transition-fast: 0.2s ease;
  --transition-normal: 0.3s ease;
  --transition-slow: 0.5s ease;
  
  /* Layout */
  --container-max: 1200px;
  --container-padding: 1.5rem;
}

/* ---- Theme Switch Animation ---- */
::view-transition-old(root),
::view-transition-new(root) {
  animation: none;
  mix-blend-mode: normal;
}

.theme-animating::view-transition-group(root) {
  animation-duration: 0.5s;
}

.theme-animating::view-transition-old(root) {
  z-index: 1;
}

.theme-animating.dark::view-transition-new(root) {
  z-index: 999;
  animation: theme-wipe-down 0.5s cubic-bezier(0.25, 1, 0.5, 1) forwards;
}

.theme-animating:not(.dark)::view-transition-new(root) {
  z-index: 999;
  animation: theme-wipe-up 0.5s cubic-bezier(0.25, 1, 0.5, 1) forwards;
}

@keyframes theme-wipe-down {
  from { clip-path: inset(0 0 100% 0); }
  to { clip-path: inset(0 0 0 0); }
}

@keyframes theme-wipe-up {
  from { clip-path: inset(100% 0 0 0); }
  to { clip-path: inset(0 0 0 0); }
}

/* ---- Global Reset & Base ---- */
*, *::before, *::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-primary);
  background: var(--bg-light);
  min-height: 100vh;
  overflow-x: hidden;
}

/* ---- Background System ---- */
.bg-layer {
  position: fixed;
  inset: 0;
  z-index: -2;
  background: url('../assets/扩展背景.png');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  transition: background-image var(--transition-slow);
}

.bg-vignette {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background: radial-gradient(ellipse at center, transparent 0%, rgba(0,0,0,0.03) 100%);
}

/* ---- Scrollbar ---- */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: #c3d0e3;
  border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
  background: #416d9d;
}

/* ---- Glass Card ---- */
.glass-card {
  background: var(--card-bg);
  backdrop-filter: blur(var(--frosted-blur));
  -webkit-backdrop-filter: blur(var(--frosted-blur));
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  transition: all var(--transition-normal);
  will-change: auto;
}

.glass-card:hover {
  background: var(--card-bg-hover);
  box-shadow: var(--shadow-hover);
}

/* When custom wallpaper is active, keep transparency but slightly more opaque */
body.custom-wallpaper .glass-card {
  background: var(--card-bg);
  border-color: rgba(255, 255, 255, 0.5);
}

body.custom-wallpaper .glass-card:hover {
  background: var(--card-bg-hover);
  border-color: rgba(255, 255, 255, 0.6);
}

/* ---- Top Actions ---- */
.top-actions {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 100;
  display: flex;
  gap: 0.5rem;
}

.top-action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  padding: 0;
  color: rgba(255, 255, 255, 0.9);
  background: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: var(--radius-pill);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.top-action-btn:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: translateY(-1px);
  color: white;
}

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

.top-action-btn svg {
  width: 1.25rem;
  height: 1.25rem;
}

/* Icon visibility in theme toggle */
#themeIcon .icon-dark,
.dark #themeIcon .icon-light {
  display: none;
}

.dark #themeIcon .icon-dark {
  display: block;
}

/* ---- Main Container ---- */
.main-container {
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 4rem var(--container-padding) 2rem;
}

/* ---- Site Header ---- */
.site-header {
  text-align: center;
  margin-bottom: 2rem;
  animation: fadeInDown 0.6s ease-out;
}

.site-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}

.site-logo {
  width: 2.5rem;
  height: 2.5rem;
}

.site-title {
  font-size: 2.25rem;
  font-weight: 800;
  color: var(--text-primary);
  margin: 0;
  letter-spacing: -0.02em;
  text-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.site-subtitle {
  font-size: 1rem;
  color: var(--text-secondary);
  margin: 0;
  font-weight: 400;
}

/* ---- Navigation Tabs ---- */
.nav-tabs {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  margin-bottom: 2rem;
  flex-wrap: wrap;
  animation: fadeInUp 0.6s ease-out 0.1s both;
}

.nav-tab {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.5rem 1.25rem;
  border-radius: var(--radius-pill);
  font-size: 0.875rem;
  font-weight: 500;
  text-decoration: none;
  transition: all var(--transition-fast);
  border: 1px solid var(--card-border);
  cursor: pointer;
  background: var(--card-bg);
  color: var(--text-primary);
  backdrop-filter: blur(var(--frosted-blur));
  -webkit-backdrop-filter: blur(var(--frosted-blur));
}

.nav-tab:hover {
  background: var(--card-bg-hover);
  color: var(--text-primary);
  border-color: rgba(255, 255, 255, 0.5);
}

.nav-tab.active {
  background: var(--card-bg-hover);
  color: var(--primary-dark);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  font-weight: 600;
  border-color: rgba(255, 255, 255, 0.6);
}

.nav-tab svg {
  width: 1rem;
  height: 1rem;
}

/* ---- Content Section ---- */
.content-section {
  margin-bottom: 3rem;
  scroll-margin-top: 2rem;
}

.section-header {
  text-align: center;
  margin-bottom: 1.5rem;
}

.section-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0 0 0.25rem;
}

.section-subtitle {
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin: 0;
}

/* ---- Stats Bar ---- */
.stats-bar {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 0.75rem;
  margin-bottom: 1.5rem;
  animation: fadeInUp 0.6s ease-out 0.2s both;
}

.stat-card {
  padding: 1rem;
  text-align: center;
}

.stat-value {
  display: block;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary);
  line-height: 1.2;
}

.stat-label {
  display: block;
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-top: 0.25rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ---- Converter Grid ---- */
.converter-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  animation: fadeInUp 0.6s ease-out 0.3s both;
}

.converter-grid.has-output {
  grid-template-columns: 1fr 1fr;
}

/* ---- Panel ---- */
.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.3);
}

.panel-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}

.panel-title svg {
  width: 1.25rem;
  height: 1.25rem;
  color: var(--primary);
}

.panel-actions {
  display: flex;
  gap: 0.375rem;
}

.panel-body {
  padding: 1.25rem;
}

/* ---- Drop Zone ---- */
.drop-zone {
  border: 2px dashed rgba(37, 99, 235, 0.3);
  border-radius: var(--radius-sm);
  padding: 1.5rem;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition-fast);
  margin-bottom: 1rem;
  background: var(--card-bg);
  backdrop-filter: blur(var(--frosted-blur));
  -webkit-backdrop-filter: blur(var(--frosted-blur));
}

.drop-zone:hover {
  border-color: var(--primary);
  background: var(--card-bg-hover);
}

.drop-zone.drag-over {
  border-color: var(--primary);
  background: var(--card-bg-hover);
}

.drop-zone-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.375rem;
}

.drop-icon {
  color: var(--primary);
  opacity: 0.7;
}

.drop-text {
  margin: 0;
  font-size: 0.8125rem;
  color: var(--text-secondary);
}

.drop-highlight {
  color: var(--primary);
  font-weight: 500;
}

.drop-hint {
  margin: 0;
  font-size: 0.75rem;
  color: var(--text-secondary);
  opacity: 0.7;
}

/* ---- Form Elements ---- */
.form-group {
  margin-bottom: 1rem;
}

.form-label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 0.375rem;
}

.form-input,
.form-textarea,
.form-select {
  width: 100%;
  padding: 0.625rem 0.875rem;
  font-size: 0.8125rem;
  font-family: inherit;
  color: var(--text-primary);
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
  outline: none;
  backdrop-filter: blur(var(--frosted-blur));
  -webkit-backdrop-filter: blur(var(--frosted-blur));
}

.form-input:focus,
.form-textarea:focus,
.form-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
  background: var(--card-bg-hover);
}

.form-textarea {
  resize: vertical;
  min-height: 80px;
}

.form-textarea.node-textarea {
  min-height: 120px;
}

.form-select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
  background-position: right 0.5rem center;
  background-repeat: no-repeat;
  background-size: 1.5em 1.5em;
  padding-right: 2.5rem;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

/* ---- Input Status ---- */
.input-status {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  margin-top: 0.375rem;
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-secondary);
}

.status-dot.ready {
  background: var(--success);
}

/* ---- Latency Row ---- */
.latency-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
  padding: 0.75rem;
  background: var(--card-bg);
  backdrop-filter: blur(var(--frosted-blur));
  -webkit-backdrop-filter: blur(var(--frosted-blur));
  border: 1px solid var(--card-border);
  border-radius: var(--radius-sm);
}

.latency-threshold {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.latency-threshold .form-label {
  margin: 0;
  white-space: nowrap;
}

.latency-input {
  width: 70px;
  text-align: center;
  padding: 0.375rem;
}

/* ---- Checkbox ---- */
.checkbox-label {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8125rem;
  color: var(--text-primary);
  cursor: pointer;
  user-select: none;
}

.checkbox-label input[type="checkbox"] {
  appearance: none;
  width: 1.125rem;
  height: 1.125rem;
  border: 2px solid var(--card-border);
  border-radius: 4px;
  background: var(--card-bg);
  cursor: pointer;
  position: relative;
  transition: all var(--transition-fast);
  flex-shrink: 0;
}

.checkbox-label input[type="checkbox"]:checked {
  background: var(--primary);
  border-color: var(--primary);
}

.checkbox-label input[type="checkbox"]:checked::after {
  content: '';
  position: absolute;
  left: 4px;
  top: 1px;
  width: 5px;
  height: 9px;
  border: solid white;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.checkbox-row {
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
}

/* ---- Buttons ---- */
.btn-primary,
.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.625rem 1.25rem;
  font-size: 0.8125rem;
  font-weight: 600;
  font-family: inherit;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
  border: none;
  outline: none;
  min-height: 2.5rem;
}

.btn-primary {
  background: #4a7dbf;
  color: #ffffff;
  box-shadow: 0 1px 3px rgba(74, 125, 191, 0.2);
}

.btn-primary:hover {
  background: #3d6aa3;
  transform: translateY(-1px);
  box-shadow: 0 2px 6px rgba(74, 125, 191, 0.25);
}

.btn-secondary {
  background: var(--card-bg);
  color: #374151;
  border: 1px solid var(--card-border);
  font-weight: 500;
  backdrop-filter: blur(var(--frosted-blur));
  -webkit-backdrop-filter: blur(var(--frosted-blur));
}

.btn-secondary:hover {
  background: var(--card-bg-hover);
  border-color: rgba(255, 255, 255, 0.5);
  color: #111827;
}

.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  padding: 0;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--text-secondary);
  transition: all var(--transition-fast);
  backdrop-filter: blur(var(--frosted-blur));
  -webkit-backdrop-filter: blur(var(--frosted-blur));
}

.btn-icon:hover {
  background: var(--card-bg-hover);
  color: var(--text-primary);
}

.btn-text {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.5rem 0.75rem;
  font-size: 0.8125rem;
  font-weight: 500;
  font-family: inherit;
  color: var(--primary);
  background: rgba(37, 99, 235, 0.08);
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-text:hover {
  background: rgba(37, 99, 235, 0.15);
}

.action-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  max-width: 420px;
  margin: 0 auto;
}

.action-buttons .btn-secondary {
  white-space: nowrap;
  justify-content: center;
}

/* ---- Client Tabs ---- */
.client-tabs {
  display: flex;
  gap: 0.25rem;
  margin-bottom: 1rem;
  background: rgba(0, 0, 0, 0.03);
  padding: 0.25rem;
  border-radius: var(--radius-sm);
}

.client-tab {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.5rem 0.875rem;
  font-size: 0.8125rem;
  font-weight: 500;
  font-family: inherit;
  color: var(--text-secondary);
  background: transparent;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: all var(--transition-fast);
  flex: 1;
  justify-content: center;
}

.client-tab:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.4);
}

.client-tab.active {
  color: var(--primary);
  background: white;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  font-weight: 600;
}

/* ---- Config Preview ---- */
.preview-area {
  background: rgba(0, 0, 0, 0.04);
  border-radius: var(--radius-sm);
  padding: 0.75rem;
  margin-bottom: 1rem;
  max-height: 300px;
  overflow: auto;
}

.config-preview {
  margin: 0;
  font-size: 0.75rem;
  line-height: 1.6;
  font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
  color: var(--text-primary);
  white-space: pre-wrap;
  word-break: break-all;
}

/* ---- Node List ---- */
.node-list-section {
  margin-top: 1rem;
}

.subsection-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0 0 0.75rem;
}

.node-list {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
  max-height: 250px;
  overflow-y: auto;
  margin-bottom: 0.75rem;
}

.node-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 6px;
  font-size: 0.8125rem;
  animation: fadeIn 0.3s ease both;
  backdrop-filter: blur(var(--frosted-blur));
  -webkit-backdrop-filter: blur(var(--frosted-blur));
}

.node-protocol {
  display: inline-flex;
  align-items: center;
  padding: 0.125rem 0.5rem;
  border-radius: 4px;
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  flex-shrink: 0;
}

.node-protocol.vless { background: rgba(37, 99, 235, 0.1); color: #2563eb; }
.node-protocol.vmess { background: rgba(139, 92, 246, 0.1); color: #8b5cf6; }
.node-protocol.ss { background: rgba(16, 185, 129, 0.1); color: #10b981; }
.node-protocol.socks5 { background: rgba(245, 158, 11, 0.1); color: #f59e0b; }
.node-protocol.trojan { background: rgba(239, 68, 68, 0.1); color: #ef4444; }

.node-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 500;
}

.node-address {
  font-size: 0.75rem;
  color: var(--text-secondary);
  flex-shrink: 0;
}

.node-latency {
  font-size: 0.75rem;
  font-weight: 600;
  flex-shrink: 0;
  padding: 0.125rem 0.375rem;
  border-radius: 4px;
}

.node-latency.low {
  color: #059669;
  background: rgba(16, 185, 129, 0.15);
}

.node-latency.medium {
  color: #d97706;
  background: rgba(245, 158, 11, 0.15);
}

.node-latency.high {
  color: #dc2626;
  background: rgba(239, 68, 68, 0.15);
}

.node-latency.unknown {
  color: var(--text-secondary);
  background: rgba(0, 0, 0, 0.05);
}

.node-latency.probing {
  color: var(--primary);
  background: rgba(37, 99, 235, 0.08);
  font-size: 0.6875rem;
}

/* ---- Features Grid ---- */
.features-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  animation: fadeInUp 0.6s ease-out both;
  align-items: stretch;
}

/* Feature Card - frosted glass with transparency control */
.feature-card {
  padding: 1.75rem 1.5rem;
  text-align: center;
  background: var(--card-bg);
  backdrop-filter: blur(var(--frosted-blur));
  -webkit-backdrop-filter: blur(var(--frosted-blur));
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06), 0 0 1px rgba(0, 0, 0, 0.04);
  transition: all 0.35s cubic-bezier(0.25, 0.8, 0.25, 1);
  position: relative;
  overflow: hidden;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.feature-card:hover {
  transform: translateY(-6px);
  background: var(--card-bg-hover);
  backdrop-filter: blur(var(--frosted-blur-hover));
  -webkit-backdrop-filter: blur(var(--frosted-blur-hover));
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.12), 0 0 1px rgba(0, 0, 0, 0.06);
  border-color: rgba(255, 255, 255, 0.5);
}

.feature-icon-wrap {
  width: 3.25rem;
  height: 3.25rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 14px;
  margin-bottom: 1rem;
  font-size: 1.5rem;
  line-height: 1;
  position: relative;
  z-index: 1;
}

.feature-icon-wrap.c1 { background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%); }
.feature-icon-wrap.c2 { background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%); }
.feature-icon-wrap.c3 { background: linear-gradient(135deg, #fce7f3 0%, #fbcfe8 100%); }
.feature-icon-wrap.c4 { background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%); }
.feature-icon-wrap.c5 { background: linear-gradient(135deg, #e0e7ff 0%, #c7d2fe 100%); }
.feature-icon-wrap.c6 { background: linear-gradient(135deg, #ede9fe 0%, #ddd6fe 100%); }

.feature-title {
  font-size: 1rem;
  font-weight: 700;
  color: #111827;
  margin: 0 0 0.5rem;
  position: relative;
  z-index: 1;
}

.feature-desc {
  font-size: 0.8125rem;
  color: #4b5563;
  margin: 0;
  line-height: 1.7;
  position: relative;
  z-index: 1;
}

/* ---- Steps Grid ---- */
.steps-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  animation: fadeInUp 0.6s ease-out both;
}

/* Step Card - frosted glass with transparency control */
.step-card {
  padding: 1.75rem 1.5rem;
  text-align: center;
  position: relative;
  background: var(--card-bg);
  backdrop-filter: blur(var(--frosted-blur));
  -webkit-backdrop-filter: blur(var(--frosted-blur));
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06), 0 0 1px rgba(0, 0, 0, 0.04);
  transition: all 0.35s cubic-bezier(0.25, 0.8, 0.25, 1);
  overflow: hidden;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.step-card:hover {
  transform: translateY(-6px);
  background: var(--card-bg-hover);
  backdrop-filter: blur(var(--frosted-blur-hover));
  -webkit-backdrop-filter: blur(var(--frosted-blur-hover));
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.12), 0 0 1px rgba(0, 0, 0, 0.06);
  border-color: rgba(255, 255, 255, 0.5);
}

.step-number {
  width: 2.75rem;
  height: 2.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 100%);
  color: white;
  font-size: 1.125rem;
  font-weight: 800;
  border-radius: 14px;
  margin: 0 auto 1rem;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
  position: relative;
  z-index: 1;
}

.step-title {
  font-size: 1rem;
  font-weight: 700;
  color: #111827;
  margin: 0 0 0.5rem;
  position: relative;
  z-index: 1;
}

.step-desc {
  font-size: 0.8125rem;
  color: #4b5563;
  margin: 0;
  line-height: 1.7;
  position: relative;
  z-index: 1;
}

/* ---- Footer ---- */
.site-footer {
  text-align: center;
  padding: 2rem 0;
  margin-top: 2rem;
  animation: fadeIn 0.6s ease-out both;
}

.footer-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}

.footer-logo {
  width: 1.5rem;
  height: 1.5rem;
}

.footer-desc {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  margin: 0 0 0.75rem;
}

.footer-links {
  display: flex;
  justify-content: center;
  gap: 1rem;
  margin-bottom: 0.75rem;
}

.footer-links a {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  text-decoration: none;
  transition: color var(--transition-fast);
}

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

.footer-copyright {
  font-size: 0.75rem;
  color: var(--text-secondary);
  opacity: 0.7;
  margin: 0;
}

/* ---- Modal ---- */
.modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.modal-content {
  position: relative;
  background: white;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 600px;
  max-height: 90vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  animation: modalIn 0.3s ease-out;
}

.modal-large {
  max-width: 700px;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.modal-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}

.modal-title svg {
  color: var(--primary);
}

.modal-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  padding: 0;
  background: none;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  color: var(--text-secondary);
  transition: all var(--transition-fast);
}

.modal-close:hover {
  background: rgba(0, 0, 0, 0.05);
  color: var(--text-primary);
}

.modal-body {
  padding: 1.25rem;
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  padding: 1rem 1.25rem;
  border-top: 1px solid rgba(0, 0, 0, 0.08);
}

@keyframes modalIn {
  from { opacity: 0; transform: translateY(-20px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* ---- Settings Tabs ---- */
.settings-tabs {
  display: flex;
  gap: 0.25rem;
  margin-bottom: 1rem;
  background: rgba(0, 0, 0, 0.03);
  padding: 0.25rem;
  border-radius: var(--radius-sm);
}

.settings-tab {
  padding: 0.5rem 1rem;
  font-size: 0.8125rem;
  font-weight: 500;
  font-family: inherit;
  color: var(--text-secondary);
  background: transparent;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: all var(--transition-fast);
  flex: 1;
}

.settings-tab:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.4);
}

.settings-tab.active {
  color: var(--primary);
  background: white;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  font-weight: 600;
}

.settings-tab-content {
  display: none;
}

.settings-tab-content.active {
  display: block;
}

/* ---- Settings Group ---- */
.settings-group {
  margin-bottom: 1rem;
}

.settings-group:last-child {
  margin-bottom: 0;
}

.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 0;
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

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

.settings-label {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
}

.toggle-row {
  justify-content: space-between;
}

/* ---- Slider ---- */
.slider-control {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex: 1;
  justify-content: flex-end;
}

.slider-control span {
  font-size: 0.75rem;
  color: var(--text-secondary);
  min-width: 3rem;
  text-align: right;
}

.slider {
  -webkit-appearance: none;
  appearance: none;
  width: 120px;
  height: 4px;
  background: rgba(0, 0, 0, 0.1);
  border-radius: 2px;
  outline: none;
  cursor: pointer;
}

.slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  background: var(--primary);
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(37, 99, 235, 0.3);
  transition: transform var(--transition-fast);
}

.slider::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}

.slider::-moz-range-thumb {
  width: 16px;
  height: 16px;
  background: var(--primary);
  border-radius: 50%;
  cursor: pointer;
  border: none;
  box-shadow: 0 1px 3px rgba(37, 99, 235, 0.3);
}

/* ---- Toggle Switch ---- */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 40px;
  height: 22px;
  cursor: pointer;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.15);
  border-radius: 11px;
  transition: background var(--transition-fast);
}

.toggle-slider::before {
  content: '';
  position: absolute;
  height: 18px;
  width: 18px;
  left: 2px;
  bottom: 2px;
  background: white;
  border-radius: 50%;
  transition: transform var(--transition-fast);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}

.toggle-switch input:checked + .toggle-slider {
  background: var(--primary);
}

.toggle-switch input:checked + .toggle-slider::before {
  transform: translateX(18px);
}

/* ---- Radio Group ---- */
.radio-group {
  display: flex;
  gap: 0.5rem;
}

.radio-option {
  cursor: pointer;
}

.radio-option input {
  position: absolute;
  opacity: 0;
}

.radio-label {
  display: inline-block;
  padding: 0.5rem 1rem;
  font-size: 0.8125rem;
  color: var(--text-secondary);
  background: rgba(0, 0, 0, 0.03);
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
}

.radio-option:hover .radio-label {
  background: rgba(0, 0, 0, 0.06);
  color: var(--text-primary);
}

.radio-option input:checked + .radio-label {
  background: var(--primary);
  color: white;
  font-weight: 500;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

/* ---- Upload Zone ---- */
.upload-zone {
  border: 2px dashed rgba(37, 99, 235, 0.3);
  border-radius: var(--radius-sm);
  padding: 1.5rem;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition-fast);
  background: rgba(255, 255, 255, 0.3);
}

.upload-zone:hover {
  border-color: var(--primary);
  background: rgba(37, 99, 235, 0.05);
}

.upload-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.375rem;
}

.upload-icon {
  color: var(--primary);
  opacity: 0.7;
}

.upload-text {
  margin: 0;
  font-size: 0.8125rem;
  color: var(--text-secondary);
}

.upload-hint {
  margin: 0;
  font-size: 0.75rem;
  color: var(--text-secondary);
  opacity: 0.7;
}

.upload-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem;
  background: rgba(16, 185, 129, 0.08);
  border-radius: var(--radius-sm);
  margin-top: 0.75rem;
}

.upload-status .status-text {
  font-size: 0.8125rem;
  color: #059669;
}

/* ---- Example Tabs ---- */
.example-tabs {
  display: flex;
  gap: 0.25rem;
  margin-bottom: 1rem;
  background: rgba(0, 0, 0, 0.03);
  padding: 0.25rem;
  border-radius: var(--radius-sm);
}

.example-tab {
  padding: 0.5rem 1rem;
  font-size: 0.8125rem;
  font-weight: 500;
  font-family: inherit;
  color: var(--text-secondary);
  background: transparent;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.example-tab:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.4);
}

.example-tab.active {
  color: var(--primary);
  background: white;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  font-weight: 600;
}

.example-content {
  display: none;
}

.example-content.active {
  display: block;
}

.code-block {
  background: rgba(0, 0, 0, 0.04);
  border-radius: var(--radius-sm);
  padding: 1rem;
  margin: 0;
  overflow-x: auto;
}

.code-block code {
  font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
  font-size: 0.75rem;
  line-height: 1.6;
  color: var(--text-primary);
}

/* ---- Toast ---- */
.toast-container {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  pointer-events: none;
}

.toast {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.25rem;
  background: white;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  font-size: 0.8125rem;
  font-weight: 500;
  animation: toastIn 0.3s ease-out;
  pointer-events: auto;
}

.toast.success { color: #059669; }
.toast.error { color: #dc2626; }
.toast.info { color: var(--primary); }

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

@keyframes toastOut {
  from { opacity: 1; transform: translateY(0); }
  to { opacity: 0; transform: translateY(-10px); }
}

/* ---- Loading Overlay ---- */
.loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 400;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.loading-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid rgba(37, 99, 235, 0.2);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.loading-text {
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin: 0;
}

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

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

@keyframes fadeInDown {
  from { opacity: 0; transform: translateY(-20px); }
  to { opacity: 1; transform: translateY(0); }
}

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

/* Card enter animation */
.card-enter {
  animation: cardSlideUp 0.6s ease-out both;
}

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

/* ---- Reduced Motion ---- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  
  html {
    scroll-behavior: auto;
  }
}
