/* ============================================================
   EncartShop — Design System Global
   Paleta Varejo: Verde Vivo + Laranja Energia
   ============================================================ */

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

/* ── CSS Variables ─────────────────────────────────────────── */
:root {
  /* Tons base — Clean Light */
  --primary: #ffffff;
  --primary-light: #f8fafc;
  --primary-mid: #f1f5f9;

  /* Indigo Vibrant — Marca Universal (Confiança, Tecnologia) */
  --brand: #4f46e5;
  --brand-dark: #3730a3;
  --brand-light: #6366f1;
  --brand-glow: rgba(79, 70, 229, 0.1);

  /* Rose/Violet — Accent (Energia, Varejo, Destaque) */
  --accent: #d946ef;
  --accent-glow: rgba(217, 70, 239, 0.1);
  --accent-hover: #c026d3;

  /* Amarelo Oferta (mantido para utilidade comercial) */
  --promo: #f59e0b;
  --promo-glow: rgba(245, 158, 11, 0.1);

  /* Semânticas */
  --success: #10b981;
  --warning: #f59e0b;
  --info: #0ea5e9;
  --danger: #f43f5e;

  /* Backgrounds */
  --bg: #f8fafc;
  --bg-card: #ffffff;
  --bg-card-hover: #f1f5f9;
  --border: rgba(0, 0, 0, 0.06);
  --border-accent: rgba(79, 70, 229, 0.2);

  /* Texto */
  --text: #0f172a;
  --text-muted: #64748b;
  --text-light: #475569;

  --font: 'Inter', sans-serif;
  --font-display: 'Outfit', sans-serif;

  --radius: 12px;
  --radius-lg: 20px;
  --radius-xl: 32px;
  --radius-full: 9999px;

  --shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.1);
  --shadow-accent: 0 8px 32px var(--accent-glow);
  --shadow-brand: 0 8px 32px var(--brand-glow);

  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-fast: all 0.15s ease;

  --sidebar-width: 260px;
  --header-height: 72px;
}

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

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
}

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

img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button { cursor: pointer; font-family: var(--font); border: none; outline: none; }
input, textarea, select { font-family: var(--font); outline: none; }

/* ── Scrollbar ──────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--primary-light); }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: var(--radius-full); }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/* ── Utility Classes ────────────────────────────────────────── */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.gap-1 { gap: 8px; }
.gap-2 { gap: 16px; }
.gap-3 { gap: 24px; }
.text-center { text-align: center; }
.hidden { display: none !important; }
.w-full { width: 100%; }

/* ── Buttons ────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 0.95rem;
  transition: var(--transition);
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.btn-primary {
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-dark) 100%);
  color: #fff;
  box-shadow: var(--shadow-brand);
}
.btn-primary:hover {
  background: linear-gradient(135deg, var(--brand-light) 0%, var(--brand) 100%);
  transform: translateY(-2px);
  box-shadow: 0 12px 40px var(--brand-glow);
}

.btn-outline {
  background: transparent;
  color: var(--text);
  border: 1.5px solid var(--border);
}
.btn-outline:hover {
  border-color: var(--brand);
  color: var(--brand);
  background: var(--brand-glow);
}

.btn-ghost {
  background: rgba(0,0,0,0.03);
  color: var(--text-muted);
}
.btn-ghost:hover {
  background: rgba(0,0,0,0.06);
  color: var(--text);
}

.btn-success {
  background: var(--success);
  color: #fff;
}
.btn-success:hover {
  background: #219a52;
  transform: translateY(-2px);
}

.btn-danger {
  background: var(--danger);
  color: #fff;
}
.btn-danger:hover { background: #c0392b; }

.btn-sm { padding: 8px 16px; font-size: 0.85rem; }
.btn-lg { padding: 16px 36px; font-size: 1.05rem; border-radius: var(--radius-lg); }
.btn-xl { padding: 18px 44px; font-size: 1.15rem; border-radius: var(--radius-lg); font-weight: 700; }

.btn-icon {
  width: 40px; height: 40px;
  padding: 0;
  border-radius: var(--radius);
}

/* ── Cards ──────────────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  transition: var(--transition);
}
.card:hover {
  border-color: rgba(255,255,255,0.12);
  background: var(--bg-card-hover);
}

/* ── Form Elements ──────────────────────────────────────────── */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form-label {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-light);
  letter-spacing: 0.02em;
}

.form-input {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
  color: var(--text);
  font-size: 0.95rem;
  transition: var(--transition);
  width: 100%;
}
.form-input:focus {
  border-color: var(--brand);
  background: #ffffff;
  box-shadow: 0 0 0 3px var(--brand-glow);
}
.form-input::placeholder { color: var(--text-muted); }

select.form-input { cursor: pointer; }
select.form-input option {
  background: var(--bg-card);
  color: var(--text);
  padding: 8px;
}

/* ── Badges ─────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.badge-promo { background: var(--promo); color: #1a1a2e; }
.badge-success { background: rgba(39, 174, 96, 0.15); color: var(--success); border: 1px solid rgba(39, 174, 96, 0.3); }
.badge-danger { background: rgba(231, 76, 60, 0.15); color: var(--danger); border: 1px solid rgba(231, 76, 60, 0.3); }
.badge-info { background: rgba(52, 152, 219, 0.15); color: var(--info); border: 1px solid rgba(52, 152, 219, 0.3); }
.badge-warning { background: rgba(243, 156, 18, 0.15); color: var(--warning); border: 1px solid rgba(243, 156, 18, 0.3); }
.badge-muted { background: rgba(255,255,255,0.05); color: var(--text-muted); }

/* ── Toast Notifications ────────────────────────────────────── */
#toast-container {
  position: fixed;
  top: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.toast {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 280px;
  box-shadow: var(--shadow-lg);
  animation: toastIn 0.3s ease;
  font-size: 0.9rem;
  font-weight: 500;
}
.toast.success { border-left: 3px solid var(--success); }
.toast.error { border-left: 3px solid var(--danger); }
.toast.info { border-left: 3px solid var(--info); }

@keyframes toastIn {
  from { opacity: 0; transform: translateX(40px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* ── Modal ──────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.4);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: fadeIn 0.2s ease;
}

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 32px;
  width: 100%;
  max-width: 540px;
  max-height: 90vh;
  overflow-y: auto;
  animation: slideUp 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp {
  from { opacity: 0; transform: translateY(30px) scale(0.96); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* ── Admin Layout ───────────────────────────────────────────── */
.admin-layout {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: var(--sidebar-width);
  background: var(--primary);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  transition: var(--transition);
}

.sidebar-logo {
  padding: 28px 24px 20px;
  border-bottom: 1px solid var(--border);
}

.sidebar-logo .logo-mark {
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo-icon {
  width: 38px; height: 38px;
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-dark) 100%);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 1.1rem;
  color: #fff;
  font-family: var(--font-display);
  box-shadow: var(--shadow-brand);
}

.logo-text {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}
.logo-text .brand { font-family: var(--font-display); font-weight: 700; font-size: 1.05rem; color: var(--text); }
.logo-text .sub { font-size: 0.7rem; color: var(--text-muted); font-weight: 400; }

.sidebar-nav {
  flex: 1;
  padding: 20px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  overflow-y: auto;
}

.nav-section-label {
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 12px 12px 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border-radius: var(--radius);
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 500;
  transition: var(--transition);
  cursor: pointer;
}
.nav-item:hover {
  background: var(--primary-mid);
  color: var(--text);
}
.nav-item.active {
  background: var(--brand-glow);
  color: var(--brand);
  font-weight: 600;
}
.nav-item svg { flex-shrink: 0; }

.sidebar-footer {
  padding: 16px 12px;
  border-top: 1px solid var(--border);
}

.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.topbar {
  height: var(--header-height);
  background: var(--primary);
  border-bottom: 1px solid var(--border);
  padding: 0 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 50;
}

.topbar-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.page-content {
  flex: 1;
  padding: 32px;
}

/* ── Stats Cards ────────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  margin-bottom: 32px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  display: flex;
  align-items: flex-start;
  gap: 16px;
  transition: var(--transition);
}
.stat-card:hover {
  border-color: rgba(255,255,255,0.12);
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.stat-icon {
  width: 48px; height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  flex-shrink: 0;
}

.stat-value {
  font-size: 1.8rem;
  font-weight: 800;
  font-family: var(--font-display);
  line-height: 1;
  margin-bottom: 4px;
}

.stat-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 500;
}

/* ── Data Table ─────────────────────────────────────────────── */
.data-table {
  width: 100%;
  border-collapse: collapse;
}
.data-table th {
  text-align: left;
  padding: 12px 16px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}
.data-table td {
  padding: 14px 16px;
  font-size: 0.9rem;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  vertical-align: middle;
}
.data-table tr:hover td {
  background: var(--primary-light);
}

/* ── Product Grid (Loja) ────────────────────────────────────── */
.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 16px;
}

.product-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: var(--transition);
  cursor: pointer;
  position: relative;
  display: flex;
  flex-direction: column;
}
.product-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: rgba(255,255,255,0.12);
}

.product-image-wrap {
  position: relative;
  aspect-ratio: 1;
  overflow: hidden;
  background: var(--primary);
}
.product-image-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}
.product-card:hover .product-image-wrap img {
  transform: scale(1.08);
}

.promo-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  background: linear-gradient(135deg, var(--accent) 0%, #f59e0b 100%);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 800;
  padding: 4px 8px;
  border-radius: 6px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  box-shadow: var(--shadow-accent);
}

.product-info {
  padding: 14px;
}
.product-name {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.product-unit {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 10px;
}
.price-normal {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-decoration: line-through;
}
.price-promo {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--accent);
  font-family: var(--font-display);
}
.price-regular {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--brand);
  font-family: var(--font-display);
}

.btn-add-cart {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  margin-top: 10px;
  padding: 10px;
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-dark) 100%);
  color: #fff;
  border-radius: 8px;
  font-size: 0.82rem;
  font-weight: 700;
  transition: var(--transition);
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 16px var(--brand-glow);
}
.btn-add-cart:hover {
  background: linear-gradient(135deg, var(--brand-light) 0%, var(--brand) 100%);
  transform: scale(1.02);
}
.btn-add-cart:active { transform: scale(0.98); }

/* ── Quantity Selector Card ─────────────────────────────────── */
 .qty-selector-card {
   display: flex;
   align-items: center;
   justify-content: space-between;
   background: var(--primary-light);
   border: 1px solid var(--border);
   border-radius: 8px;
   overflow: hidden;
 }
 .qty-btn-card {
   width: 40px;
   height: 40px;
   background: var(--primary-mid);
   color: var(--text);
   font-size: 1.2rem;
   font-weight: 700;
   display: flex;
   align-items: center;
   justify-content: center;
   transition: var(--transition-fast);
 }
 .qty-btn-card:hover {
   background: var(--brand-glow);
   color: var(--brand);
 }
 .qty-num-card {
   font-weight: 800;
   font-size: 0.9rem;
   color: var(--text);
   min-width: 40px;
   text-align: center;
   font-family: var(--font-display);
 }

/* ── Cart Bubble ────────────────────────────────────────────── */
.cart-bubble {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 500;
  background: linear-gradient(135deg, var(--accent) 0%, #f59e0b 100%);
  color: #fff;
  border-radius: var(--radius-full);
  padding: 16px 24px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 1rem;
  box-shadow: var(--shadow-accent);
  cursor: pointer;
  transition: var(--transition);
  animation: bounceIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.cart-bubble:hover {
  transform: scale(1.05);
  box-shadow: 0 16px 48px var(--accent-glow);
}

.cart-count {
  background: #fff;
  color: var(--accent);
  width: 24px; height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 900;
}

@keyframes bounceIn {
  from { opacity: 0; transform: scale(0.5) translateY(20px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

/* ── Category Tabs ──────────────────────────────────────────── */
.category-tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 4px 0 16px;
  scrollbar-width: none;
}
.category-tabs::-webkit-scrollbar { display: none; }

.cat-tab {
  padding: 8px 18px;
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transition: var(--transition);
  border: 1.5px solid var(--border);
  background: transparent;
  color: var(--text-muted);
}
.cat-tab:hover { border-color: var(--brand); color: var(--brand); }
.cat-tab.active {
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-dark) 100%);
  border-color: var(--brand);
  color: #fff;
}

.category-section {
  scroll-margin-top: 130px;
}

/* ── Store Header / Banner ──────────────────────────────────── */
.store-banner {
  background: linear-gradient(135deg, var(--primary-mid) 0%, var(--primary-light) 100%);
  border-bottom: 1px solid var(--border);
  padding: 12px 24px;
  text-align: center;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--promo);
  letter-spacing: 0.02em;
}

.store-header {
  background: var(--primary);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 200;
}

/* ── Animations ─────────────────────────────────────────────── */
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

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

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

@keyframes shimmer {
  0% { background-position: -200% center; }
  100% { background-position: 200% center; }
}

/* ── Loading skeleton ───────────────────────────────────────── */
.skeleton {
  background: linear-gradient(90deg, var(--bg-card) 25%, var(--bg-card-hover) 50%, var(--bg-card) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius);
}

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.active {
    transform: translateX(0);
  }
  .main-content {
    margin-left: 0;
  }
  .page-content {
    padding: 16px;
  }
  .topbar {
    padding: 0 16px;
    height: 60px;
  }
  .product-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }
  .btn-lg {
    padding: 14px 24px;
    font-size: 0.95rem;
  }
}

@media (max-width: 480px) {
  .product-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }
  .product-info {
    padding: 10px;
  }
  .product-name {
    font-size: 0.8rem;
    height: 2.4em;
    line-height: 1.2;
    margin-bottom: 4px;
  }
  .price-promo, .price-regular {
    font-size: 0.95rem;
  }
  .btn-add-cart {
    padding: 8px;
    font-size: 0.75rem;
  }
  .cart-bubble {
    padding: 12px;
    bottom: 20px;
    right: 20px;
    border-radius: 50%;
    width: 56px;
    height: 56px;
    justify-content: center;
  }
  .cart-bubble span:not(.cart-count) { display: none; }
  .cart-count {
    position: absolute;
    top: -5px;
    right: -5px;
    width: 22px;
    height: 22px;
    border: 2px solid var(--bg);
  }
  .store-banner {
    font-size: 0.75rem;
    padding: 8px 12px;
  }
  .section-heading {
    font-size: 0.65rem;
    margin: 20px 0 10px;
  }
  .modal {
    width: 95%;
    padding: 24px 20px;
  }
}

/* ── Toggle Switch ──────────────────────────────────────────── */
.toggle {
  position: relative;
  width: 44px;
  height: 24px;
  display: inline-block;
}
.toggle input { display: none; }
.toggle-slider {
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,0.1);
  border-radius: 12px;
  cursor: pointer;
  transition: var(--transition);
}
.toggle-slider:before {
  content: '';
  position: absolute;
  width: 18px; height: 18px;
  background: #fff;
  border-radius: 50%;
  top: 3px; left: 3px;
  transition: var(--transition);
}
.toggle input:checked + .toggle-slider { background: var(--success); }
.toggle input:checked + .toggle-slider:before { transform: translateX(20px); }

/* ── Divider ────────────────────────────────────────────────── */
.divider {
  height: 1px;
  background: var(--border);
  margin: 24px 0;
}

/* ── Empty State ────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 60px 24px;
  color: var(--text-muted);
}
.empty-state-icon { font-size: 3rem; margin-bottom: 16px; }
.empty-state h3 { font-size: 1.1rem; margin-bottom: 8px; color: var(--text-light); }
.empty-state p { font-size: 0.9rem; max-width: 320px; margin: 0 auto; }
