/* TwProgressBar — style.css */

/* Google Fonts are loaded via <link> in index.html for better performance */

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

:root {
  /* Colors */
  --bg:             #080810;
  --bg-1:           #0e0e1c;
  --bg-2:           #13132a;
  --bg-3:           #181830;
  --surface:        rgba(255,255,255,0.04);
  --surface-hover:  rgba(255,255,255,0.07);

  --purple:         #8b5cf6;
  --purple-light:   #a78bfa;
  --purple-dim:     rgba(139,92,246,0.15);
  --purple-glow:    rgba(139,92,246,0.35);
  --cyan:           #22d3ee;
  --cyan-dim:       rgba(34,211,238,0.12);
  --danger:         #f43f5e;
  --success:        #10b981;

  --border:         rgba(255,255,255,0.08);
  --border-active:  rgba(139,92,246,0.5);
  --text:           #e2e2f0;
  --text-2:         #9090b0;
  --text-3:         #5a5a78;

  /* Typography */
  --font:           'Inter', system-ui, sans-serif;
  --mono:           'JetBrains Mono', monospace;

  /* Radii */
  --r-sm:   6px;
  --r-md:   10px;
  --r-lg:   16px;
  --r-xl:   24px;

  /* Motion */
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --t:    0.2s;
}

html { scroll-behavior: smooth; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }
.container { max-width: 1160px; margin: 0 auto; padding: 0 28px; }

/* BUTTONS */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 9px 18px; border-radius: var(--r-md);
  font-family: var(--font); font-size: 14px; font-weight: 600;
  cursor: pointer; border: none; transition: all var(--t) var(--ease);
  text-decoration: none; white-space: nowrap; outline: none; letter-spacing: 0.01em;
}
.btn-primary {
  background: var(--purple);
  color: #fff;
  box-shadow: 0 0 0 0 var(--purple-glow);
}
.btn-primary:hover {
  background: var(--purple-light);
  box-shadow: 0 0 24px var(--purple-glow);
  transform: translateY(-1px);
}
.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-secondary:hover { background: var(--surface-hover); border-color: var(--border-active); }
.btn-ghost {
  background: transparent;
  color: var(--text-2);
  border: 1px solid transparent;
}
.btn-ghost:hover { background: var(--surface); color: var(--text); border-color: var(--border); }
.btn-outline-accent {
  background: transparent;
  color: var(--cyan);
  border: 1px solid rgba(34,211,238,0.35);
}
.btn-outline-accent:hover { background: var(--cyan-dim); }
.btn-sm  { padding: 7px 14px; font-size: 13px; }
.btn-xs  { padding: 4px 10px; font-size: 12px; border-radius: var(--r-sm); }
.btn-block { width: 100%; }
.btn-hero { padding: 14px 32px; font-size: 16px; border-radius: var(--r-xl); }
.btn-login { padding: 9px 20px; border-radius: var(--r-md); }

.twitch-icon { width: 16px; height: 16px; flex-shrink: 0; }

/* HERO */
.hero {
  position: relative; min-height: auto;
  display: flex; flex-direction: column; padding-bottom: 40px;
}

.hero-bg {
  position: absolute; inset: 0; z-index: 0;
  background:
    radial-gradient(ellipse 70% 50% at 50% -10%, rgba(139,92,246,0.22) 0%, transparent 60%),
    radial-gradient(ellipse 40% 30% at 85% 85%, rgba(34,211,238,0.08) 0%, transparent 55%),
    var(--bg);
}

/* Subtle grid overlay */
.hero-bg::after {
  content: '';
  position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.025) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse 80% 80% at 50% 0%, black 0%, transparent 70%);
}

/* NAV */
.nav {
  position: sticky; top: 0; z-index: 1000;
  background: rgba(13, 13, 26, 0.85);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(255,255,255,0.05);
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 40px;
}
.nav-logo { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.logo-mark {
  width: 32px; height: 32px; border-radius: var(--r-sm);
  background: linear-gradient(135deg, var(--purple), var(--cyan));
  display: flex; align-items: center; justify-content: center;
  font-size: 16px;
}
.logo-text {
  font-size: 18px; font-weight: 700; letter-spacing: -0.02em;
  color: var(--text);
}
.logo-text span { color: var(--purple-light); }

.user-info { display: flex; align-items: center; gap: 10px; }
.user-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  border: 1.5px solid var(--border-active); object-fit: cover;
}
.user-name { font-size: 14px; font-weight: 600; color: var(--text); }

/* HERO CONTENT */
.hero-content {
  position: relative; z-index: 2;
  flex: 1; display: flex; flex-direction: column; align-items: center;
  justify-content: center; text-align: center; padding: 60px 40px 40px;
}

.hero-badge {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 5px 14px; border-radius: 100px;
  background: var(--purple-dim); border: 1px solid rgba(139,92,246,0.3);
  font-size: 12px; font-weight: 600; color: var(--purple-light);
  letter-spacing: 0.05em; text-transform: uppercase;
  margin-bottom: 28px;
}
.hero-badge-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--purple-light);
  animation: pulse 2s ease infinite;
}
@keyframes pulse {
  0%,100% { opacity: 1; transform: scale(1); }
  50%      { opacity: 0.5; transform: scale(0.8); }
}

.hero-title {
  font-size: clamp(2.4rem, 6vw, 4rem);
  font-weight: 800; line-height: 1.1;
  letter-spacing: -0.04em; margin-bottom: 20px;
  color: var(--text);
}
.gradient-text {
  background: linear-gradient(120deg, var(--purple-light) 0%, var(--cyan) 100%);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}
.hero-subtitle {
  font-size: 17px; color: var(--text-2); max-width: 520px;
  margin: 0 auto 36px; line-height: 1.7; font-weight: 400;
}

/* HERO DEMO */
.hero-demo { position: relative; z-index: 2; display: flex; justify-content: center; padding: 0 40px; }
.demo-widget {
  width: 100%; max-width: 580px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  padding: 28px 32px;
  box-shadow: 0 24px 80px rgba(0,0,0,0.5), 0 0 0 1px var(--border);
}
.demo-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.demo-label { font-size: 13px; font-weight: 600; color: var(--text-2); text-transform: uppercase; letter-spacing: 0.08em; }
.demo-pts { font-size: 13px; font-weight: 700; color: var(--purple-light); font-family: var(--mono); }
.demo-bar-bg {
  position: relative; height: 12px;
  background: rgba(255,255,255,0.06); border-radius: 100px; overflow: visible;
  margin-bottom: 12px;
}
.demo-bar-fill {
  height: 100%; width: 75%; border-radius: 100px;
  background: linear-gradient(90deg, var(--purple), var(--cyan));
  animation: demo-grow 4s ease-in-out infinite alternate;
  box-shadow: 0 0 16px var(--purple-glow);
}
.demo-icon {
  position: absolute; top: 50%; right: calc(25% - 14px); transform: translate(50%, -50%);
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--bg-1); border: 2px solid var(--purple);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px;
  animation: demo-grow 4s ease-in-out infinite alternate;
}
.demo-text { font-size: 12px; color: var(--text-3); text-align: right; font-family: var(--mono); }
@keyframes demo-grow { from { width: 60%; } to { width: 80%; } }

/* SETTINGS SECTION */
.main { padding: 96px 0; }
.section-header { text-align: center; margin-bottom: 56px; }
.section-tag {
  display: inline-block; font-size: 11px; font-weight: 700; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--purple-light);
  margin-bottom: 14px;
}
.section-title {
  font-size: clamp(1.6rem, 3vw, 2.2rem); font-weight: 800;
  letter-spacing: -0.03em; margin-bottom: 10px;
}
.section-desc { color: var(--text-2); font-size: 16px; }

/* Login banner */
.login-banner {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  background: var(--purple-dim);
  border: 1px solid rgba(139,92,246,0.25);
  border-radius: var(--r-lg); padding: 14px 20px; margin-bottom: 28px;
  font-size: 14px; font-weight: 500;
}

/* Layout grid */
.settings-layout {
  display: grid; grid-template-columns: 1fr 1fr; gap: 32px;
}
@media (max-width: 900px) { .settings-layout { grid-template-columns: 1fr; } }

/* Settings panel */
.settings-panel { display: flex; flex-direction: column; gap: 2px; }

/* Individual settings section */
.settings-section {
  border: none; padding: 0;
  background: transparent;
  border-radius: 0;
  overflow: hidden;
  transition: var(--t) var(--ease);
}

.section-card {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  margin-bottom: 8px;
  overflow: hidden;
  transition: border-color var(--t) var(--ease);
}
.section-card:focus-within { border-color: rgba(139,92,246,0.4); }

.section-card-header {
  display: flex; align-items: center; gap: 10px;
  padding: 16px 20px;
  cursor: default;
}
.section-card-icon {
  width: 32px; height: 32px; border-radius: var(--r-sm);
  background: var(--surface); border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: 15px; flex-shrink: 0;
}
.section-card-title { font-size: 14px; font-weight: 700; color: var(--text); }
.section-card-body { padding: 0 20px 20px; }

.section-legend { /* legacy compat */
  font-size: 13px; font-weight: 700; color: var(--text); margin-bottom: 14px;
}

/* Form elements */
.form-group { margin-bottom: 16px; }
.form-group:last-child { margin-bottom: 0; }
.form-label {
  display: block; font-size: 11px; font-weight: 600;
  color: var(--text-3); margin-bottom: 8px;
  text-transform: uppercase; letter-spacing: 0.08em;
}
.form-input {
  width: 100%;
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  color: var(--text);
  font-family: var(--font); font-size: 14px;
  padding: 9px 12px;
  transition: border-color var(--t), box-shadow var(--t);
  outline: none; resize: vertical;
}
.form-input:focus {
  border-color: var(--purple);
  box-shadow: 0 0 0 3px var(--purple-dim);
}
.form-input-sm { width: 120px; }
.form-input-xs { width: 72px; }
.form-hint { font-size: 12px; color: var(--text-3); margin-top: 6px; line-height: 1.5; }

.range-row { display: flex; align-items: center; gap: 12px; }
.form-range {
  flex: 1; accent-color: var(--purple); cursor: pointer; height: 4px;
}
.range-val {
  font-size: 13px; font-weight: 700; color: var(--purple-light);
  font-family: var(--mono); min-width: 44px; text-align: right;
}

/* Reward list */
.reward-list-container {
  max-height: 200px; overflow-y: auto;
  background: var(--bg-3); border: 1px solid var(--border);
  border-radius: var(--r-sm); padding: 8px;
  display: flex; flex-direction: column; gap: 2px;
}
.reward-list-container::-webkit-scrollbar { width: 4px; }
.reward-list-container::-webkit-scrollbar-track { background: transparent; }
.reward-list-container::-webkit-scrollbar-thumb { background: var(--border-active); border-radius: 2px; }

.reward-list-placeholder {
  font-size: 13px; color: var(--text-3);
  text-align: center; padding: 24px 0; line-height: 1.6;
}
.checkbox-option {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: var(--r-sm);
  cursor: pointer; font-size: 13px; font-weight: 500;
  transition: background var(--t);
}
.checkbox-option:hover { background: var(--surface-hover); }
.checkbox-option input[type="checkbox"] {
  accent-color: var(--purple); width: 15px; height: 15px; cursor: pointer; flex-shrink: 0;
}
.reward-title { flex: 1; }
.reward-cost { font-size: 11px; color: var(--text-3); font-family: var(--mono); }

/* Reward badges for disabled/paused state */
.reward-disabled { opacity: 0.5; filter: grayscale(1); }
.reward-paused { opacity: 0.7; }
.reward-badge {
  font-size: 10px; padding: 2px 6px; border-radius: 4px;
  font-weight: 700; margin-left: auto; letter-spacing: 0.05em;
}
.badge-disabled { background: rgba(255,255,255,0.1); color: #aaa; border: 1px solid rgba(255,255,255,0.2); }
.badge-paused { background: rgba(234,179,8,0.15); color: #facc15; border: 1px solid rgba(234,179,8,0.3); }
/* Radio group */
.radio-group { display: flex; flex-wrap: wrap; gap: 8px; }
.radio-option {
  display: flex; align-items: center; gap: 8px; cursor: pointer;
  background: var(--bg-3); border: 1px solid var(--border);
  border-radius: var(--r-sm); padding: 7px 12px;
  font-size: 13px; font-weight: 500; transition: all var(--t);
}
.radio-option:has(input:checked) {
  border-color: var(--purple); color: var(--purple-light);
  background: var(--purple-dim);
}
.radio-option input { accent-color: var(--purple); }

/* Toggle */
.toggle {
  position: relative; display: inline-block;
  width: 44px; height: 24px; cursor: pointer;
}
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute; inset: 0;
  background: var(--bg-3); border-radius: 100px;
  border: 1px solid var(--border); transition: all var(--t);
}
.toggle-slider::after {
  content: ''; position: absolute;
  top: 3px; left: 3px; width: 16px; height: 16px;
  border-radius: 50%; background: var(--text-3); transition: all var(--t);
}
.toggle input:checked + .toggle-slider {
  background: var(--purple); border-color: var(--purple);
}
.toggle input:checked + .toggle-slider::after {
  transform: translateX(20px); background: #fff;
}

/* Color picker */
.color-input-row { display: flex; align-items: center; gap: 10px; }
.color-picker {
  width: 40px; height: 40px;
  border: 1px solid var(--border); border-radius: var(--r-sm);
  cursor: pointer; padding: 2px; background: var(--bg-3);
  transition: border-color var(--t);
}
.color-picker:hover { border-color: var(--border-active); }

/* Gradient stops */
.gradient-stops { display: flex; flex-direction: column; gap: 8px; }
.gradient-stop-row { display: flex; align-items: center; gap: 8px; }
.stop-unit { font-size: 12px; color: var(--text-3); }
.stop-remove { color: var(--danger); font-size: 12px; }

/* Effect grid */
.effect-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.effect-option {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  background: var(--bg-3); border: 1px solid var(--border);
  border-radius: var(--r-md); padding: 14px 8px;
  cursor: pointer; font-size: 12px; font-weight: 600; text-align: center;
  transition: all var(--t);
}
.effect-option input { display: none; }
.effect-option .effect-icon { font-size: 24px; }
.effect-option:has(input:checked) {
  border-color: var(--purple); background: var(--purple-dim); color: var(--purple-light);
}

/* PREVIEW PANEL (right column) */
.preview-panel { }
.preview-sticky { position: sticky; top: 100px; display: flex; flex-direction: column; gap: 16px; }

.preview-card {
  background: var(--bg-1); border: 1px solid var(--border);
  border-radius: var(--r-lg); overflow: hidden;
}
.preview-card-header {
  padding: 12px 18px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.preview-title {
  font-size: 12px; font-weight: 700; color: var(--text-2);
  text-transform: uppercase; letter-spacing: 0.08em;
}
.preview-box {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  background: repeating-conic-gradient(#111122 0% 25%, #0d0d20 0% 50%) 0 0 / 12px 12px;
  overflow: hidden;
}
.preview-screen {
  position: absolute;
  top: 0; left: 0;
  width: 800px;
  height: 600px;
  transform-origin: top left;
}
.preview-bg {
  position: absolute; inset: 0; z-index: 0;
  background: transparent; background-size: cover; background-position: center;
  transition: background 0.3s;
}
.preview-container {
  position: relative; z-index: 2; width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center; padding: 4% 8%;
}
.preview-wrapper {
  width: 100%; display: flex; flex-direction: column; gap: 8px;
}
.preview-bar-title {
  text-align: center; color: white; font-weight: bold;
  text-shadow: 0 2px 8px rgba(0,0,0,0.8); margin-bottom: 4px;
}
.preview-bar-track {
  position: relative; width: 100%; height: var(--bar-height, 36px);
  background: rgba(255,255,255,0.15); border-radius: 100px; overflow: visible;
  box-shadow: inset 0 2px 6px rgba(0,0,0,0.3);
}
.preview-bar-fill {
  position: absolute; top: 0; left: 0;
  height: 100%; width: 75%; border-radius: 100px;
  background: linear-gradient(90deg, var(--purple), var(--cyan));
  transition: width 0.6s cubic-bezier(0.25, 1, 0.5, 1);
  box-shadow: 0 0 20px rgba(145, 70, 255, 0.6), 0 0 40px rgba(145, 70, 255, 0.3);
}
.preview-bar-icon {
  position: absolute; top: 50%; right: calc(25% - 18px); transform: translate(50%, -50%);
  width: 44px; height: 44px; border-radius: 50%; overflow: hidden;
  border: 3px solid rgba(255,255,255,0.6); background: #0d0d1a;
  transition: right 0.6s cubic-bezier(0.25, 1, 0.5, 1);
  box-shadow: 0 0 12px rgba(145, 70, 255, 0.5); display: none;
}
.preview-bar-icon img { width: 100%; height: 100%; object-fit: cover; }
.preview-bar-text { 
  text-align: center; font-size: 16px; color: #fff; font-weight: 700; 
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.8), 0 0 16px rgba(145, 70, 255, 0.4);
  letter-spacing: 0.02em; white-space: nowrap;
}
.effect-canvas {
  position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 1;
}
/* Preview controls (gauge + effect button) */
.preview-controls {
  display: flex; flex-direction: column; gap: 10px;
  padding: 12px 16px; border-top: 1px solid var(--border);
  background: var(--bg-1);
}
.preview-gauge-row {
  display: flex; align-items: center; gap: 10px;
}
.preview-controls-label {
  font-size: 11px; font-weight: 700; color: var(--text-3);
  text-transform: uppercase; letter-spacing: 0.08em; white-space: nowrap;
}
#btn-preview-effect {
  width: 100%; justify-content: center;
}

/* URL generation card */
.url-card {
  background: var(--bg-1); border: 1px solid var(--border);
  border-radius: var(--r-lg); overflow: hidden;
}
.url-card-header {
  padding: 14px 18px; border-bottom: 1px solid var(--border);
}
.url-card-title {
  font-size: 12px; font-weight: 700; color: var(--text-2);
  text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 2px;
}
.url-card-sub { font-size: 12px; color: var(--text-3); }
.url-card-body { padding: 16px 18px; display: flex; flex-direction: column; gap: 10px; }

.security-warning {
  display: flex; align-items: flex-start; gap: 8px;
  background: rgba(234,179,8,0.07); border: 1px solid rgba(234,179,8,0.2);
  border-radius: var(--r-sm); padding: 10px 12px;
  font-size: 12px; color: #eab308; line-height: 1.5;
}

.url-output { display: flex; flex-direction: column; gap: 8px; }
.url-textarea {
  width: 100%; height: 72px;
  background: var(--bg-3); border: 1px solid var(--border);
  border-radius: var(--r-sm); color: var(--cyan);
  font-family: var(--mono); font-size: 11px;
  padding: 10px 12px; resize: none; outline: none;
  word-break: break-all; line-height: 1.5;
}
.url-copied {
  color: var(--success); font-size: 12px; font-weight: 600; text-align: center;
}

.url-divider {
  display: flex; align-items: center; gap: 10px;
  font-size: 11px; color: var(--text-3); margin: 4px 0;
}
.url-divider::before, .url-divider::after {
  content: ''; flex: 1; height: 1px; background: var(--border);
}

/* HOW TO */
.howto {
  padding: 60px 0;
  background: var(--bg-1);
  border-top: 1px solid var(--border);
}
.steps {
  display: flex; align-items: flex-start; justify-content: center;
  gap: 0; flex-wrap: wrap; margin-top: 56px;
}
.step {
  display: flex; flex-direction: column; align-items: center; gap: 14px;
  text-align: center; max-width: 180px; padding: 0 16px;
}
.step-num {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--purple-dim); border: 1px solid rgba(139,92,246,0.4);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 800; color: var(--purple-light);
}
.step-icon { font-size: 32px; }
.step-title { font-size: 14px; font-weight: 700; }
.step-desc { font-size: 12px; color: var(--text-2); line-height: 1.6; }
.step-arrow {
  font-size: 18px; color: var(--text-3); padding-top: 72px; flex-shrink: 0;
}

/* FOOTER */
.footer {
  padding: 32px; text-align: center;
  color: var(--text-3); font-size: 13px;
  border-top: 1px solid var(--border);
}

/* UTILITIES */
.mt-sm { margin-top: 10px; }
.centered { text-align: center; }
