/* ---------- Paleta e tipografia Pollimed ---------- */
:root {
  --pollimed-blue: #003D99;
  --pollimed-blue-dark: #002766;
  --pollimed-blue-light: #1a55b3;
  --pollimed-bg: #f8f9fb;
  --pollimed-surface: #ffffff;
  --pollimed-border: #e3e6ed;
  --pollimed-text: #1a1f2e;
  --pollimed-text-secondary: #5a6478;
  --pollimed-text-tertiary: #8b94a8;
  --success: #16a34a;
  --warning: #d97706;
  --danger: #dc2626;
  --success-bg: #ecfdf5;
  --warning-bg: #fffbeb;
  --danger-bg: #fef2f2;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: 'Tahoma', 'Segoe UI', system-ui, sans-serif;
  background: var(--pollimed-bg);
  color: var(--pollimed-text);
  font-size: 15px;
  line-height: 1.5;
  -webkit-tap-highlight-color: transparent;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, .title-font {
  font-family: 'Barlow', 'Tahoma', sans-serif;
  font-weight: 600;
  letter-spacing: -0.01em;
}

/* ---------- Layout principal ---------- */
.app-shell {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--pollimed-bg);
}

.app-header {
  background: var(--pollimed-surface);
  border-bottom: 1px solid var(--pollimed-border);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  position: sticky;
  top: 0;
  z-index: 10;
}

.app-header__logo {
  height: 28px;
  max-width: 100%;
  object-fit: contain;
}

.app-header__title {
  flex: 1;
  font-family: 'Barlow', sans-serif;
  font-weight: 600;
  font-size: 16px;
  color: var(--pollimed-blue);
}

.app-header__step {
  font-size: 12px;
  color: var(--pollimed-text-secondary);
  background: var(--pollimed-bg);
  padding: 4px 8px;
  border-radius: 6px;
  font-weight: 500;
}

.app-header__back {
  background: transparent;
  border: none;
  padding: 6px;
  cursor: pointer;
  color: var(--pollimed-text);
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.app-header__back svg { width: 20px; height: 20px; }

.app-content {
  flex: 1;
  padding: 16px;
  padding-bottom: 88px;
  overflow-y: auto;
}

.app-footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  max-width: 480px;
  margin: 0 auto;
  background: var(--pollimed-surface);
  padding: 12px 16px;
  border-top: 1px solid var(--pollimed-border);
  display: flex;
  gap: 8px;
  z-index: 10;
}

/* ---------- Botões ---------- */
.btn {
  font-family: 'Tahoma', sans-serif;
  border: none;
  border-radius: 8px;
  padding: 12px 16px;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  text-decoration: none;
}

.btn--primary {
  background: var(--pollimed-blue);
  color: white;
  flex: 1;
}

.btn--primary:hover { background: var(--pollimed-blue-dark); }
.btn--primary:disabled { background: var(--pollimed-text-tertiary); cursor: not-allowed; }

.btn--secondary {
  background: var(--pollimed-surface);
  color: var(--pollimed-blue);
  border: 1px solid var(--pollimed-border);
  flex: 1;
}

.btn--secondary:hover { background: var(--pollimed-bg); }

.btn--ghost {
  background: transparent;
  color: var(--pollimed-blue);
  padding: 8px 12px;
}

.btn--small {
  padding: 6px 10px;
  font-size: 13px;
}

/* ---------- Forms ---------- */
.field {
  margin-bottom: 14px;
}

.field__label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--pollimed-text-secondary);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.field__input,
.field__select {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid var(--pollimed-border);
  border-radius: 8px;
  background: var(--pollimed-surface);
  font-size: 15px;
  font-family: 'Tahoma', sans-serif;
  color: var(--pollimed-text);
  transition: border-color 0.15s ease;
}

.field__input:focus,
.field__select:focus {
  outline: none;
  border-color: var(--pollimed-blue);
  box-shadow: 0 0 0 3px rgba(0, 61, 153, 0.1);
}

.field__hint {
  font-size: 12px;
  color: var(--pollimed-text-tertiary);
  margin-top: 4px;
}

.field-row {
  display: flex;
  gap: 8px;
}

.field-row > .field { flex: 1; }

/* ---------- Cards ---------- */
.card {
  background: var(--pollimed-surface);
  border: 1px solid var(--pollimed-border);
  border-radius: 10px;
  padding: 14px 16px;
  margin-bottom: 12px;
}

.card--clickable {
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.card--clickable:hover {
  border-color: var(--pollimed-blue);
  box-shadow: 0 2px 8px rgba(0, 61, 153, 0.06);
}

.card--selected {
  border-color: var(--pollimed-blue);
  background: rgba(0, 61, 153, 0.04);
}

.card__title {
  font-weight: 600;
  font-size: 15px;
  margin-bottom: 4px;
}

.card__subtitle {
  font-size: 13px;
  color: var(--pollimed-text-secondary);
}

/* ---------- Toggle switch ---------- */
.toggle {
  position: relative;
  display: inline-block;
  width: 42px;
  height: 24px;
  flex-shrink: 0;
}

.toggle input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle__slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background-color: var(--pollimed-border);
  border-radius: 24px;
  transition: 0.2s;
}

.toggle__slider:before {
  position: absolute;
  content: '';
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  border-radius: 50%;
  transition: 0.2s;
}

.toggle input:checked + .toggle__slider {
  background-color: var(--pollimed-blue);
}

.toggle input:checked + .toggle__slider:before {
  transform: translateX(18px);
}

/* ---------- Pills (radio segmented) ---------- */
.pill-group {
  display: flex;
  gap: 6px;
  background: var(--pollimed-bg);
  padding: 4px;
  border-radius: 10px;
  border: 1px solid var(--pollimed-border);
}

.pill {
  flex: 1;
  padding: 9px 12px;
  border: none;
  background: transparent;
  border-radius: 6px;
  font-size: 14px;
  cursor: pointer;
  color: var(--pollimed-text-secondary);
  font-family: 'Tahoma', sans-serif;
  transition: 0.15s;
}

.pill--active {
  background: var(--pollimed-surface);
  color: var(--pollimed-blue);
  font-weight: 600;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
}

/* ---------- Abas horizontais (Tela Composição) ---------- */
.tabs {
  display: flex;
  gap: 0;
  border-bottom: 2px solid var(--pollimed-border);
  margin-bottom: 12px;
  margin-top: 4px;
  position: sticky;
  top: 0;
  background: var(--pollimed-bg);
  z-index: 5;
}

.tab {
  flex: 1;
  padding: 11px 8px;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  font-size: 13px;
  font-weight: 500;
  font-family: 'Tahoma', sans-serif;
  color: var(--pollimed-text-secondary);
  cursor: pointer;
  transition: 0.15s;
}

.tab--active {
  color: var(--pollimed-blue);
  border-bottom-color: var(--pollimed-blue);
  font-weight: 600;
}

.tab__count {
  display: inline-block;
  margin-left: 4px;
  padding: 1px 6px;
  background: var(--pollimed-blue);
  color: white;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
}

.tab--active .tab__count {
  background: var(--pollimed-blue);
}

.tab:not(.tab--active) .tab__count {
  background: var(--pollimed-text-tertiary);
}

/* ---------- Lupa para revelar Target/Mínimo ---------- */
.reveal-lupa {
  background: var(--pollimed-surface);
  border: 1px solid var(--pollimed-border);
  border-radius: 8px;
  padding: 8px 10px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--pollimed-text-secondary);
  margin: 0 auto;
}

.reveal-lupa:hover {
  background: var(--pollimed-bg);
  color: var(--pollimed-blue);
  border-color: var(--pollimed-blue);
}

.reveal-lupa svg {
  width: 16px;
  height: 16px;
}

/* ---------- Input com prefixo R$ ---------- */
.input-currency {
  position: relative;
}

.input-currency__prefix {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--pollimed-text-secondary);
  font-weight: 500;
  pointer-events: none;
}

.input-currency input {
  padding-left: 36px;
  font-weight: 600;
  font-size: 16px;
}

/* ---------- Item de lista (checkbox card) ---------- */
.list-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-bottom: 1px solid var(--pollimed-border);
  background: var(--pollimed-surface);
}

.list-item:last-child { border-bottom: none; }
.list-item--selected { background: rgba(0, 61, 153, 0.04); }

.list-item__checkbox {
  width: 22px;
  height: 22px;
  border: 2px solid var(--pollimed-border);
  border-radius: 50%;
  flex-shrink: 0;
  position: relative;
  cursor: pointer;
}

.list-item__checkbox--checked {
  background: var(--pollimed-blue);
  border-color: var(--pollimed-blue);
}

.list-item__checkbox--checked:after {
  content: '';
  position: absolute;
  left: 6px;
  top: 2px;
  width: 5px;
  height: 10px;
  border-right: 2px solid white;
  border-bottom: 2px solid white;
  transform: rotate(45deg);
}

.list-item__body {
  flex: 1;
  min-width: 0;
}

.list-item__title {
  font-size: 14px;
  font-weight: 500;
  color: var(--pollimed-text);
  margin-bottom: 2px;
}

.list-item__subtitle {
  font-size: 12px;
  color: var(--pollimed-text-secondary);
}

.list-item__price {
  font-size: 13px;
  font-weight: 500;
  color: var(--pollimed-text);
  white-space: nowrap;
}

/* ---------- Stepper ---------- */
.stepper {
  display: flex;
  align-items: center;
  gap: 6px;
}

.stepper__btn {
  width: 26px;
  height: 26px;
  border: 1px solid var(--pollimed-border);
  background: var(--pollimed-surface);
  border-radius: 6px;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--pollimed-text);
}

.stepper__btn:hover { background: var(--pollimed-bg); }

.stepper__value {
  min-width: 24px;
  text-align: center;
  font-weight: 600;
  font-size: 14px;
}

/* ---------- Alerts coloridos ---------- */
.alert {
  padding: 12px 14px;
  border-radius: 8px;
  font-size: 14px;
  line-height: 1.4;
  margin-bottom: 12px;
}

.alert--success { background: var(--success-bg); color: var(--success); }
.alert--warning { background: var(--warning-bg); color: var(--warning); }
.alert--danger  { background: var(--danger-bg);  color: var(--danger); }
.alert--info    { background: rgba(0, 61, 153, 0.05); color: var(--pollimed-blue); }

/* ---------- Preço grande ---------- */
.price-display {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 14px;
  background: var(--pollimed-surface);
  border: 1px solid var(--pollimed-border);
  border-radius: 10px;
  margin-bottom: 8px;
}

.price-display__label {
  font-size: 12px;
  color: var(--pollimed-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.price-display__value {
  font-size: 22px;
  font-weight: 600;
  font-family: 'Barlow', sans-serif;
  color: var(--pollimed-blue);
}

.price-display--small .price-display__value {
  font-size: 16px;
}

.price-display--big {
  background: var(--pollimed-blue);
  color: white;
  border: none;
}

.price-display--big .price-display__label,
.price-display--big .price-display__value { color: white; }

.price-display--clickable {
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  position: relative;
  transition: border-color 0.15s ease;
}

.price-display--clickable:hover {
  border-color: var(--pollimed-blue);
}

.price-display--clickable::after {
  content: "👁";
  position: absolute;
  top: 50%;
  right: 14px;
  transform: translateY(-50%);
  font-size: 14px;
  opacity: 0.4;
}

/* ---------- Badge ---------- */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  background: rgba(0, 61, 153, 0.1);
  color: var(--pollimed-blue);
  letter-spacing: 0.3px;
  text-transform: uppercase;
}

.badge--promo {
  background: rgba(217, 119, 6, 0.1);
  color: var(--warning);
}

/* ---------- Section header ---------- */
.section-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--pollimed-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  margin: 18px 0 8px;
}

/* ---------- Tela de login ---------- */
.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: var(--pollimed-blue);
}

.login-card {
  background: var(--pollimed-surface);
  border-radius: 16px;
  padding: 32px 24px;
  width: 100%;
  max-width: 360px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.15);
}

.login-card__logo {
  display: block;
  margin: 0 auto 24px;
  height: 48px;
  width: auto;
  max-width: 100%;
  object-fit: contain;
}

.login-card__error {
  background: var(--danger-bg);
  color: var(--danger);
  padding: 10px 12px;
  border-radius: 6px;
  font-size: 13px;
  margin-bottom: 12px;
  text-align: center;
}

/* ---------- Resumo final (texto monospace para WhatsApp) ---------- */
.whatsapp-preview {
  background: var(--pollimed-surface);
  border: 1px solid var(--pollimed-border);
  border-radius: 10px;
  padding: 14px;
  font-family: 'Consolas', 'Courier New', monospace;
  font-size: 13px;
  line-height: 1.6;
  white-space: pre-wrap;
  color: var(--pollimed-text);
}

/* ---------- Helpers ---------- */
.hidden { display: none !important; }
.text-secondary { color: var(--pollimed-text-secondary); }
.text-small { font-size: 12px; }
.text-bold { font-weight: 600; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.gap-2 { gap: 8px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.mt-2 { margin-top: 8px; }

/* ---------- Reveal "Ver Mínimo" discreto ---------- */
.reveal-min {
  background: transparent;
  border: none;
  color: var(--pollimed-text-tertiary);
  text-decoration: underline;
  text-decoration-style: dotted;
  text-underline-offset: 3px;
  font-size: 12px;
  padding: 6px;
  cursor: pointer;
  margin: 0 auto;
  display: block;
}

.reveal-min:hover { color: var(--pollimed-text-secondary); }

/* ---------- Loading ---------- */
.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
  color: var(--pollimed-text-secondary);
}

.spinner {
  width: 24px;
  height: 24px;
  border: 3px solid var(--pollimed-border);
  border-top-color: var(--pollimed-blue);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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