/* ===== DESIGN TOKENS ===== */
:root {
  --enerva-red: #C41230;
  --enerva-red-dark: #9B0E26;
  --enerva-red-light: #E8365A;
  --enerva-gray: #4A4A4A;
  --enerva-gray-dark: #333333;
  --bg-page: #F5F6FA;
  --bg-white: #FFFFFF;
  --bg-light: #F0F1F5;
  --bg-input: #FFFFFF;
  --border-color: #E2E4EA;
  --border-hover: #C8CBD4;
  --border-focus: #C41230;
  --text-primary: #1A1D27;
  --text-secondary: #5A5F72;
  --text-muted: #8E93A4;
  --success: #0E9F6E;
  --success-bg: #ECFDF5;
  --success-border: #BBF7D0;
  --warning: #D97706;
  --warning-bg: #FFFBEB;
  --danger: #E02424;
  --danger-bg: #FEF2F2;
  --radius-sm: 8px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 18px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.07);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.1);
  --transition-fast: 150ms ease;
  --transition-normal: 250ms ease;
}

/* ===== RESET & BASE ===== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background-color: var(--bg-page);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
}

/* ===== HEADER ===== */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: #FFFFFF;
  border-bottom: 1px solid var(--border-color);
  box-shadow: 0 1px 4px rgba(0,0,0,0.04);
}

.header-inner {
  max-width: 960px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 80px;
  padding: 0 24px;
}

.header-logo {
  display: flex;
  align-items: center;
  gap: 12px;
}

.header-logo img {
  height: 34px;
  width: auto;
}

.header-title {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
}

.header-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 12px;
  background: var(--success-bg);
  border: 1px solid var(--success-border);
  border-radius: 100px;
  font-size: 11px;
  font-weight: 600;
  color: var(--success);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* ===== MAIN LAYOUT ===== */
.main {
  max-width: 960px;
  margin: 0 auto;
  padding: 32px 24px 140px;
}

/* ===== HERO SECTION ===== */
.hero {
  text-align: center;
  margin-bottom: 36px;
  padding: 40px 24px;
  background: #FFFFFF;
  border-radius: var(--radius-xl);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
}

.hero h1 {
  font-size: clamp(24px, 3.5vw, 34px);
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 10px;
  color: var(--text-primary);
}

.hero p {
  font-size: 15px;
  color: var(--text-secondary);
  max-width: 540px;
  margin: 0 auto;
  line-height: 1.6;
}

.hero-budget {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 18px;
  padding: 8px 20px;
  background: var(--success-bg);
  border: 1px solid var(--success-border);
  border-radius: 100px;
  font-size: 14px;
  font-weight: 600;
  color: var(--success);
}

/* ===== SECTION TITLES ===== */
.section-title {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 6px;
  color: var(--text-primary);
}

.section-subtitle {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 20px;
}

/* ===== FORM SECTION ===== */
.form-section {
  margin-bottom: 36px;
  background: #FFFFFF;
  padding: 28px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group.full-width {
  grid-column: 1 / -1;
}

.form-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.form-label .required {
  color: var(--enerva-red);
  margin-left: 2px;
}

.form-input {
  padding: 12px 14px;
  background: var(--bg-input);
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 14px;
  font-family: inherit;
  transition: all var(--transition-normal);
  outline: none;
}

.form-input::placeholder {
  color: var(--text-muted);
}

.form-input:hover {
  border-color: var(--border-hover);
}

.form-input:focus {
  border-color: var(--enerva-red);
  box-shadow: 0 0 0 3px rgba(196, 18, 48, 0.1);
}

.form-input.error {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px rgba(224, 36, 36, 0.1);
}

.form-error {
  font-size: 12px;
  color: var(--danger);
  display: none;
}

.form-error.visible {
  display: block;
}

/* ===== PRODUCTS SECTION ===== */
.products-section {
  margin-bottom: 36px;
}

.products-section > .section-title,
.products-section > .section-subtitle {
  padding-left: 4px;
}

.products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 16px;
}

/* ===== PRODUCT CARD ===== */
.product-card {
  background: #FFFFFF;
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px;
  transition: all var(--transition-normal);
  position: relative;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
}

.product-card:hover {
  border-color: var(--border-hover);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.product-card.selected {
  border-color: var(--enerva-red);
  background: #FFF5F6;
  box-shadow: 0 0 0 3px rgba(196, 18, 48, 0.08), var(--shadow-md);
}

.product-card.disabled {
  opacity: 0.4;
  pointer-events: none;
  filter: grayscale(0.2);
}

.product-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
}

.product-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
  background: var(--bg-light);
}

.product-checkbox {
  position: relative;
  width: 22px;
  height: 22px;
  flex-shrink: 0;
}

.product-checkbox input {
  position: absolute;
  opacity: 0;
  width: 100%;
  height: 100%;
  cursor: pointer;
  z-index: 2;
}

.product-checkbox .checkmark {
  position: absolute;
  top: 0;
  left: 0;
  width: 22px;
  height: 22px;
  background: #FFFFFF;
  border: 2px solid var(--border-color);
  border-radius: 6px;
  transition: all var(--transition-fast);
  display: flex;
  align-items: center;
  justify-content: center;
}

.product-checkbox input:checked + .checkmark {
  background: var(--enerva-red);
  border-color: var(--enerva-red);
}

.product-checkbox .checkmark::after {
  content: '';
  display: none;
  width: 5px;
  height: 9px;
  border: solid white;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
  margin-top: -2px;
}

.product-checkbox input:checked + .checkmark::after {
  display: block;
}

.product-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 2px;
  flex: 1;
}

.product-description {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 14px;
}

/* ===== VARIANT SELECTOR ===== */
.variant-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}

.variant-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--bg-light);
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.variant-option:hover {
  border-color: var(--border-hover);
  background: #F0F1F5;
}

.variant-option.active {
  border-color: var(--enerva-red);
  background: #FFF5F6;
}

.variant-option input[type="radio"] {
  appearance: none;
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border: 2px solid var(--border-color);
  border-radius: 50%;
  flex-shrink: 0;
  position: relative;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.variant-option input[type="radio"]:checked {
  border-color: var(--enerva-red);
  background: var(--enerva-red);
  box-shadow: inset 0 0 0 3px #FFFFFF;
}

.variant-label {
  flex: 1;
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.4;
}

.variant-price {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
}

/* ===== QUANTITY CONTROLS ===== */
.product-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-top: 14px;
  border-top: 1px solid var(--border-color);
}

.quantity-control {
  display: flex;
  align-items: center;
  background: var(--bg-light);
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.quantity-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 15px;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.quantity-btn:hover:not(:disabled) {
  background: rgba(196, 18, 48, 0.08);
  color: var(--enerva-red);
}

.quantity-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.quantity-value {
  width: 32px;
  text-align: center;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
  border-left: 1px solid var(--border-color);
  border-right: 1px solid var(--border-color);
  line-height: 32px;
}

.product-total {
  font-size: 17px;
  font-weight: 800;
  color: var(--enerva-red);
}

.product-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: var(--text-muted);
  text-decoration: none;
  transition: color var(--transition-fast);
  margin-top: 8px;
}

.product-link:hover {
  color: var(--enerva-red);
}

.product-link svg {
  width: 12px;
  height: 12px;
}

.max-badge {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 500;
}

/* ===== BUDGET TRACKER (STICKY BOTTOM) ===== */
.budget-tracker {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 200;
  background: #FFFFFF;
  border-top: 1px solid var(--border-color);
  box-shadow: 0 -4px 16px rgba(0,0,0,0.06);
  padding: 0 24px;
}

.budget-tracker.warning {
  border-top-color: var(--warning);
}

.budget-tracker.full {
  border-top-color: var(--danger);
}

.budget-inner {
  max-width: 960px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 24px;
  height: 72px;
}

.budget-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.budget-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.budget-amount {
  font-size: 20px;
  font-weight: 800;
  color: var(--text-primary);
}

.budget-amount .limit {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-muted);
}

.budget-bar-container {
  height: 5px;
  background: var(--bg-light);
  border-radius: 100px;
  overflow: hidden;
  flex: 1;
}

.budget-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--success), #34D399);
  border-radius: 100px;
  transition: width 400ms cubic-bezier(0.4,0,0.2,1), background var(--transition-normal);
  width: 0%;
}

.budget-bar.warning {
  background: linear-gradient(90deg, var(--warning), #FBBF24);
}

.budget-bar.full {
  background: linear-gradient(90deg, var(--danger), #F87171);
}

.budget-items-count {
  font-size: 12px;
  color: var(--text-muted);
}

.submit-btn {
  padding: 12px 36px;
  background: var(--enerva-red);
  color: white;
  border: none;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition-normal);
  flex-shrink: 0;
}

.submit-btn:hover:not(:disabled) {
  background: var(--enerva-red-dark);
  box-shadow: 0 4px 12px rgba(196, 18, 48, 0.3);
}

.submit-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

/* ===== SUCCESS OVERLAY ===== */
.success-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(0,0,0,0.4);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: all 300ms ease;
}

.success-overlay.visible {
  opacity: 1;
  visibility: visible;
}

.success-card {
  background: #FFFFFF;
  border-radius: var(--radius-xl);
  padding: 44px;
  text-align: center;
  max-width: 440px;
  width: 90%;
  box-shadow: var(--shadow-lg);
  transform: scale(0.95) translateY(10px);
  transition: transform 300ms ease;
}

.success-overlay.visible .success-card {
  transform: scale(1) translateY(0);
}

.success-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 20px;
  background: var(--success-bg);
  border: 2px solid var(--success-border);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 30px;
  color: var(--success);
}

.success-card h2 {
  font-size: 22px;
  font-weight: 800;
  margin-bottom: 10px;
  color: var(--text-primary);
}

.success-card p {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 24px;
}

.success-close-btn {
  padding: 10px 28px;
  background: var(--bg-light);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  font-family: inherit;
}

.success-close-btn:hover {
  background: #E9EAF0;
}

/* ===== LOADING SPINNER ===== */
.spinner {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

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

/* ===== FOOTER ===== */
.footer {
  text-align: center;
  padding: 28px 24px 140px;
}

.footer p {
  font-size: 12px;
  color: var(--text-muted);
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  .header-inner {
    height: 56px;
  }

  .header-title {
    display: none;
  }

  .hero {
    padding: 28px 18px;
    margin-bottom: 24px;
  }

  .main {
    padding: 20px 14px 140px;
  }

  .form-section {
    padding: 20px;
  }

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

  .products-grid {
    grid-template-columns: 1fr;
  }

  .budget-inner {
    flex-direction: column;
    height: auto;
    padding: 12px 0;
    gap: 10px;
  }

  .budget-info {
    width: 100%;
  }

  .submit-btn {
    width: 100%;
    text-align: center;
  }

  .budget-tracker {
    padding: 0 14px;
  }
}

@media (max-width: 480px) {
  .hero h1 {
    font-size: 22px;
  }

  .product-card {
    padding: 16px;
  }

  .budget-amount {
    font-size: 17px;
  }
}
