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

:root {
  --bg: #FFFFFF;
  --surface: #F8F8F8;
  --surface-2: #F0F0F0;
  --accent: #DC143C;
  --accent-light: #FF6B7A;
  --text: #1A1A1A;
  --text-muted: #666666;
  --text-light: #999999;
  --border: #E5E5E5;
  --radius: 12px;
  --font: 'Inter', sans-serif;
  --shadow-sm: 0 2px 8px rgba(0,0,0,0.08);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.12);
  --shadow-lg: 0 12px 32px rgba(0,0,0,0.16);
}

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  min-height: 100dvh;
  overflow-x: hidden;
  line-height: 1.6;
}

/* ── HEADER ───────────────────────────────────────────────────────────────── */
.header-bar {
  position: sticky;
  top: 0;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  padding: 12px 16px;
  z-index: 80;
  box-shadow: var(--shadow-sm);
}

.header-content {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.store-info {
  flex: 1;
}

.store-name {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
}

.store-subtitle {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.header-contacts {
  display: flex;
  gap: 8px;
}

.contact-btn {
  width: 40px;
  height: 40px;
  border: none;
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--accent);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.contact-btn svg {
  width: 20px;
  height: 20px;
}

.contact-btn:hover {
  background: var(--surface-2);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

/* ── MODAL CONTATOS ───────────────────────────────────────────────────────── */
.modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: flex-end;
  opacity: 1;
  transition: opacity 0.3s;
}

.modal.hidden {
  opacity: 0;
  pointer-events: none;
}

.modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.4);
  backdrop-filter: blur(4px);
}

.modal-content {
  position: relative;
  width: 100%;
  max-width: 500px;
  background: var(--bg);
  border-radius: var(--radius) var(--radius) 0 0;
  box-shadow: var(--shadow-lg);
  max-height: 80vh;
  overflow-y: auto;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--bg);
}

.modal-header h2 {
  font-size: 1.1rem;
  font-weight: 600;
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--text-muted);
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.contacts-list {
  display: grid;
  gap: 12px;
  padding: 16px;
}

.contact-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: var(--surface);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
  color: inherit;
}

.contact-item:hover {
  background: var(--surface-2);
  transform: translateX(2px);
}

.contact-item-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-light));
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 600;
  flex-shrink: 0;
}

.contact-item-info {
  flex: 1;
  min-width: 0;
}

.contact-item-label {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
}

.contact-item-value {
  font-size: 0.8rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.contact-item-arrow {
  color: var(--text-light);
  font-size: 1.2rem;
}

/* ── CONTAINER ────────────────────────────────────────────────────────────── */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px 16px 140px;
}

/* ── TABS ──────────────────────────────────────────────────────────────────── */
.tabs-wrapper {
  position: relative;
  margin-bottom: 32px;
  border-bottom: 1px solid var(--border);
}

.tabs-scroll {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scroll-behavior: smooth;
  padding: 0;
  scrollbar-width: none;
}

.tabs-scroll::-webkit-scrollbar { display: none; }

.tab-btn {
  background: none;
  border: none;
  padding: 12px 16px;
  font-family: var(--font);
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  white-space: nowrap;
  border-bottom: 3px solid transparent;
  transition: all 0.3s;
  position: relative;
}

.tab-btn:hover {
  color: var(--text);
}

.tab-btn.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* ── PRODUCTS GRID ────────────────────────────────────────────────────────── */
.products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}

@media (min-width: 768px) {
  .products-grid {
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
  }
}

.product-card {
  background: var(--surface);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  transition: all 0.3s;
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
}

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

.product-image {
  width: 100%;
  aspect-ratio: 1;
  background: linear-gradient(135deg, var(--surface-2) 0%, var(--surface) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
  overflow: hidden;
}

.product-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.product-placeholder {
  color: var(--text-light);
  opacity: 0.5;
}

.product-info {
  padding: 12px;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.product-name {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.3;
  margin-bottom: 4px;
  word-break: break-word;
}

.product-desc {
  font-size: 0.75rem;
  color: var(--text-muted);
  line-height: 1.3;
  margin-bottom: 8px;
  flex: 1;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.product-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: auto;
}

.product-price {
  font-size: 1rem;
  font-weight: 700;
  color: var(--accent);
}

.product-add {
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 6px;
  width: 28px;
  height: 28px;
  font-size: 1.2rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.product-add:hover {
  background: var(--accent-light);
  transform: scale(1.1);
}

.product-add:active {
  transform: scale(0.95);
}

/* ── EMPTY STATE ───────────────────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

.empty-state svg {
  width: 60px;
  height: 60px;
  margin-bottom: 16px;
  opacity: 0.3;
}

.empty-state p {
  font-size: 1rem;
}

.empty-state.hidden {
  display: none;
}

/* ── CART FLOATING ────────────────────────────────────────────────────────── */
.cart-floating {
  position: fixed;
  bottom: 24px;
  right: 16px;
  z-index: 90;
}

.cart-btn {
  position: relative;
  width: 56px;
  height: 56px;
  border: none;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-light));
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-lg);
  transition: all 0.3s;
  animation: floatCart 3s ease-in-out infinite;
}

.cart-btn:hover {
  transform: scale(1.1);
  box-shadow: 0 8px 24px rgba(220, 20, 60, 0.35);
}

.cart-btn svg {
  width: 24px;
  height: 24px;
}

.cart-badge {
  position: absolute;
  top: -8px;
  right: -8px;
  background: var(--accent);
  color: white;
  border-radius: 50%;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 700;
  border: 2px solid var(--bg);
}

.cart-tooltip {
  position: absolute;
  bottom: 100%;
  right: 0;
  background: rgba(0,0,0,0.8);
  color: white;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 0.75rem;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
  margin-bottom: 8px;
}

.cart-floating:hover .cart-tooltip {
  opacity: 1;
}

@keyframes floatCart {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

/* ── CART SIDEBAR ──────────────────────────────────────────────────────────── */
.cart-sidebar {
  position: fixed;
  right: 0;
  top: 0;
  width: min(400px, 100vw);
  height: 100vh;
  background: var(--bg);
  border-left: 1px solid var(--border);
  box-shadow: -4px 0 16px rgba(0,0,0,0.08);
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  z-index: 95;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.cart-sidebar.open {
  transform: translateX(0);
}

.cart-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  position: sticky;
  top: 0;
}

.cart-header h2 {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text);
}

.cart-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--text-muted);
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.cart-items {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.cart-item {
  display: flex;
  gap: 12px;
  padding: 12px;
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.cart-item-image {
  width: 60px;
  height: 60px;
  background: linear-gradient(135deg, var(--surface-2) 0%, var(--surface) 100%);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  flex-shrink: 0;
  overflow: hidden;
}

.cart-item-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.cart-item-details {
  flex: 1;
  min-width: 0;
}

.cart-item-name {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text);
  margin-bottom: 4px;
  word-break: break-word;
}

.cart-item-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface-2);
  border-radius: 6px;
  width: fit-content;
  padding: 2px;
}

.cart-item-btn {
  background: none;
  border: none;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text);
  font-weight: 600;
  transition: all 0.2s;
}

.cart-item-btn:hover {
  color: var(--accent);
}

.cart-item-qty {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
  min-width: 20px;
  text-align: center;
}

.cart-item-price {
  font-weight: 700;
  color: var(--accent);
  font-size: 0.95rem;
  margin-top: 4px;
}

.cart-item-remove {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: rgba(220, 20, 60, 0.1);
  border: none;
  cursor: pointer;
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  transition: all 0.2s;
}

.cart-item-remove:hover {
  background: var(--accent);
  color: white;
}

.cart-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  text-align: center;
  color: var(--text-muted);
}

.cart-empty p {
  font-weight: 600;
  margin-bottom: 4px;
}

.cart-empty small {
  font-size: 0.85rem;
}

.cart-summary {
  padding: 16px;
  border-top: 1px solid var(--border);
  background: var(--surface);
}

.summary-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.9rem;
  margin-bottom: 8px;
  color: var(--text-muted);
}

.summary-total {
  display: flex;
  justify-content: space-between;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
  padding-top: 8px;
  border-top: 1px solid var(--border);
  margin-top: 8px;
}

.btn-checkout {
  width: 100%;
  padding: 14px;
  background: linear-gradient(135deg, var(--accent), var(--accent-light));
  color: white;
  border: none;
  border-radius: var(--radius);
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.3s;
  margin: 16px 16px 0;
  box-shadow: var(--shadow-md);
}

.btn-checkout:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(220, 20, 60, 0.3);
}

.btn-checkout:active {
  transform: translateY(0);
}

/* ── CHAT FAB ──────────────────────────────────────────────────────────────── */
#chat-fab {
  position: fixed;
  bottom: 24px;
  left: 20px;
  display: flex;
  align-items: center;
  gap: 8px;
  background: white;
  color: var(--accent);
  border: 2px solid var(--accent);
  border-radius: 50px;
  padding: 12px 18px 12px 14px;
  font-family: var(--font);
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: var(--shadow-md);
  z-index: 100;
  transition: all 0.2s;
}

#chat-fab:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(220, 20, 60, 0.2);
  background: var(--surface);
}

#chat-fab.chat-active {
  background: var(--accent);
  color: white;
}

#chat-fab .fab-icon { width: 20px; height: 20px; }

/* ── CHAT PANEL ───────────────────────────────────────────────────────────── */
#chat-panel {
  position: fixed;
  bottom: 84px;
  left: 16px;
  width: min(360px, calc(100vw - 32px));
  height: 480px;
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  z-index: 99;
  transform: scale(0.9) translateY(20px);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.25s ease;
  transform-origin: bottom left;
}

#chat-panel.open {
  transform: scale(1) translateY(0);
  opacity: 1;
  pointer-events: all;
}

.chat-header {
  display: flex;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(135deg, var(--surface) 0%, var(--surface-2) 100%);
}

.chat-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-light));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  flex-shrink: 0;
}

.chat-header-info {
  flex: 1;
  min-width: 0;
}

#chat-header-title {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text);
}

#chat-header-subtitle {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 2px;
}

#chat-close {
  background: none;
  border: none;
  font-size: 1.2rem;
  cursor: pointer;
  color: var(--text-muted);
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

#chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.chat-msg {
  display: flex;
  margin: 4px 0;
}

.chat-msg span {
  padding: 10px 14px;
  border-radius: 12px;
  word-break: break-word;
  line-height: 1.4;
  font-size: 0.9rem;
}

.chat-msg-user span {
  background: var(--accent);
  color: white;
  border-radius: 12px 4px 12px 12px;
}

.chat-msg-assistant span {
  background: var(--surface);
  color: var(--text);
  border-radius: 4px 12px 12px 12px;
  border: 1px solid var(--border);
}

.chat-typing {
  padding-left: 4px;
}

.chat-typing span {
  display: flex;
  gap: 4px;
  padding: 12px 16px;
}

.dot-1, .dot-2, .dot-3 {
  animation: typing 1.4s infinite;
}

.dot-2 { animation-delay: 0.2s; }
.dot-3 { animation-delay: 0.4s; }

@keyframes typing {
  0%, 60%, 100% { opacity: 0.3; }
  30% { opacity: 1; }
}

.chat-input-row {
  display: flex;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  background: var(--bg);
}

#chat-input {
  flex: 1;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  font-family: var(--font);
  font-size: 0.9rem;
  color: var(--text);
  background: var(--surface);
}

#chat-input:focus {
  outline: none;
  border-color: var(--accent);
  background: white;
}

#chat-send {
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 8px;
  background: var(--accent);
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

#chat-send:hover {
  background: var(--accent-light);
}

#chat-send svg {
  width: 18px;
  height: 18px;
}

/* ── RESPONSIVE ───────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .cart-floating {
    bottom: 16px;
    right: 12px;
  }

  .cart-btn {
    width: 48px;
    height: 48px;
  }

  #chat-fab {
    bottom: 16px;
    left: 12px;
  }

  .contact-item-value {
    max-width: 150px;
  }
}

@media (max-width: 480px) {
  .header-contacts {
    gap: 6px;
  }

  .contact-btn {
    width: 36px;
    height: 36px;
  }

  .store-name {
    font-size: 1.1rem;
  }

  .products-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }

  .cart-sidebar {
    width: 100vw;
  }
}
