@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Poppins:wght@600;700&display=swap');

:root {
  /* Brand palette */
  --ww-primary-50: #e8f2ff;
  --ww-primary-100: #d0e4ff;
  --ww-primary-200: #a3caff;
  --ww-primary-300: #75afff;
  --ww-primary-400: #4795ff;
  --ww-primary-500: #1a7bff;
  --ww-primary-600: #005ddd;
  --ww-primary-700: #0047aa;
  --ww-primary-800: #003077;
  --ww-primary-900: #001944;

  --ww-accent-green: #00a86b;
  --ww-accent-gold: #f2b90f;

  --ww-gray-50: #fafafa;
  --ww-gray-100: #f3f3f3;
  --ww-gray-200: #e5e5e5;
  --ww-gray-300: #d4d4d4;
  --ww-gray-400: #a3a3a3;
  --ww-gray-500: #737373;
  --ww-gray-600: #525252;
  --ww-gray-700: #404040;
  --ww-gray-800: #262626;
  --ww-gray-900: #171717;

  --ww-success: #00a86b;
  --ww-warning: #f2b90f;
  --ww-error: #dc3545;

  font-size: 16px;
  background-color: var(--ww-gray-50);
  color: var(--ww-gray-900);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 0;
  font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--ww-gray-50);
  color: var(--ww-gray-900);
}

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

h1,
h2,
h3,
h4,
h5,
h6,
.brand-title {
  font-family: 'Poppins', 'Segoe UI', system-ui, sans-serif;
  color: var(--ww-gray-900);
}

.container {
  max-width: 960px;
  margin: 0 auto;
  padding: 2.5rem 1.25rem 4rem;
}

.page-header {
  text-align: center;
  margin-bottom: 2rem;
  background: #ffffff;
  border: 1px solid var(--ww-gray-200);
  border-radius: 12px;
  padding: 0.8rem 1.25rem;
  box-shadow: 0 10px 28px rgba(0, 25, 68, 0.06);
}

.brand-mark {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
}

.brand-icon {
  width: 56px;
  height: 56px;
}

.brand-title {
  margin: 0;
  font-size: 1.85rem;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.brand-tagline {
  margin: 0;
  font-size: 1rem;
  font-weight: 500;
  color: var(--ww-gray-600);
  font-family: 'Inter', 'Segoe UI', system-ui, sans-serif;
}

.subtitle {
  margin-top: 0.75rem;
  color: var(--ww-gray-600);
  font-size: 1rem;
}

.plan-selection-row {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  flex-wrap: wrap;
  margin-bottom: 1.35rem;
  padding: 0 1.5rem;
}

.plan-selection-label {
  margin-right: 20px;
  font-weight: 500;
  font-size: 1rem;
  transform: translateY(-4px);
}

.tab-bar {
  display: flex;
  justify-content: flex-start;
  gap: 0.75rem;
  margin-bottom: 0;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--ww-gray-200);
  padding-bottom: 0.65rem;
}

.tab-button {
  border: 1px solid var(--ww-gray-200);
  background-color: #ffffff;
  color: var(--ww-gray-700);
  border-radius: 9999px;
  padding: 0.6rem 1.2rem;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.2s ease-in-out, color 0.2s ease-in-out, border-color 0.2s ease-in-out,
    box-shadow 0.2s ease-in-out;
  font-family: 'Inter', 'Segoe UI', system-ui, sans-serif;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.01);
}

.tab-button.is-active {
  background: linear-gradient(120deg, var(--ww-primary-500), var(--ww-primary-600));
  border-color: var(--ww-primary-500);
  color: #ffffff;
  box-shadow: 0 8px 18px rgba(26, 123, 255, 0.35);
}

.tab-button:focus-visible {
  outline: 3px solid rgba(26, 123, 255, 0.35);
  outline-offset: 2px;
}

.tab-panel {
  display: none;
}

.tab-panel.is-active {
  display: block;
}

@media (max-width: 767px) {
  .plan-selection-row {
    flex-direction: column;
    align-items: flex-start;
    margin-bottom: 1.35rem;
  }

  .plan-selection-label {
    margin-right: 0;
    margin-bottom: 10px;
  }

  .tab-bar {
    justify-content: flex-start;
    width: 100%;
  }
}

.card-header h2 {
  margin: 0;
}

.card-subtitle {
  margin: 0 0 0.5rem;
  font-size: 0.95rem;
  color: var(--ww-gray-600);
  font-weight: 500;
}

.card {
  background-color: #ffffff;
  border-radius: 10px;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: 0 6px 18px rgba(0, 25, 68, 0.08);
  border: 1px solid var(--ww-gray-200);
}

.card h2,
.card h3 {
  margin-top: 0;
  text-align: left;
  color: var(--ww-gray-900);
}

.card h2 {
  margin-bottom: 0.45rem;
}

.card-header {
  text-align: left;
  margin-bottom: 1rem;
}

.form-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.form-grid + .form-grid {
  margin-top: 1rem;
}

.form-field {
  display: flex;
  flex-direction: column;
  font-weight: 500;
  color: var(--ww-gray-800);
  gap: 0.5rem;
}

.form-field span {
  margin-bottom: 0.1rem;
  font-weight: 600;
}

.helper-text {
  margin: 0.1rem 0 0.4rem;
  font-weight: 500;
  color: var(--ww-gray-600);
  font-size: 0.95rem;
}

.helper {
  margin: 0 0 0.75rem;
  color: var(--ww-gray-700);
  font-weight: 600;
  line-height: 1.5;
}

.inline-helper-wrapper {
  margin: 0 0 1rem;
}

.inline-helper-trigger,
.inline-helper-hide {
  background: none;
  border: none;
  padding: 0;
  color: var(--ww-primary-600);
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  text-decoration: underline;
  text-align: left;
}

.inline-helper-trigger:hover,
.inline-helper-hide:hover {
  color: var(--ww-primary-700);
}

.inline-helper {
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  transition: max-height 0.35s ease, opacity 0.3s ease;
}

.inline-helper.is-open {
  max-height: 1200px;
  opacity: 1;
}

.inline-helper-body {
  margin-top: 0.75rem;
  padding: 1rem;
  border-radius: 12px;
  border: 1px solid var(--ww-gray-200);
  background: var(--ww-gray-50);
}

.inline-helper-image {
  display: block;
  width: 100%;
  max-width: 520px;
  border-radius: 10px;
  border: 1px solid var(--ww-gray-200);
  margin-bottom: 0.75rem;
  background: #ffffff;
}

.inline-helper-list {
  margin: 0 0 0.75rem;
  padding-left: 1.2rem;
  color: var(--ww-gray-800);
  line-height: 1.6;
}

.inline-helper-list li + li {
  margin-top: 0.4rem;
}

.usage-field .helper-text {
  margin: 0;
}

.form-field input,
.form-field select {
  padding: 0.75rem 0.85rem;
  border: 1px solid var(--ww-gray-300);
  border-radius: 10px;
  font-size: 1rem;
  background-color: #ffffff;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  font-family: 'Inter', 'Segoe UI', system-ui, sans-serif;
  color: var(--ww-gray-900);
}

.form-field input:focus,
.form-field select:focus,
.form-field input:focus-visible,
.form-field select:focus-visible {
  outline: none;
  border-color: var(--ww-primary-500);
  box-shadow: 0 0 0 3px rgba(26, 123, 255, 0.2);
}

.input-normalized {
  border-color: var(--ww-success);
  box-shadow: 0 0 0 3px rgba(0, 168, 107, 0.25);
}

.form-field select {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--ww-gray-600) 50%),
    linear-gradient(135deg, var(--ww-gray-600) 50%, transparent 50%),
    linear-gradient(to right, var(--ww-gray-300), var(--ww-gray-300));
  background-position: calc(100% - 1.1rem) calc(0.9rem),
    calc(100% - 0.75rem) calc(0.9rem), calc(100% - 2.3rem) 0.55rem;
  background-size: 0.6rem 0.6rem, 0.6rem 0.6rem, 1px 60%;
  background-repeat: no-repeat;
  padding-right: 2.5rem;
  color: inherit;
}

.tdu-card {
  margin-bottom: 1.5rem;
}

.tdu-delivery-grid {
  margin-top: 1rem;
}

.usage-field {
  margin: 1.25rem 0;
}

.form-grid + .form-actions,
.usage-field + .form-actions {
  margin-top: 1rem;
}

.form-actions {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.calculate-button {
  background: linear-gradient(135deg, var(--ww-primary-600), var(--ww-primary-700));
  color: #ffffff;
  border: none;
  border-radius: 10px;
  padding: 1rem 2.25rem;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, filter 0.2s ease;
  font-family: 'Inter', 'Segoe UI', system-ui, sans-serif;
  box-shadow: 0 12px 24px rgba(0, 59, 138, 0.18);
}

.calculate-button:hover,
.calculate-button:focus-visible {
  transform: translateY(-1px);
  box-shadow: 0 14px 30px rgba(0, 59, 138, 0.22);
  outline: none;
}

.clear-button {
  background-color: #ffffff;
  color: var(--ww-gray-800);
  border: 1px solid var(--ww-gray-300);
  border-radius: 10px;
  padding: 0.9rem 2rem;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: background-color 0.2s ease-in-out, color 0.2s ease-in-out, border-color 0.2s ease-in-out,
    box-shadow 0.2s ease-in-out;
  font-family: 'Inter', 'Segoe UI', system-ui, sans-serif;
}

.clear-button:hover,
.clear-button:focus-visible {
  background-color: var(--ww-gray-100);
  color: var(--ww-gray-900);
  border-color: var(--ww-gray-400);
  outline: none;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
}

.results-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.5rem;
}

.results-placeholder {
  margin: 0;
  color: var(--ww-gray-600);
}

.result-value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--ww-primary-700);
}

.result-label {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.result-tooltip {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.35rem;
  height: 1.35rem;
  border-radius: 999px;
  background: var(--ww-gray-100);
  color: var(--ww-primary-700);
  font-weight: 700;
  font-size: 0.85rem;
  border: 1px solid var(--ww-gray-200);
  cursor: default;
  outline: none;
}

.result-tooltip:focus-visible {
  box-shadow: 0 0 0 3px rgba(26, 123, 255, 0.25);
}

.result-tooltip-text {
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translate(-50%, -6px);
  margin-top: 8px;
  background: #ffffff;
  border: 1px solid var(--ww-gray-200);
  border-radius: 8px;
  padding: 8px 10px;
  width: 260px;
  font-size: 0.85rem;
  color: var(--ww-gray-700);
  line-height: 1.4;
  box-shadow: 0 10px 24px rgba(0, 25, 68, 0.12);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s ease;
  z-index: 10;
}

.result-tooltip:hover .result-tooltip-text,
.result-tooltip:focus-visible .result-tooltip-text,
.result-tooltip:focus-within .result-tooltip-text {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, 0);
}

.result-note {
  margin-top: 1rem;
  color: var(--ww-gray-600);
}

.is-hidden {
  display: none;
}

.results-card {
  border-left: 4px solid var(--ww-primary-500);
}

.result-insight {
  border-top: 1px solid rgba(0, 0, 0, 0.05);
  margin-top: 6px;
  padding-top: 12px;
}

.result-insight-title {
  margin: 0 0 4px;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--ww-gray-900);
}

.result-insight-body {
  margin: 0;
  font-size: 0.9rem;
  color: var(--ww-gray-600);
}

.result-guidance {
  margin-top: 12px;
}

.result-guidance-title {
  font-size: 0.95rem;
  font-weight: 600;
  margin: 0 0 6px;
  color: var(--ww-gray-900);
}

.result-guidance-list {
  margin: 0 0 0 1.1rem;
  padding: 0;
  color: var(--ww-gray-600);
  font-size: 0.9rem;
}

.result-guidance-list li {
  margin-bottom: 4px;
}

.result-email-optin {
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.result-email-title {
  font-size: 1.35rem;
  font-weight: 700;
  margin: 0;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.result-email-title::before {
  content: '📨';
  font-size: 1.1rem;
}

.result-email-intro {
  font-size: 0.9rem;
  margin-bottom: 4px;
}

.result-email-benefits {
  margin: 0 0 8px 0;
  padding: 0 0 0 1.1rem;
  font-size: 0.9rem;
}

.result-email-benefits li {
  margin-bottom: 6px;
  line-height: 1.45;
}

  .result-email-success {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 700;
    background: linear-gradient(120deg, var(--ww-primary-600), var(--ww-accent-green));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
  }

  .result-email-error {
    margin: 0;
    font-size: 0.88rem;
    color: var(--ww-error);
  }

  .result-email-error.is-info {
    color: var(--ww-primary-700);
    font-weight: 700;
    background-color: rgba(26, 123, 255, 0.08);
    padding: 0.65rem 0.9rem;
    border-radius: 10px;
  }

.result-email-form {
  margin-top: 4px;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.result-email-input-row {
  display: flex;
  gap: 8px;
  margin-bottom: 4px;
  align-items: center;
  flex-wrap: nowrap;
}

.result-email-input {
  flex: 1 1 260px;
  max-width: 400px;
  width: 100%;
  padding: 0.75rem 0.85rem;
  border: 1px solid var(--ww-gray-300);
  border-radius: 10px;
  font-size: 1rem;
  background-color: #ffffff;
  font-family: 'Inter', 'Segoe UI', system-ui, sans-serif;
}

.result-email-input:focus,
.result-email-input:focus-visible {
  outline: none;
  border-color: var(--ww-primary-500);
  box-shadow: 0 0 0 3px rgba(26, 123, 255, 0.2);
}

.result-email-button {
  white-space: nowrap;
  background: linear-gradient(135deg, var(--ww-primary-600), var(--ww-primary-700));
  color: #ffffff;
  border: none;
  border-radius: 10px;
  padding: 1rem 2.25rem;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, filter 0.2s ease;
  font-family: 'Inter', 'Segoe UI', system-ui, sans-serif;
  box-shadow: 0 12px 24px rgba(0, 59, 138, 0.18);
}

@media (max-width: 768px) {
  .result-email-input-row {
    display: flex;
    flex-direction: column !important;
    align-items: stretch;
  }

  .result-email-input {
    width: 100% !important;
    flex: 0 1 auto !important;
    height: 48px;
  }

  .result-email-button {
    width: 100%;
    margin-top: 12px;
  }
}

.result-email-button:hover,
.result-email-button:focus-visible {
  transform: translateY(-1px);
  box-shadow: 0 14px 30px rgba(0, 59, 138, 0.22);
  outline: none;
}

.result-email-disclaimer {
  font-size: 0.8rem;
  opacity: 0.75;
}

.result-email-card {
  background: linear-gradient(180deg, var(--ww-primary-50), #ffffff);
  border: 1px solid var(--ww-gray-200);
}

.result-disclaimer {
  margin-top: 8px;
  font-size: 0.8rem;
  opacity: 0.75;
}

.error-card {
  border: 1px solid var(--ww-error);
  background-color: #fff1f2;
  color: var(--ww-error);
}

.error-card h2 {
  margin-top: 0;
}

.error-message {
  margin-bottom: 0;
}

.page-footer {
  text-align: center;
  color: var(--ww-gray-500);
  padding: 1.5rem 1.25rem 2.5rem;
  margin-top: 1rem;
  font-size: 0.95rem;
}

@media (max-width: 640px) {
  .tab-bar {
    justify-content: center;
  }

  .brand-title {
    font-size: 1.6rem;
  }
}
