:root {
  --primary: #007a5e;
  --primary-dark: #005c46;
  --primary-light: #e6f4f0;
  --accent: #e63946;
  --bg-body: #f5f7f9;
  --bg-card: #ffffff;
  --text-main: #1e293b;
  --text-muted: #64748b;
  --border-color: #e2e8f0;
  --shadow-sm: 0 2px 6px rgba(15, 23, 42, 0.05);
  --shadow-md: 0 8px 20px rgba(15, 23, 42, 0.08);
  --radius: 12px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

html, body {
  max-width: 100%;
  overflow-x: hidden;
  background-color: var(--bg-body);
  color: var(--text-main);
  line-height: 1.5;
}

/* Header */
header {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-sm);
}

.topbar {
  background: var(--primary-dark);
  color: #fff;
  font-size: 0.78rem;
  text-align: center;
  padding: 6px 12px;
}

.navbar {
  max-width: 1280px;
  margin: 0 auto;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: var(--primary);
  font-weight: 800;
  font-size: 1.35rem;
  flex-shrink: 0;
}

.logo span {
  background: var(--primary);
  color: #fff;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
}

.search-bar {
  flex: 1;
  max-width: 520px;
  display: flex;
}

.search-bar input {
  width: 100%;
  padding: 10px 16px;
  border: 1px solid var(--border-color);
  border-radius: 999px;
  outline: none;
  font-size: 0.92rem;
  background: #f8fafc;
}

.search-bar input:focus {
  border-color: var(--primary);
  background: #fff;
}

.cart-btn {
  position: relative;
  background: var(--primary-light);
  color: var(--primary-dark);
  border: 1px solid var(--primary);
  padding: 9px 16px;
  border-radius: 999px;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.9rem;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: 0.2s;
  flex-shrink: 0;
}

.cart-btn:hover {
  background: var(--primary);
  color: #fff;
}

.cart-badge {
  background: var(--accent);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 999px;
}

.back-link {
  color: var(--primary);
  font-weight: 600;
  text-decoration: none;
  font-size: 0.9rem;
}

/* Menu de Categorias Rápido */
.cat-nav {
  background: #fff;
  border-top: 1px solid var(--border-color);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.cat-nav::-webkit-scrollbar {
  display: none;
}

.cat-nav-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 8px 20px;
  display: flex;
  gap: 10px;
  white-space: nowrap;
}

.cat-nav-inner a {
  text-decoration: none;
  color: var(--text-main);
  font-size: 0.85rem;
  font-weight: 500;
  padding: 6px 12px;
  border-radius: 999px;
  background: #f8fafc;
  border: 1px solid var(--border-color);
  transition: 0.2s;
}

.cat-nav-inner a:hover {
  background: var(--primary-light);
  border-color: var(--primary);
  color: var(--primary);
}

/* Container Principal */
.container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 20px 20px 60px;
}

/* Hero Banner */
.hero-banner {
  background: linear-gradient(120deg, #005c46 0%, #008f6e 60%, #10b981 100%);
  border-radius: 16px;
  padding: 38px 36px;
  color: #fff;
  display: grid;
  grid-template-columns: 1.3fr 0.7fr;
  align-items: center;
  gap: 24px;
  margin-bottom: 32px;
  box-shadow: var(--shadow-md);
}

.hero-tag {
  display: inline-block;
  background: rgba(255, 255, 255, 0.18);
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  margin-bottom: 10px;
}

.hero-banner h1 {
  font-size: 2rem;
  line-height: 1.2;
  margin-bottom: 12px;
}

.hero-banner p {
  font-size: 0.96rem;
  opacity: 0.94;
  margin-bottom: 20px;
  max-width: 540px;
}

.hero-cta {
  display: inline-block;
  background: #fff;
  color: var(--primary-dark);
  padding: 12px 24px;
  border-radius: 8px;
  font-weight: 700;
  text-decoration: none;
  transition: transform 0.2s;
}

.hero-cta:hover {
  transform: translateY(-2px);
}

.hero-badges {
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: rgba(255, 255, 255, 0.12);
  padding: 18px;
  border-radius: 12px;
  backdrop-filter: blur(6px);
}

.hero-badge-item {
  font-size: 0.86rem;
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

/* Seções de Vitrine / Carrossel */
.category-section {
  margin-bottom: 36px;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  gap: 10px;
}

.section-header h2 {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 8px;
}

.section-header h2::before {
  content: '';
  display: inline-block;
  width: 5px;
  height: 20px;
  background: var(--primary);
  border-radius: 4px;
  flex-shrink: 0;
}

.view-all-link {
  background: var(--primary-light);
  color: var(--primary-dark);
  font-weight: 700;
  font-size: 0.84rem;
  padding: 7px 14px;
  border-radius: 8px;
  text-decoration: none;
  border: 1px solid rgba(0, 122, 94, 0.25);
  transition: 0.2s;
  white-space: nowrap;
  flex-shrink: 0;
}

.view-all-link:hover {
  background: var(--primary);
  color: #fff;
}

/* Wrapper do Carrossel com Setas Laterais */
.carousel-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.carousel-track {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: calc(20% - 13px);
  gap: 16px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  padding: 4px 2px 12px;
  width: 100%;
}

.carousel-track::-webkit-scrollbar {
  display: none;
}

.carousel-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: #fff;
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-md);
  color: var(--text-main);
  font-size: 1.1rem;
  font-weight: bold;
  cursor: pointer;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: 0.2s;
}

.carousel-arrow:hover {
  background: var(--primary);
  color: #fff;
}

.carousel-arrow.prev { left: -14px; }
.carousel-arrow.next { right: -14px; }

/* Grid padrão para página categoria.html */
.products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}

/* Card de Produto */
.product-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 12px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: transform 0.2s, box-shadow 0.2s;
  position: relative;
  scroll-snap-align: start;
}

.product-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  border-color: #cbd5e1;
}

.discount-tag {
  position: absolute;
  top: 10px;
  left: 10px;
  background: var(--accent);
  color: #fff;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 3px 7px;
  border-radius: 6px;
  z-index: 2;
}

.product-img {
  width: 100%;
  height: 150px;
  object-fit: cover;
  border-radius: 8px;
  margin-bottom: 10px;
  background: #f1f5f9;
}

.product-type {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--primary);
  font-weight: 700;
  margin-bottom: 4px;
}

.product-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 6px;
  display: -webkit-box;
  line-clamp: 2;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 2.7em;
}

.product-desc {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-bottom: 10px;
  display: -webkit-box;
  line-clamp: 2;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.price-box {
  margin-bottom: 10px;
}

.price-old {
  display: block;
  font-size: 0.75rem;
  color: var(--text-muted);
  text-decoration: line-through;
}

.price-current {
  font-size: 1.18rem;
  font-weight: 800;
  color: var(--primary-dark);
}

.btn-add {
  width: 100%;
  background: var(--primary);
  color: #fff;
  border: none;
  padding: 10px 8px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.86rem;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-add:hover {
  background: var(--primary-dark);
}

/* Card Final "Ver todos desta categoria" dentro da lista */
.view-all-card {
  background: var(--primary-light);
  border: 2px dashed var(--primary);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 16px;
  text-decoration: none;
  color: var(--primary-dark);
  font-weight: 700;
  font-size: 0.9rem;
  transition: 0.2s;
  scroll-snap-align: start;
}

.view-all-card:hover {
  background: var(--primary);
  color: #fff;
}

/* Checkout Layout */
.checkout-title {
  font-size: 1.5rem;
  margin-bottom: 20px;
}

.checkout-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 24px;
  align-items: start;
}

.panel {
  background: #fff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 18px;
  box-shadow: var(--shadow-sm);
}

.panel-sticky {
  position: sticky;
  top: 90px;
}

.panel h3 {
  font-size: 1.05rem;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-color);
}

.cart-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid #f1f5f9;
}

.cart-item-info {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.cart-item img {
  width: 56px;
  height: 56px;
  border-radius: 8px;
  object-fit: cover;
  flex-shrink: 0;
}

.cart-item-details {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.cart-item-details strong {
  font-size: 0.92rem;
  line-height: 1.3;
}

.cart-item-details small {
  color: var(--primary);
  font-weight: 600;
  font-size: 0.75rem;
}

.cart-item-details span {
  font-size: 0.88rem;
  font-weight: 700;
}

.qty-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.qty-btn {
  width: 30px;
  height: 30px;
  border: 1px solid var(--border-color);
  background: #f8fafc;
  border-radius: 6px;
  cursor: pointer;
  font-weight: bold;
  font-size: 1rem;
}

.cep-row {
  display: flex;
  gap: 10px;
  margin-bottom: 12px;
}

.input-field {
  width: 100%;
  padding: 11px 14px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  font-size: 0.95rem;
}

.btn-calc {
  background: var(--primary);
  color: #fff;
  border: none;
  padding: 11px 18px;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.shipping-option, .payment-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  margin-bottom: 10px;
  cursor: pointer;
  transition: 0.15s;
}

.shipping-option:hover:not(.disabled-opt),
.payment-option:hover:not(.disabled-opt) {
  border-color: var(--primary);
  background: var(--primary-light);
}

.shipping-option.selected,
.payment-option.selected {
  border: 2px solid var(--primary);
  background: var(--primary-light);
}

.disabled-opt {
  opacity: 0.6;
  background: #f8fafc;
  cursor: not-allowed;
}

.summary-line {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
  font-size: 0.92rem;
}

.summary-total {
  display: flex;
  justify-content: space-between;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 2px solid var(--border-color);
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--primary-dark);
}

.btn-order {
  width: 100%;
  background: #16a34a;
  color: #fff;
  border: none;
  padding: 15px;
  border-radius: 10px;
  font-size: 1.05rem;
  font-weight: 700;
  cursor: pointer;
  margin-top: 16px;
  transition: 0.2s;
}

.btn-order:hover {
  background: #15803d;
}

.status-box {
  margin-top: 16px;
  padding: 14px;
  border-radius: 8px;
  font-size: 0.88rem;
  display: none;
}

.status-box.success {
  display: block;
  background: #dcfce7;
  color: #166534;
  border: 1px solid #86efac;
}

.status-box.error {
  display: block;
  background: #fee2e2;
  color: #991b1b;
  border: 1px solid #fca5a5;
}

/* Banner de Cookies & Termos LGPD */
.cookie-banner {
  position: fixed;
  bottom: 14px;
  left: 50%;
  transform: translateX(-50%);
  width: calc(100% - 24px);
  max-width: 960px;
  background: #0f172a;
  color: #f8fafc;
  padding: 16px 20px;
  border-radius: 12px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.25);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  z-index: 999;
}

.cookie-banner p {
  font-size: 0.82rem;
  color: #cbd5e1;
}

.cookie-banner a {
  color: #34d399;
  text-decoration: underline;
  cursor: pointer;
}

.cookie-actions {
  display: flex;
  gap: 10px;
  flex-shrink: 0;
}

.btn-cookie-accept {
  background: var(--primary);
  color: #fff;
  border: none;
  padding: 10px 16px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
}

/* Modal Genérico */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.6);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 1000;
}

.modal-overlay.active {
  display: flex;
}

.modal-box {
  background: #fff;
  border-radius: 14px;
  max-width: 480px;
  width: 100%;
  padding: 22px;
  box-shadow: var(--shadow-md);
  max-height: 85vh;
  overflow-y: auto;
}

.modal-box h3 {
  margin-bottom: 10px;
  color: var(--text-main);
}

.modal-box p {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 18px;
}

.modal-close-btn {
  width: 100%;
  background: var(--primary);
  color: #fff;
  border: none;
  padding: 12px;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
}

/* Toast Notification */
.toast {
  position: fixed;
  top: 76px;
  right: 16px;
  left: 16px;
  max-width: 380px;
  margin-left: auto;
  background: #0f172a;
  color: #fff;
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 0.85rem;
  box-shadow: var(--shadow-md);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s;
  z-index: 1100;
}

.toast.show {
  opacity: 1;
}

/* Footer */
footer {
  background: #0f172a;
  color: #94a3b8;
  padding: 32px 20px;
  font-size: 0.85rem;
}

.footer-inner {
  max-width: 1280px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
}

/* Tablet */
@media (max-width: 1024px) {
  .carousel-track {
    grid-auto-columns: calc(33.33% - 11px);
  }
  .hero-banner {
    grid-template-columns: 1fr;
    padding: 30px 26px;
  }
  .checkout-grid {
    grid-template-columns: 1fr;
  }
  .panel-sticky {
    position: static;
  }
}

/* Mobile (Padrão E-commerce Farmacêutico Profissional) */
@media (max-width: 640px) {
  .topbar {
    font-size: 0.72rem;
    padding: 5px 10px;
  }

  .navbar {
    flex-wrap: wrap;
    padding: 10px 14px;
    gap: 10px;
  }

  .logo {
    font-size: 1.2rem;
  }

  .logo span {
    width: 28px;
    height: 28px;
    font-size: 1.1rem;
  }

  .cart-btn {
    padding: 7px 12px;
    font-size: 0.84rem;
  }

  /* Barra de busca desce para a segunda linha ocupando 100% no mobile */
  .search-bar {
    order: 3;
    flex: 1 1 100%;
    max-width: 100%;
  }

  .search-bar input {
    padding: 9px 14px;
    font-size: 0.9rem;
  }

  .cat-nav-inner {
    padding: 8px 14px;
    gap: 8px;
  }

  .cat-nav-inner a {
    font-size: 0.8rem;
    padding: 5px 10px;
  }

  .container {
    padding: 14px 12px 50px;
  }

  .hero-banner {
    padding: 22px 18px;
    border-radius: 12px;
    margin-bottom: 24px;
    gap: 16px;
  }

  .hero-banner h1 {
    font-size: 1.42rem;
  }

  .hero-banner p {
    font-size: 0.88rem;
    margin-bottom: 16px;
  }

  .hero-cta {
    width: 100%;
    text-align: center;
    padding: 11px 16px;
  }

  .hero-badges {
    padding: 14px;
    gap: 8px;
  }

  .hero-badge-item {
    font-size: 0.8rem;
  }

  .section-header h2 {
    font-size: 1.08rem;
  }

  .view-all-link {
    font-size: 0.76rem;
    padding: 6px 10px;
  }

  /* No mobile, exibe 2 cards lado a lado + ponta do 3º card para swipe natural */
  .carousel-track {
    grid-auto-columns: calc(47.5% - 6px);
    gap: 10px;
  }

  /* Esconde setas flutuantes no touch mobile para não cobrir imagem/preço */
  .carousel-arrow {
    display: none;
  }

  /* Grid de 2 colunas na página categoria.html no celular */
  .products-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .product-card {
    padding: 10px;
  }

  .product-img {
    height: 115px;
    margin-bottom: 8px;
  }

  .product-type {
    font-size: 0.62rem;
  }

  .product-title {
    font-size: 0.82rem;
    min-height: 2.6em;
  }

  .product-desc {
    display: none; /* Oculta descrição longa no card mobile para manter altura uniforme */
  }

  .price-current {
    font-size: 1.05rem;
  }

  .btn-add {
    padding: 8px 6px;
    font-size: 0.8rem;
  }

  /* Checkout Mobile */
  .checkout-title {
    font-size: 1.3rem;
  }

  .panel {
    padding: 15px;
  }

  .cart-item {
    flex-direction: column;
    align-items: flex-start;
  }

  .qty-controls {
    align-self: flex-end;
  }

  .cep-row {
    flex-direction: column;
  }

  .btn-calc {
    width: 100%;
    padding: 12px;
  }

  .shipping-option, .payment-option {
    padding: 11px;
    font-size: 0.88rem;
  }

  .cookie-banner {
    flex-direction: column;
    align-items: stretch;
    padding: 14px;
    bottom: 10px;
  }

  .btn-cookie-accept {
    width: 100%;
  }
}

/* Botão Flutuante do Telegram */
.telegram-float {
  position: fixed;
  bottom: 25px;
  right: 25px;
  background-color: #229ED9;
  color: #FFF;
  width: 55px;
  height: 55px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
  z-index: 999;
  transition: all 0.3s ease;
  text-decoration: none;
}

.telegram-float:hover {
  background-color: #1d8abf;
  transform: scale(1.1);
  color: #FFF;
}

.tg-header-bar {
  max-width: 1280px;
  margin: 0 auto;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.tg-header-bar h1 {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--primary-dark);
  line-height: 1.25;
}

.tg-header-bar p {
  font-size: 0.84rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.tg-header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.btn-primary,
.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 15px;
  border-radius: 999px;
  font-size: 0.88rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: 0.2s;
  border: 1px solid var(--primary);
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}

.btn-primary:hover {
  background: var(--primary-dark);
}

.btn-secondary {
  background: var(--primary-light);
  color: var(--primary-dark);
}

.btn-secondary:hover {
  background: var(--primary);
  color: #fff;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 12px;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--border-color);
}

.modal-header h2 {
  font-size: 1.1rem;
  color: var(--text-main);
}

.modal-close {
  background: #f1f5f9;
  border: 1px solid var(--border-color);
  color: var(--text-main);
  width: 32px;
  height: 32px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 700;
}

.modal-body {
  font-size: 0.9rem;
  color: var(--text-main);
}

@media (max-width: 640px) {
  .tg-header-bar {
    padding: 12px 14px;
    gap: 10px;
  }

  .tg-header-bar h1 {
    font-size: 1.08rem;
  }

  .tg-header-actions {
    width: 100%;
    justify-content: space-between;
  }

  .btn-primary,
  .btn-secondary {
    padding: 8px 11px;
    font-size: 0.8rem;
  }
}