/* Variáveis de Design */
:root {
  /* Cores */
  --design-primary: #ffbe33;
  --design-secondary: #0c0c0c;
  --design-accent: #ffffff;
  --design-text: #0c0c0c;
  --design-bg: #f8f8f8;
  --design-bg-alt: #f9fafb;
  
  /* Tipografia */
  --design-font-heading: 'Dancing Script', cursive;
  --design-font-body: 'Open Sans', sans-serif;
  
  /* Botões */
  --design-btn-bg: #ffbe33;
  --design-btn-text: #0c0c0c;
  --design-btn-border: #ffbe33;
  --design-btn-hover-bg: #ffffff;
  --design-btn-hover-text: #ffbe33;
  --design-btn-hover-border: #ffbe33;
  
  /* Header */
  --design-header-bg: #ffbe33;
  --design-header-text: #0c0c0c;
  --design-header-hover: #ffffff;
  
  /* Footer */
  --design-footer-bg: #0c0c0c;
  --design-footer-text: #ffffff;
  --design-footer-hover: #ffbe33;
  
  /* Hero */
  --design-hero-bg-url: url('');
  --design-hero-title: '';
  --design-hero-subtitle: '';
}

/* Elemento: Carrinho Sidebar - Estilos */

/* Botão do carrinho no header */
.carrinho-sidebar-trigger {
  position: relative;
}

.carrinho-btn {
  position: relative;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  color: inherit;
}

.carrinho-btn:hover {
  opacity: 0.8;
  transform: scale(1.05);
}

.carrinho-badge {
  position: absolute;
  top: 0;
  right: 0;
  background: #ffbe33;
  color: var(--design-bg, #f8f8f8);
  font-size: 0.75rem;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  border-radius: 9px;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 0 0.25rem;
}

.carrinho-badge.has-items {
  display: flex;
}

/* Sidebar customização */
.carrinho-sidebar {
  width: 420px !important;
  max-width: 100vw;
}

.carrinho-sidebar .offcanvas-header {
  border-bottom: 1px solid #e5e7eb;
  padding: 1.5rem;
}

.carrinho-sidebar .offcanvas-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: #111827;
  display: flex;
  align-items: center;
}

.carrinho-sidebar .offcanvas-body {
  padding: 0;
  display: flex;
  flex-direction: column;
}

/* Header info */
.carrinho-header-info {
  padding: 1rem 1.5rem;
  background: #f9fafb;
  border-bottom: 1px solid #e5e7eb;
}

.carrinho-item-count {
  font-size: 0.875rem;
  color: #6b7280;
}

.carrinho-item-count span {
  font-weight: 700;
  color: #111827;
}

/* Lista de items */
.carrinho-items-list {
  flex: 1;
  overflow-y: auto;
  padding: 1rem 1.5rem;
  margin: 0;
  list-style: none;
}

.carrinho-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem 1rem;
  color: #9ca3af;
  text-align: center;
}

.carrinho-empty svg {
  margin-bottom: 1rem;
  opacity: 0.5;
}

.carrinho-empty p {
  margin: 0;
  font-size: 0.875rem;
}

/* Item do carrinho */
.carrinho-item {
  display: flex;
  gap: 1rem;
  padding: 1rem 0;
  border-bottom: 1px solid #f3f4f6;
}

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

.carrinho-item-image {
  width: 80px;
  height: 80px;
  object-fit: cover;
  border-radius: 0.5rem;
  flex-shrink: 0;
}

.carrinho-item-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.carrinho-item-name {
  font-weight: 600;
  color: #111827;
  font-size: 0.875rem;
  line-height: 1.4;
}

.carrinho-item-variant {
  font-size: 0.75rem;
  color: #6b7280;
}

/* Indicador de quantidade mínima */
.carrinho-item-qtd-minima {
  font-size: 0.6875rem;
  color: #64748b;
  background: #f1f5f9;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  display: inline-block;
  width: fit-content;
}

.carrinho-item-qtd-minima.alerta {
  color: #dc2626;
  background: #fef2f2;
  border: 1px solid #fecaca;
  font-weight: 600;
}

/* Item com alerta de quantidade insuficiente */
.carrinho-item.carrinho-item-alerta {
  background: #fffbeb;
  border-left: 3px solid #f59e0b;
  margin-left: -0.25rem;
  padding-left: 0.75rem;
}

.carrinho-item-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: auto;
}

.carrinho-item-quantity {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: #f9fafb;
  border-radius: 0.375rem;
  padding: 0.25rem;
}

.carrinho-quantity-btn {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--design-btn-bg, #ffbe33);
  border: 1px solid #e5e7eb;
  border-radius: 0.25rem;
  cursor: pointer;
  font-size: 1rem;
  color: #374151;
  transition: all 0.2s;
}

.carrinho-quantity-btn:hover {
  background: var(--design-btn-hover-bg, #ffffff);
  border-color: #d1d5db;
}

.carrinho-item-quantity span {
  min-width: 32px;
  text-align: center;
  font-weight: 600;
  font-size: 0.875rem;
}

.carrinho-item-price {
  font-weight: 700;
  color: #111827;
  font-size: 0.875rem;
}

.carrinho-item-remove {
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
  color: #ef4444;
  transition: all 0.2s;
  align-self: flex-start;
}

.carrinho-item-remove:hover {
  opacity: 0.7;
  transform: scale(1.1);
}

/* Footer */
.carrinho-footer {
  border-top: 2px solid #e5e7eb;
  padding: 1.5rem;
  background: #f9fafb;
}

.carrinho-subtotal {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
  font-size: 1rem;
}

.carrinho-subtotal-label {
  font-weight: 500;
  color: #6b7280;
}

.carrinho-subtotal-value {
  font-weight: 600;
  color: #374151;
}

.carrinho-frete-total {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
  font-size: 1rem;
}

.carrinho-frete-label {
  font-weight: 500;
  color: #6b7280;
}

.carrinho-frete-value {
  font-weight: 600;
  color: #059669;
}

.carrinho-total {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  padding-top: 0.75rem;
  border-top: 1px solid #e5e7eb;
  font-size: 1.125rem;
}

.carrinho-total-label {
  font-weight: 600;
  color: #374151;
}

.carrinho-total-value {
  font-weight: 700;
  color: #111827;
  font-size: 1.5rem;
}

/* Seção de Frete no Carrinho */
.carrinho-frete-section {
  border-top: 1px solid #e5e7eb;
  padding: 0.75rem 1rem;
  background: #f9fafb;
  margin-bottom: 0;
  max-height: 200px;
  overflow-y: auto;
}

.carrinho-frete-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 600;
  color: #374151;
  margin-bottom: 0.5rem;
  font-size: 0.85rem;
}

.carrinho-frete-input {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.frete-cep-input {
  flex: 1;
  padding: 0.5rem 0.75rem;
  border: 1px solid #d1d5db;
  border-radius: 0.375rem;
  font-size: 0.875rem;
  transition: all 0.2s;
}

.frete-cep-input:focus {
  outline: none;
  border-color: var(--design-primary, #3b82f6);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.frete-calcular-btn {
  padding: 0.625rem 1rem;
  background: var(--design-primary, #3b82f6);
  color: white;
  border: none;
  border-radius: 0.375rem;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.frete-calcular-btn:hover {
  background: var(--design-secondary, #2563eb);
  transform: translateY(-1px);
}

.carrinho-frete-loading {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem;
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 0.375rem;
  font-size: 0.75rem;
  color: #6b7280;
}

.loading-spinner {
  width: 14px;
  height: 14px;
  border: 2px solid #e5e7eb;
  border-top-color: var(--design-primary, #3b82f6);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

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

.carrinho-frete-resultados {
  margin-top: 0.5rem;
  max-height: 120px;
  overflow-y: auto;
}

.frete-opcao {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0.75rem;
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 0.25rem;
  margin-bottom: 0.35rem;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 0.8rem;
}

.frete-opcao:hover {
  border-color: var(--design-primary, #3b82f6);
  background: #f0f9ff;
}

.frete-opcao.selecionada {
  border-color: var(--design-primary, #3b82f6);
  background: #eff6ff;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.1);
}

.frete-opcao-info {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.frete-opcao-nome {
  font-weight: 600;
  color: #111827;
  font-size: 0.8rem;
}

.frete-opcao-prazo {
  font-size: 0.7rem;
  color: #6b7280;
}

.frete-opcao-preco {
  font-weight: 700;
  color: #059669;
  font-size: 0.85rem;
}

.frete-opcao-preco.gratis {
  color: #10b981;
}

.frete-erro {
  padding: 0.5rem;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 0.375rem;
  color: #dc2626;
  font-size: 0.75rem;
}

.carrinho-checkout-btn {
  width: 100%;
  padding: 1rem;
  background: var(--design-btn-bg, #ffbe33);
  color: var(--design-primary, white);
  border: none;
  border-radius: 0.5rem;
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
}

.carrinho-checkout-btn:hover {
  background: var(--design-btn-hover-bg, #ffffff);
  transform: translateY(-1px);
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

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

/* Responsivo */
@media (max-width: 768px) {
  .carrinho-sidebar {
    width: 100% !important;
  }
  
  .carrinho-item-image {
    width: 60px;
    height: 60px;
  }
  
  .carrinho-total-value {
    font-size: 1.25rem;
  }
}

/* ======================================== */
/* ALERTAS DE VALIDAÇÃO (Quantidade/Valor Mínimo) */
/* ======================================== */

.carrinho-alerta-minimo {
  padding: 0.75rem 1rem;
  margin-bottom: 0.5rem;
}

.alerta-valor-minimo {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  background: linear-gradient(135deg, #fef3c7 0%, #fef9c3 100%);
  border: 1px solid #f59e0b;
  border-radius: 0.5rem;
  margin-bottom: 0.5rem;
}

.alerta-valor-minimo .alerta-icone {
  font-size: 1.25rem;
  flex-shrink: 0;
}

.alerta-valor-minimo .alerta-texto {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.alerta-valor-minimo .alerta-texto strong {
  color: #92400e;
  font-size: 0.875rem;
}

.alerta-valor-minimo .alerta-texto span {
  color: #b45309;
  font-size: 0.75rem;
}

.alerta-quantidade-minima {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 0.375rem;
  color: #dc2626;
  font-size: 0.75rem;
  margin-top: 0.5rem;
}

.alerta-quantidade-minima .alerta-icone {
  flex-shrink: 0;
}

/* Botão desabilitado por validação */
.carrinho-checkout-btn.disabled,
.carrinho-finalizar-btn.disabled {
  background: #d1d5db !important;
  color: #9ca3af !important;
  cursor: not-allowed;
  pointer-events: none;
  opacity: 0.7;
}

.carrinho-checkout-btn.disabled:hover,
.carrinho-finalizar-btn.disabled:hover {
  transform: none;
  box-shadow: none;
}
