/* ===== VARIÁVEIS CSS ESSENCIAIS ===== */
:root {
  --cart-width: 380px;
  --transition-speed: 0.4s;
  --primary-color: #E53E3E; /* Vermelho da marca */
  --primary-dark: #C53030; /* Vermelho mais escuro */
  --secondary-color: #4A5568; /* Cinza escuro */
  --text-primary: #2D3748; /* Cinza escuro para texto */
  --text-secondary: #718096; /* Cinza médio para texto secundário */
  --border-color: #E2E8F0; /* Cinza claro para bordas */
  --background-light: #F7FAFC; /* Cinza muito claro para fundo */
  --background-dark: #2D3748; /* Cinza escuro para header */
  --shadow-light: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  --shadow-medium: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
  --shadow-heavy: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

/* ===== BOTÃO TOGGLE DO CARRINHO ===== */
.fixed-cart-toggle {
  position: fixed !important;
  bottom: 20px !important;
  right: 20px !important;
  background: var(--primary-color) !important;
  color: #fff !important;
  border: none !important;
  padding: 16px !important;
  border-radius: 50% !important;
  cursor: pointer !important;
  z-index: 10001 !important;
  font-size: 18px !important;
  box-shadow: var(--shadow-heavy) !important;
  transition: all 0.3s ease !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 60px !important;
  height: 60px !important;
}

.fixed-cart-toggle:hover {
  background: var(--primary-dark) !important;
  transform: translateY(-4px) scale(1.05) !important;
  box-shadow: var(--shadow-heavy) !important;
}

.fixed-cart-toggle svg {
  width: 20px;
  height: 20px;
  color: white;
}

.cart-count {
  position: absolute;
  top: -8px;
  right: -8px;
  background: #ff4444;
  color: white;
  border-radius: 50%;
  width: 20px;
  height: 20px;
  font-size: 12px;
  font-weight: bold;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.cart-count:empty {
  display: none;
}

/* Garante que o contador seja visível quando há itens */
.cart-count:not(:empty) {
  display: flex !important;
}

/* ===== LAYOUT DO CARRINHO ===== */
#fixed-cart {
  position: fixed;
  top: 0;
  right: calc(-1 * var(--cart-width));
  width: var(--cart-width);
  height: 100vh;
  background: #fff;
  box-shadow: var(--shadow-heavy);
  transition: right var(--transition-speed) cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 10000;
  display: flex;
  flex-direction: column;
  border-left: 1px solid var(--border-color);
}

#fixed-cart.open {
  right: 0;
}

/* Garante que o carrinho inicie fechado */
#fixed-cart:not(.open) {
  right: calc(-1 * var(--cart-width)) !important;
}

/* ===== HEADER DO CARRINHO ===== */
.cart-header {
  background: var(--background-dark);
  color: white;
  padding: 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: var(--shadow-light);
}

.cart-header h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  color: white;
}

.cart-close-btn {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: white;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  transition: all 0.2s ease;
}

.cart-close-btn:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: scale(1.1);
}

/* ===== CONTEÚDO DO CARRINHO ===== */
#cart-content {
  flex: 1;
  overflow-y: auto;
  padding: 0;
}

/* ===== ESTILOS DOS PRODUTOS ===== */
.cart-item-wrapper {
  border-bottom: 1px solid var(--border-color);
  transition: all 0.2s ease;
}

.cart-item-wrapper:hover {
  background-color: var(--background-light);
}

.cart-item-wrapper:last-child {
  border-bottom: none;
}

.widget_shopping_cart_content .woocommerce-mini-cart li {
  padding: 0;
  margin: 0;
  border: none;
  background: none;
  min-height: auto;
}

/* ===== HEADER DO ITEM ===== */
.cart-item-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 20px 20px 16px 20px;
  gap: 16px;
}

.product-info {
  flex: 1;
  min-width: 0;
}

.product-title {
  color: var(--text-primary);
  font-weight: 700;
  font-size: 16px;
  line-height: 1.3;
  margin: 0 0 8px 0;
  cursor: default;
  word-wrap: break-word;
}

.product-price {
  color: var(--primary-color);
  font-weight: 600;
  font-size: 18px;
  margin: 0;
}

.remove-item {
  background: #dc2626;
  color: white;
  border: none;
  border-radius: 50%;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 18px;
  font-weight: bold;
  transition: all 0.2s ease;
  flex-shrink: 0;
  position: relative;
}

.remove-item:hover {
  background: #b91c1c;
  transform: scale(1.1);
}

.remove-item:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

.remove-item.loading {
  background: #6b7280;
  cursor: not-allowed;
}

.remove-item.loading::after {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  border: 2px solid transparent;
  border-top: 2px solid white;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* ===== BOTÃO REMOVER ===== */
.widget_shopping_cart_content .woocommerce-mini-cart li .remove {
  color: #ffffff !important;
  text-decoration: none !important;
  font-weight: bold !important;
  font-size: 20px !important;
  position: absolute !important;
  top: 12px !important;
  right: 12px !important;
  padding: 0 !important;
  border-radius: 50% !important;
  transition: all 0.3s ease !important;
  background: #dc2626 !important;
  border: 2px solid #dc2626 !important;
  width: 36px !important;
  height: 36px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  line-height: 1 !important;
  z-index: 100 !important;
  box-shadow: 0 2px 8px rgba(220, 38, 38, 0.3) !important;
}

.widget_shopping_cart_content .woocommerce-mini-cart li .remove:hover {
  background-color: #b91c1c !important;
  color: white !important;
  transform: scale(1.1) !important;
  box-shadow: 0 4px 16px rgba(220, 38, 38, 0.4) !important;
  border-color: #b91c1c !important;
}

/* ===== INFORMAÇÕES ORGANIZADAS DO PRODUTO ===== */
.product-details {
  padding: 0 20px 20px 20px;
}

.details-grid {
  display: grid;
  gap: 12px;
  background: var(--background-light);
  border-radius: 8px;
  padding: 16px;
  border: 1px solid var(--border-color);
}

.detail-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
  font-size: 14px;
  line-height: 1.4;
  transition: all 0.2s ease;
}

.detail-item:hover {
  background-color: rgba(0, 0, 0, 0.02);
  border-radius: 4px;
  padding-left: 8px;
  padding-right: 8px;
  margin: 0 -8px;
}

.detail-item:last-child {
  border-bottom: none;
}

.detail-label {
  color: var(--text-primary);
  font-weight: 600;
  min-width: 120px;
  flex-shrink: 0;
  padding-right: 12px;
  font-size: 13px;
}

.detail-value {
  color: var(--text-secondary);
  text-align: right;
  flex: 1;
  font-weight: 500;
  font-size: 13px;
  word-wrap: break-word;
}

/* ===== FOOTER DO CARRINHO ===== */
.cart-footer {
  background: white;
  padding: 20px;
  border-top: 1px solid var(--border-color);
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.05);
  margin-top: auto;
}

.cart-subtotal {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding: 16px;
  background: var(--background-light);
  border-radius: 8px;
  border: 1px solid var(--border-color);
}

.subtotal-label {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
}

.subtotal-amount {
  font-size: 20px;
  font-weight: 700;
  color: var(--primary-color);
}

/* ===== BOTÕES DE AÇÃO ===== */
.cart-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.btn-checkout {
  background: var(--primary-color);
  color: white;
  font-size: 16px;
  padding: 16px 24px;
  border: none;
  border-radius: 8px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.3s ease;
  text-decoration: none;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  position: relative;
  overflow: hidden;
}

.btn-checkout:hover {
  background: var(--primary-dark);
  transform: translateY(-2px);
  box-shadow: var(--shadow-medium);
  color: white;
  text-decoration: none;
}

.btn-text {
  flex: 1;
}

.btn-icon {
  font-size: 18px;
  transition: transform 0.3s ease;
}

.btn-checkout:hover .btn-icon {
  transform: translateX(4px);
}

/* ===== RESPONSIVIDADE ===== */
@media (max-width: 768px) {
  :root {
    --cart-width: 100vw;
  }
  
  /* Ajusta o carrinho para mobile mas não esconde completamente */
  #fixed-cart {
    width: 100vw;
    right: calc(-1 * 100vw);
  }
  
  #fixed-cart.open {
    right: 0;
  }
  
  .fixed-cart-toggle {
    bottom: 15px;
    right: 15px;
    width: 50px;
    height: 50px;
  }

  /* Ajustes para mobile */
  .cart-item-header {
    padding: 16px 16px 12px 16px;
    gap: 12px;
  }

  .product-title {
    font-size: 15px;
  }

  .product-price {
    font-size: 16px;
  }

  .product-details {
    padding: 0 16px 16px 16px;
  }

  .details-grid {
    padding: 12px;
    gap: 10px;
  }

  .detail-item {
    font-size: 13px;
    padding: 6px 0;
  }

  .detail-label {
    min-width: 100px;
    font-size: 12px;
  }

  .detail-value {
    font-size: 12px;
  }

  .cart-footer {
    padding: 16px;
  }

  .cart-subtotal {
    padding: 12px;
    margin-bottom: 16px;
  }

  .subtotal-label {
    font-size: 15px;
  }

  .subtotal-amount {
    font-size: 18px;
  }

  .btn-checkout {
    padding: 14px 20px;
    font-size: 15px;
  }
}

/* ===== ANIMAÇÕES ===== */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.widget_shopping_cart_content .woocommerce-mini-cart li {
  animation: fadeInUp 0.5s ease forwards;
}

/* ===== ESCONDER CARRINHO NO CHECKOUT ===== */
.woocommerce-checkout .fixed-cart,
.woocommerce-checkout .fixed-cart-toggle {
  display: none !important;
  visibility: hidden !important;
}

/* ===== ESCONDER ELEMENTOS DESNECESSÁRIOS ===== */
.elementor-menu-cart__product-image,
.product-thumbnail {
  display: none !important;
}

/* Esconde botões "Ver carrinho" */
.elementor-button--view-cart,
.elementor-button[href*="cart"]:not([href*="checkout"]),
.btn-view-cart,
a[href*="cart"]:not([href*="checkout"]) {
  display: none !important;
  visibility: hidden !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

/* ===== MENSAGEM DE CARRINHO VAZIO ===== */
.woocommerce-mini-cart__empty-message {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  text-align: center;
  min-height: 200px;
}

.empty-cart-icon {
  font-size: 48px;
  margin-bottom: 16px;
  opacity: 0.6;
}

.empty-cart-text {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.empty-cart-subtext {
  font-size: 14px;
  color: var(--text-secondary);
  opacity: 0.8;
}

/* ===== CARRINHO INDISPONÍVEL ===== */
.cart-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  text-align: center;
  min-height: 200px;
  background: var(--background-light);
  border-radius: 8px;
  margin: 20px;
}

.empty-icon {
  width: 48px;
  height: 48px;
  background: var(--border-color);
  border-radius: 50%;
  margin-bottom: 16px;
}

.empty-text {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.empty-subtext {
  font-size: 14px;
  color: var(--text-secondary);
  opacity: 0.8;
}