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

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-primary);
  color: var(--ps-dark);
  background: var(--ps-white);
  line-height: 1.5;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ── Top accent bar ── */
.top-bar {
  height: 4px;
  background: var(--ps-red);
  width: 100%;
}

/* ── Header ── */
.app-header {
  background: var(--ps-white);
  border-bottom: 1px solid var(--ps-border);
  padding: 12px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
}

.app-header h1 {
  font-family: var(--font-primary);
  font-size: 18px;
  font-weight: 700;
  color: var(--ps-red);
  letter-spacing: -0.3px;
}

.app-header h1 span {
  color: var(--ps-dark);
  font-weight: 400;
}

.header-badge {
  font-size: 11px;
  background: var(--warm-mid);
  color: var(--warm-text);
  padding: 3px 10px;
  border-radius: 20px;
  font-weight: 600;
}

/* ── Main content ── */
.app-main {
  max-width: 600px;
  margin: 0 auto;
  padding: 20px 16px 100px;
}

/* ── Section labels ── */
.section-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--ps-gray);
  margin-bottom: 8px;
}

/* ── Tier selector ── */
.tier-selector {
  display: flex;
  gap: 8px;
  margin-bottom: 24px;
}

.tier-btn {
  flex: 1;
  padding: 12px 8px;
  border: 2px solid var(--ps-border);
  border-radius: var(--radius-md);
  background: var(--ps-white);
  cursor: pointer;
  text-align: center;
  transition: all var(--transition);
  font-family: var(--font-primary);
  font-size: 12px;
  font-weight: 600;
  color: var(--ps-gray);
  line-height: 1.3;
}

.tier-btn.active {
  border-color: var(--ps-red);
  background: var(--ps-red);
  color: var(--ps-white);
}

.tier-btn:not(.active):hover {
  border-color: var(--ps-red-light);
  color: var(--ps-red);
}

/* ── Dropdowns ── */
.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--ps-dark);
  margin-bottom: 6px;
}

.form-group select {
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid var(--ps-border);
  border-radius: var(--radius-sm);
  font-family: var(--font-primary);
  font-size: 15px;
  color: var(--ps-dark);
  background: var(--ps-white);
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%236B6B6B' stroke-width='1.5' fill='none'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  cursor: pointer;
  transition: border-color var(--transition);
}

.form-group select:focus {
  outline: none;
  border-color: var(--ps-red);
}

/* ── Go button ── */
.btn-recommend {
  width: 100%;
  padding: 14px;
  background: var(--ps-red);
  color: var(--ps-white);
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--font-primary);
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  transition: background var(--transition);
  margin-top: 8px;
}

.btn-recommend:hover {
  background: var(--ps-red-dark);
}

.btn-recommend:disabled {
  background: var(--ps-border);
  cursor: not-allowed;
}

/* ── Pharmacist alert ── */
.pharmacist-alert {
  background: var(--pharmacist-yellow);
  border: 2px solid var(--pharmacist-border);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 20px;
  display: none;
}

.pharmacist-alert.show {
  display: block;
}

.pharmacist-alert h3 {
  font-size: 15px;
  font-weight: 700;
  color: var(--pharmacist-text);
  margin-bottom: 4px;
}

.pharmacist-alert p {
  font-size: 13px;
  color: var(--pharmacist-text);
  line-height: 1.4;
}

/* ── Results area ── */
.results-area {
  display: none;
  margin-top: 24px;
}

.results-area.show {
  display: block;
}

.results-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.results-header h2 {
  font-size: 16px;
  font-weight: 700;
  color: var(--ps-dark);
}

/* ── Option line toggle ── */
.line-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
}

.line-toggle button {
  width: 32px;
  height: 32px;
  border: 1.5px solid var(--ps-border);
  border-radius: 50%;
  background: var(--ps-white);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  color: var(--ps-gray);
  transition: all var(--transition);
}

.line-toggle button:hover {
  border-color: var(--ps-red);
  color: var(--ps-red);
}

.line-toggle .current-line {
  font-size: 13px;
  font-weight: 600;
  color: var(--ps-red);
  min-width: 100px;
  text-align: center;
}

/* ── Product cards ── */
.product-card {
  background: var(--ps-white);
  border: 1.5px solid var(--ps-border);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 12px;
  transition: border-color var(--transition);
}

.product-card:hover {
  border-color: var(--warm-deep);
}

.product-card .product-brand {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--ps-red);
  margin-bottom: 4px;
}

.product-card .product-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--ps-dark);
  margin-bottom: 6px;
}

.product-card .product-desc {
  font-size: 13px;
  color: var(--ps-gray);
  line-height: 1.4;
}

.product-card .product-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.product-card .tag {
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 20px;
  font-weight: 600;
}

.tag-skin {
  background: var(--warm-light);
  color: var(--warm-text);
}

.tag-type {
  background: #EEF2FF;
  color: #4338CA;
}

/* ── Upsell section ── */
.upsell-section {
  background: var(--warm-light);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-top: 20px;
  border: 1px solid var(--warm-mid);
}

.upsell-section h3 {
  font-size: 14px;
  font-weight: 700;
  color: var(--warm-text);
  margin-bottom: 12px;
}

.upsell-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--warm-mid);
}

.upsell-item:last-child {
  border-bottom: none;
}

.upsell-icon {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--warm-mid);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
}

.upsell-item .upsell-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--ps-dark);
}

.upsell-item .upsell-reason {
  font-size: 12px;
  color: var(--ps-gray);
}

/* ── Reset button ── */
.btn-reset {
  width: 100%;
  padding: 12px;
  background: transparent;
  color: var(--ps-gray);
  border: 1.5px solid var(--ps-border);
  border-radius: var(--radius-sm);
  font-family: var(--font-primary);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  margin-top: 20px;
  transition: all var(--transition);
}

.btn-reset:hover {
  border-color: var(--ps-red);
  color: var(--ps-red);
}

/* ── No results ── */
.no-results {
  text-align: center;
  padding: 40px 20px;
  color: var(--ps-gray);
}

.no-results h3 {
  font-size: 16px;
  margin-bottom: 8px;
  color: var(--ps-dark);
}

/* ── Offline indicator ── */
.offline-badge {
  display: none;
  font-size: 11px;
  background: var(--pharmacist-yellow);
  color: var(--pharmacist-text);
  padding: 3px 10px;
  border-radius: 20px;
  font-weight: 600;
}

body.offline .offline-badge {
  display: inline-block;
}

/* ── Responsive ── */
@media (max-width: 480px) {
  .app-header {
    padding: 10px 14px;
  }

  .app-header h1 {
    font-size: 15px;
  }

  .tier-btn {
    padding: 10px 6px;
    font-size: 11px;
  }

  .app-main {
    padding: 16px 12px 80px;
  }
}
