/* ==========================================================================
   ERC Unlock Platform — Cleo Inspired Ultra-Premium Design System
   Sleek Espresso Cocoa Dark Mode, Retro-Chic Glassmorphism & High-Fidelity Details
   ========================================================================== */

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

:root {
  color-scheme: dark; /* dark native scrollbars, autofill & form controls */

  /* Cleo Curated Palette */
  --primary: #ff7a59;            /* Warm Coral Orange */
  --primary-rgb: 255, 122, 89;
  --primary-dark: #e05e3c;
  
  --secondary: #b87a6b;          /* Soft Clay Cream */
  --secondary-rgb: 184, 122, 107;
  
  --accent: #ffd3b6;             /* Cream Amber Glow */
  --bg-color: #0c0706;           /* Rich Espresso Obsidian */
  
  --card-bg: rgba(22, 13, 11, 0.65);
  --input-bg: rgba(255, 255, 255, 0.02);
  --border-color: rgba(255, 255, 255, 0.05);
  --border-focus: rgba(255, 122, 89, 0.5);
  
  --text-main: #fffbf7;          /* Soft Off-White */
  --text-muted: #c2b3ae;         /* Warm Sandy Slate */
  --text-dim: #73635e;           /* Deep Clay */
  
  --success: #55d677;
  --error: #ff6b64;
  
  /* Font fallbacks using standard & Google fonts loaded in index.html */
  --font-sans: var(--pp-neue-montreal), 'Space Grotesk', 'Plus Jakarta Sans', system-ui, sans-serif;
  --font-mono: var(--simplon-mono), 'Space Mono', monospace;
  
  --transition-smooth: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  --transition-fast: all 0.15s ease;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-color);
  color: var(--text-main);
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  flex-direction: column; /* stacked flow so the footer can sit below content on mobile */
  align-items: center;
  justify-content: center;
  overflow-x: hidden;
  position: relative;
}

/* ── Glowing Atmosphere Background ── */
.background-overlay {
  position: fixed;
  inset: 0;
  background: 
    radial-gradient(circle at 50% -20%, rgba(var(--primary-rgb), 0.15) 0%, transparent 60%),
    radial-gradient(circle at 10% 90%, rgba(184, 122, 107, 0.06) 0%, transparent 50%),
    radial-gradient(circle at 90% 80%, rgba(255, 211, 182, 0.04) 0%, transparent 40%);
  pointer-events: none;
  z-index: -1;
}

/* Drifting Glow Orbs */
.glow-orbs-container {
  position: fixed;
  inset: 0;
  overflow: hidden;
  z-index: -2;
  pointer-events: none;
}

.glow-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(140px);
  opacity: 0.18;
  mix-blend-mode: screen;
}

.orb-1 {
  width: 450px;
  height: 450px;
  background: radial-gradient(circle, var(--primary) 0%, transparent 80%);
  top: -120px;
  left: 20%;
  animation: float-1 25s infinite alternate ease-in-out;
}

.orb-2 {
  width: 550px;
  height: 550px;
  background: radial-gradient(circle, var(--secondary) 0%, transparent 80%);
  bottom: -180px;
  right: 12%;
  animation: float-2 30s infinite alternate ease-in-out;
}

.orb-3 {
  width: 320px;
  height: 320px;
  background: radial-gradient(circle, var(--accent) 0%, transparent 80%);
  top: 45%;
  left: -80px;
  animation: float-3 20s infinite alternate ease-in-out;
}

/* ── Container Layout ── */
.app-container {
  position: relative;
  z-index: 1;
  width: 100%;
  margin: auto; /* safe centering: keeps top reachable when the card outgrows short viewports */
  display: flex;
  align-items: center;
  justify-content: center;
  /* bottom padding clears the fixed glass footer on desktop */
  padding: 32px 16px 130px;
  min-height: 100vh;
  min-height: 100svh;
}

/* ── Cleo Premium Glassmorphic Card ── */
.calculator-card {
  background: var(--card-bg);
  backdrop-filter: blur(40px) saturate(220%);
  -webkit-backdrop-filter: blur(40px) saturate(220%);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 28px;
  padding: 44px 40px;
  width: 100%;
  max-width: 440px;
  position: relative;
  box-shadow: 
    0 40px 90px rgba(0, 0, 0, 0.75),
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    0 0 50px rgba(var(--primary-rgb), 0.04);
  overflow: hidden;
  transition: var(--transition-smooth);
}

.calculator-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1.5px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), var(--primary), rgba(255, 255, 255, 0.1), transparent);
}

.calculator-card:hover {
  border-color: rgba(255, 122, 89, 0.2);
  box-shadow: 
    0 45px 100px rgba(0, 0, 0, 0.8),
    inset 0 1px 0 rgba(255, 255, 255, 0.12),
    0 0 60px rgba(var(--primary-rgb), 0.08);
}

.hidden {
  display: none !important;
}

/* ── Card Header & Brand Logo ── */
.logo-container {
  display: flex;
  justify-content: center;
  margin-bottom: 28px;
  position: relative;
}

.tech-logo-wrapper {
  width: 68px;
  height: 68px;
  background: radial-gradient(circle, rgba(var(--primary-rgb), 0.12) 0%, rgba(255, 255, 255, 0.01) 100%);
  border: 1.5px solid rgba(var(--primary-rgb), 0.25);
  border-radius: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);
  box-shadow: 
    0 10px 28px rgba(var(--primary-rgb), 0.12),
    inset 0 1px 1px rgba(255, 255, 255, 0.05);
  position: relative;
  z-index: 1;
  transition: var(--transition-smooth);
}

.logo-container:hover .tech-logo-wrapper {
  transform: rotate(-6deg) scale(1.08);
  border-color: var(--primary);
  color: #ff9a80;
  box-shadow: 
    0 14px 32px rgba(var(--primary-rgb), 0.22),
    inset 0 1px 1px rgba(255, 255, 255, 0.15);
}

.logo-glow {
  position: absolute;
  width: 90px;
  height: 90px;
  background: radial-gradient(circle, rgba(var(--primary-rgb), 0.2) 0%, transparent 70%);
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 0;
  pointer-events: none;
  filter: blur(6px);
}

.tech-logo {
  width: 32px;
  height: 32px;
  filter: drop-shadow(0 2px 6px rgba(var(--primary-rgb), 0.25));
}

.card-header {
  text-align: center;
  margin-bottom: 36px;
}

.title {
  font-family: var(--font-sans);
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -1.2px;
  background: linear-gradient(135deg, #ffffff 0%, #dcd1cd 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 8px;
}

.subtitle {
  font-size: 14px;
  color: var(--text-muted);
  font-weight: 400;
  letter-spacing: -0.1px;
}

/* ── Top Bar (Pills & Navigation) ── */
.header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 28px;
  background: rgba(255, 255, 255, 0.015);
  border: 1px solid rgba(255, 255, 255, 0.04);
  padding: 10px 18px;
  border-radius: 16px;
}

.token-badge {
  background: rgba(var(--primary-rgb), 0.06);
  border: 1px solid rgba(var(--primary-rgb), 0.15);
  color: #ff9175;
  font-size: 12px;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: 99px;
  letter-spacing: 0.1px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.token-badge b {
  color: var(--primary);
  font-weight: 700;
}

.lifetime-badge {
  background: rgba(85, 214, 119, 0.06);
  border: 1px solid rgba(85, 214, 119, 0.2);
  color: #6ce98d;
  font-size: 11px;
  font-weight: 700;
  padding: 6px 14px;
  border-radius: 99px;
  letter-spacing: 0.8px;
}

.logout-link {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--transition-fast);
  padding: 6px 12px;
  border-radius: 8px;
}

.logout-link:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.04);
}

/* ── Form Fields & Inputs ── */
.calculator-form {
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.input-group {
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.field-label, .input-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}

.input-icon {
  position: absolute;
  left: 16px;
  width: 18px;
  height: 18px;
  color: var(--text-dim);
  pointer-events: none;
  transition: var(--transition-fast);
}

.text-input {
  background: var(--input-bg);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  color: var(--text-main);
  font-family: inherit;
  /* 16px minimum: iOS Safari zooms the page when focusing smaller inputs */
  font-size: 16px;
  padding: 14px 16px 14px 48px;
  width: 100%;
  outline: none;
  transition: var(--transition-smooth);
}

/* only the password field needs right-side clearance for the visibility toggle */
.input-wrapper #p {
  padding-right: 48px;
}

.text-input:hover {
  border-color: rgba(255, 122, 89, 0.2);
  background: rgba(255, 255, 255, 0.03);
}

.text-input:focus {
  border-color: var(--border-focus);
  background: rgba(255, 255, 255, 0.04);
  box-shadow: 
    0 0 0 4px rgba(var(--primary-rgb), 0.12),
    inset 0 1px 1px rgba(0, 0, 0, 0.3);
}

.text-input:focus ~ .input-icon,
.input-wrapper:focus-within .input-icon {
  color: var(--primary);
}

.text-input::placeholder {
  color: rgba(255, 255, 255, 0.15);
}

/* keep browser autofill dark instead of flashing white on the espresso theme */
.text-input:-webkit-autofill,
.text-input:-webkit-autofill:hover,
.text-input:-webkit-autofill:focus {
  -webkit-text-fill-color: var(--text-main);
  -webkit-box-shadow: 0 0 0 1000px #1a100d inset;
  caret-color: var(--text-main);
  border-color: rgba(255, 122, 89, 0.25);
  font-family: inherit;
  font-size: 16px;
}

/* Password Toggle */
.password-toggle {
  position: absolute;
  right: 14px;
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6px;
  border-radius: 8px;
  transition: var(--transition-fast);
  outline: none;
}

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

.eye-icon {
  width: 18px;
  height: 18px;
}

/* ── Select Input Custom ── */
.select-wrapper {
  position: relative;
  width: 100%;
}

.select-input {
  background: var(--input-bg);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  color: var(--text-main);
  font-family: inherit;
  font-size: 16px; /* 16px prevents iOS Safari focus zoom */
  padding: 14px 40px 14px 16px;
  width: 100%;
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
  outline: none;
  transition: var(--transition-fast);
}

.select-input:hover {
  border-color: rgba(255, 122, 89, 0.2);
  background: rgba(255, 255, 255, 0.03);
}

.select-input:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 4px rgba(var(--primary-rgb), 0.12);
}

.select-wrapper::after {
  content: '';
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  width: 10px;
  height: 6px;
  background-color: var(--text-muted);
  clip-path: polygon(100% 0, 0 0, 50% 100%);
  pointer-events: none;
  transition: var(--transition-fast);
}

.select-wrapper:focus-within::after {
  background-color: var(--primary);
  transform: translateY(-50%) rotate(180deg);
}

.select-input option {
  background-color: #170d0c;
  color: var(--text-main);
}

/* ── Retro-Modern Premium Buttons ── */
.submit-btn {
  background: linear-gradient(135deg, var(--primary) 0%, #cc5a3d 50%, var(--primary) 100%);
  background-size: 200% auto;
  border: none;
  border-radius: 14px;
  color: #0a0505;
  cursor: pointer;
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 700;
  height: 52px;
  letter-spacing: 1px;
  text-transform: uppercase;
  position: relative;
  overflow: hidden;
  box-shadow: 
    0 6px 25px rgba(var(--primary-rgb), 0.25),
    inset 0 1px 0 rgba(255, 255, 255, 0.25);
  transition: var(--transition-smooth);
  width: 100%;
}

.submit-btn:hover {
  background-position: right center;
  transform: translateY(-1.5px);
  box-shadow: 
    0 8px 30px rgba(var(--primary-rgb), 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.4);
}

.submit-btn:active {
  transform: translateY(0);
  box-shadow: 0 4px 15px rgba(var(--primary-rgb), 0.15);
}

.btn-text {
  color: #fffbf7;
  transition: opacity 0.2s ease;
}

.btn-loader {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

/* Custom modern loader */
.loader-bars {
  display: flex;
  gap: 4px;
  align-items: center;
}

/* Ring loader used by the dashboard "Generate Code" button */
.loader-ring {
  width: 20px;
  height: 20px;
  border: 2.5px solid rgba(255, 251, 247, 0.3);
  border-top-color: #fffbf7;
  border-radius: 50%;
  animation: ring-spin 0.7s linear infinite;
}

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

.loader-bars span {
  display: inline-block;
  width: 3px;
  height: 12px;
  background-color: #fffbf7;
  border-radius: 3px;
  animation: pulse-bar 0.9s infinite ease-in-out;
}

.loader-bars span:nth-child(2) {
  animation-delay: 0.15s;
}

.loader-bars span:nth-child(3) {
  animation-delay: 0.3s;
}

@keyframes pulse-bar {
  0%, 100% { transform: scaleY(1); }
  50% { transform: scaleY(2.2); }
}

.submit-btn.loading {
  pointer-events: none;
}

.submit-btn.loading .btn-text {
  opacity: 0;
}

.submit-btn.loading .btn-loader {
  opacity: 1;
}

/* Secondary Buttons */
.copy-btn, .reset-btn {
  border-radius: 12px;
  cursor: pointer;
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 700;
  height: 44px;
  border: 1px solid var(--border-color);
  transition: var(--transition-fast);
}

.copy-btn {
  background: rgba(var(--primary-rgb), 0.06);
  border-color: rgba(var(--primary-rgb), 0.2);
  color: #ff9175;
}

.copy-btn:hover {
  background: rgba(var(--primary-rgb), 0.12);
  border-color: rgba(var(--primary-rgb), 0.35);
  transform: translateY(-0.5px);
}

.reset-btn {
  background: var(--input-bg);
  color: var(--text-muted);
}

.reset-btn:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.15);
  color: var(--text-main);
}

/* ── Result display ── */
.result-section {
  margin-top: 8px;
}

.result-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-bottom: 9px;
}

.result-display {
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  min-height: 70px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.5);
}

.result-display output {
  font-size: 26px;
  color: var(--primary);
  font-family: var(--font-mono);
  font-weight: 700;
  letter-spacing: 2px;
}

/* ── Error Badges ── */
.error-badge {
  background: rgba(255, 107, 100, 0.06);
  border: 1px solid rgba(255, 107, 100, 0.2);
  border-radius: 14px;
  padding: 14px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  color: #ff8c87;
  font-size: 13px;
  font-weight: 500;
  margin-top: 8px;
}

.error-badge-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

#error-msg {
  line-height: 1.4;
  text-align: left;
}

/* ── Animations ── */
.animate-fade-in {
  animation: fade-in 0.75s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.animate-wobble {
  animation: wobble 0.45s ease-in-out;
}

@keyframes fade-in {
  from {
    opacity: 0;
    transform: translateY(16px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes wobble {
  0%, 100% { transform: translateX(0); }
  15% { transform: translateX(-6px); }
  30% { transform: translateX(5px); }
  45% { transform: translateX(-4px); }
  60% { transform: translateX(3px); }
  75% { transform: translateX(-1.5px); }
}

/* Orbs drift */
@keyframes float-1 {
  0% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(35px, 25px) scale(1.08); }
  100% { transform: translate(-15px, 50px) scale(0.96); }
}

@keyframes float-2 {
  0% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(-45px, -35px) scale(0.92); }
  100% { transform: translate(25px, -15px) scale(1.04); }
}

@keyframes float-3 {
  0% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(25px, -45px) scale(1.12); }
  100% { transform: translate(-25px, 5px) scale(0.92); }
}

/* Responsive */
@media (max-width: 768px) {
  /* footer flows below content on small screens (no fixed overlay), so no clearance padding needed */
  .app-container {
    padding-bottom: 32px;
  }
}

@media (max-width: 480px) {
  .calculator-card {
    padding: 34px 26px;
    border-radius: 24px;
  }
  .title {
    font-size: 26px;
  }
}
