/*======================================================================
# SIDEBAR.CSS - Carrinho com Navegação no Header
# Versão: 3.0 - Botões no Header, Footer Apenas Resumo
======================================================================*/

/*======================================================================
# OVERLAY - Bloqueia conteúdo de trás
======================================================================*/
.sidebar-overlay {
  position: fixed;
  inset: 0;
  background: rgba(43, 61, 79, 0.9);
  backdrop-filter: blur(10px);
  z-index: 9998;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.sidebar-overlay.active {
  opacity: 1;
  visibility: visible;
  pointer-events: all;
}

/*======================================================================
# SIDEBAR - 100% Mobile, 640px Desktop
======================================================================*/
.cart-sidebar {
  position: fixed;
  top: 0;
  right: 0;
  width: 100vw;
  max-width: 100vw;
  height: 100vh;
  background: linear-gradient(135deg, #ffffff 0%, #f3f9fb 100%);
  box-shadow: -8px 0 40px rgba(106, 197, 202, 0.3);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: translate3d(100%, 0, 0);
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.cart-sidebar.active {
  transform: translate3d(0, 0, 0);
}

@media (min-width: 769px) {
  .cart-sidebar {
    width: 640px;
  }
}

/*======================================================================
# HEADER - Navegação com Ícones
======================================================================*/
.sidebar-header {
  padding: 20px 24px;
  background: linear-gradient(135deg, #6ac5ca 0%, #4ba3a8 100%);
  color: white;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 4px 20px rgba(106, 197, 202, 0.4);
  position: relative;
  z-index: 1;
  flex-shrink: 0;
  gap: 12px;
}

.sidebar-header::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent-color), var(--secondary-color), var(--accent-color));
}

.sidebar-header-left,
.sidebar-header-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.sidebar-header-center {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.sidebar-title {
  font-size: 1.2rem;
  font-weight: 700;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  letter-spacing: 0.5px;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.sidebar-title i {
  font-size: 1.3rem;
}

.cart-count-sidebar {
  background: rgba(255, 255, 255, 0.25);
  color: white;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 800;
  border: 2px solid rgba(255, 255, 255, 0.3);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

/* Botões do Header */
.header-nav-btn {
  background: rgba(255, 255, 255, 0.2);
  border: 2px solid rgba(255, 255, 255, 0.3);
  color: white;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s ease;
  font-size: 1.2rem;
  backdrop-filter: blur(4px);
}

.header-nav-btn:hover {
  background: rgba(255, 255, 255, 0.35);
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.header-nav-btn.btn-back {
  background: rgba(100, 116, 139, 0.3);
}

.header-nav-btn.btn-back:hover {
  background: rgba(100, 116, 139, 0.5);
}

.header-nav-btn.btn-confirm {
  background: rgba(16, 185, 129, 0.3);
}

.header-nav-btn.btn-confirm:hover {
  background: rgba(16, 185, 129, 0.5);
}

.header-nav-btn.btn-clear {
  background: rgba(239, 68, 68, 0.3);
}

.header-nav-btn.btn-clear:hover {
  background: rgba(239, 68, 68, 0.5);
}

.header-nav-btn.sidebar-close:hover {
  transform: rotate(90deg) scale(1.05);
}

/*======================================================================
# CONTENT
======================================================================*/
.sidebar-content {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  background: var(--light-bg);
  -webkit-overflow-scrolling: touch;
}

.sidebar-content::-webkit-scrollbar {
  width: 8px;
}

.sidebar-content::-webkit-scrollbar-track {
  background: rgba(106, 197, 202, 0.05);
}

.sidebar-content::-webkit-scrollbar-thumb {
  background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
  border-radius: 10px;
}

/*======================================================================
# CARRINHO VAZIO
======================================================================*/
.cart-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 80px 24px;
  text-align: center;
  min-height: 400px;
}

.cart-empty i {
  font-size: 6rem;
  margin-bottom: 24px;
  background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  opacity: 0.6;
}

.cart-empty h4 {
  font-size: 1.6rem;
  color: var(--text-color);
  margin-bottom: 12px;
  font-weight: 700;
}

.cart-empty p {
  color: var(--light-text);
  margin-bottom: 32px;
  font-size: 1.05rem;
}

/*======================================================================
# ITENS DO CARRINHO
======================================================================*/
.cart-items {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.cart-item {
  background: white;
  border-radius: 16px;
  padding: 18px;
  display: flex;
  gap: 16px;
  box-shadow: 0 2px 12px rgba(106, 197, 202, 0.12);
  transition: all 0.3s ease;
  position: relative;
  border: 2px solid transparent;
}

.cart-item:hover {
  transform: translateX(-4px);
  box-shadow: 0 6px 24px rgba(106, 197, 202, 0.25);
  border-color: var(--primary-color);
}

.cart-item-image {
  width: 100px;
  height: 120px;
  border-radius: 12px;
  object-fit: cover;
  flex-shrink: 0;
  background: var(--light-bg);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  border: 2px solid var(--border-color);
}

.cart-item-details {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.cart-item-name {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-color);
  margin: 0;
  line-height: 1.4;
}

.cart-item-specs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 6px;
}

.spec-badge {
  background: linear-gradient(135deg, rgba(106, 197, 202, 0.1), rgba(141, 226, 231, 0.1));
  padding: 5px 12px;
  border-radius: 8px;
  font-size: 0.85rem;
  color: var(--primary-dark);
  display: flex;
  align-items: center;
  gap: 6px;
  border: 1px solid rgba(106, 197, 202, 0.3);
  font-weight: 600;
}

.spec-badge i {
  font-size: 0.8rem;
  color: var(--accent-color);
}

.cart-item-price {
  font-size: 1.2rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--accent-color), #ff6b9d);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-top: auto;
}

.cart-item-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 10px;
}

.quantity-controls-cart {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--light-bg);
  border-radius: 12px;
  padding: 6px 10px;
  border: 2px solid var(--border-color);
}

.qty-btn-cart {
  background: white;
  border: 2px solid var(--primary-color);
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s ease;
  color: var(--primary-color);
  font-size: 1rem;
  font-weight: 700;
}

.qty-btn-cart:hover:not(:disabled) {
  background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
  color: white;
  transform: scale(1.1);
}

.qty-btn-cart:disabled {
  opacity: 0.3;
  cursor: not-allowed;
  border-color: var(--light-text);
  color: var(--light-text);
}

.qty-value-cart {
  font-weight: 700;
  color: var(--text-color);
  min-width: 30px;
  text-align: center;
  font-size: 1rem;
}

.btn-remove-item {
  background: linear-gradient(135deg, #ff4444, #cc0000);
  border: none;
  color: white;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s ease;
  margin-left: auto;
  box-shadow: 0 4px 12px rgba(255, 68, 68, 0.3);
}

.btn-remove-item:hover {
  background: linear-gradient(135deg, #cc0000, #990000);
  transform: scale(1.1) rotate(90deg);
}

/*======================================================================
# FOOTER - Apenas Resumo
======================================================================*/
.sidebar-footer {
  padding: 20px 24px;
  background: white;
  border-top: 3px solid var(--border-color);
  box-shadow: 0 -4px 20px rgba(106, 197, 202, 0.1);
  flex-shrink: 0;
}

.order-summary {
  background: var(--light-bg);
  padding: 18px;
  border-radius: 12px;
  border: 2px solid var(--border-color);
}

.summary-line {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  font-size: 1rem;
}

.summary-line.summary-subtotal {
  color: var(--light-text);
  font-weight: 600;
}

.summary-line.summary-shipping {
  color: var(--light-text);
  border-top: 1px solid var(--border-color);
  padding-top: 14px;
  margin-top: 8px;
  font-weight: 600;
}

.summary-line.summary-total {
  border-top: 3px solid var(--primary-color);
  padding-top: 16px;
  margin-top: 12px;
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--text-color);
}

.summary-value {
  font-weight: 700;
  background: linear-gradient(135deg, var(--accent-color), #ff6b9d);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.summary-total .summary-value {
  font-size: 1.5rem;
}

/*======================================================================
# CHECKOUT
======================================================================*/
.checkout-section {
  padding: 0;
}

.checkout-step {
  background: white;
  border-radius: 16px;
  padding: 24px;
  margin-bottom: 24px;
  box-shadow: 0 4px 16px rgba(106, 197, 202, 0.12);
  border: 2px solid var(--border-color);
  transition: all 0.3s ease;
}

.checkout-step:hover {
  box-shadow: 0 6px 24px rgba(106, 197, 202, 0.2);
  border-color: var(--primary-color);
}

.step-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 24px;
  padding-bottom: 18px;
  border-bottom: 2px solid var(--border-color);
}

.step-number {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1.2rem;
  box-shadow: 0 4px 12px rgba(106, 197, 202, 0.4);
  flex-shrink: 0;
}

.step-title {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text-color);
  margin: 0;
}

.form-group {
  margin-bottom: 20px;
}

.form-label {
  display: block;
  margin-bottom: 10px;
  font-weight: 700;
  color: var(--text-color);
  font-size: 0.95rem;
}

.form-label i {
  color: var(--accent-color);
  margin-right: 8px;
}

.form-control {
  width: 100%;
  padding: 14px 16px;
  border: 2px solid var(--border-color);
  border-radius: 10px;
  font-size: 0.95rem;
  transition: all 0.3s ease;
  background: white;
  color: var(--text-color);
}

.form-control:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 4px rgba(106, 197, 202, 0.15);
}

.form-control.is-invalid {
  border-color: #ff4444;
  background: rgba(255, 68, 68, 0.05);
}

.invalid-feedback {
  color: #ff4444;
  font-size: 0.85rem;
  margin-top: 6px;
  display: none;
  font-weight: 600;
}

.form-control.is-invalid + .invalid-feedback {
  display: block;
}

/*======================================================================
# FRETE
======================================================================*/
.frete-option {
  background: white;
  border: 2px solid var(--border-color);
  border-radius: 14px;
  padding: 18px;
  margin-bottom: 14px;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.frete-option:hover {
  border-color: var(--primary-color);
  transform: translateX(6px);
  box-shadow: 0 6px 20px rgba(106, 197, 202, 0.2);
}

.frete-option.selected {
  border-color: var(--primary-color);
  background: linear-gradient(135deg, rgba(106, 197, 202, 0.05), rgba(141, 226, 231, 0.05));
  box-shadow: 0 6px 20px rgba(106, 197, 202, 0.3);
}

.frete-info {
  display: flex;
  align-items: center;
  gap: 14px;
  flex: 1;
}

.frete-icon {
  width: 56px;
  height: 56px;
  background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(106, 197, 202, 0.4);
}

.frete-icon i {
  font-size: 1.5rem;
  color: white;
}

.frete-details {
  flex: 1;
}

.frete-details h5 {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-color);
  margin: 0 0 6px 0;
}

.frete-desc {
  font-size: 0.85rem;
  color: var(--light-text);
  margin: 0 0 8px 0;
}

.frete-time {
  font-size: 0.85rem;
  color: var(--primary-dark);
  font-weight: 600;
}

.frete-time i {
  margin-right: 5px;
}

.frete-detalhes {
  font-size: 0.75rem;
  color: var(--light-text);
  margin-top: 4px;
}

.frete-price {
  font-size: 1.4rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--accent-color), #ff6b9d);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  text-align: right;
  white-space: nowrap;
}

.frete-price.free {
  background: linear-gradient(135deg, #10b981, #059669);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

/*======================================================================
# LOADING
======================================================================*/
.sidebar-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 80px 24px;
  text-align: center;
  min-height: 400px;
}

.sidebar-loading i {
  font-size: 4rem;
  background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 20px;
  animation: spin 1.5s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.sidebar-loading p {
  color: var(--light-text);
  font-size: 1.05rem;
  font-weight: 600;
}

/*======================================================================
# SUCCESS
======================================================================*/
.success-message {
  background: white;
  border-radius: 16px;
  padding: 50px 24px;
  text-align: center;
  box-shadow: 0 4px 16px rgba(106, 197, 202, 0.12);
  border: 2px solid var(--border-color);
}

.success-message i {
  font-size: 6rem;
  background: linear-gradient(135deg, #10b981, #059669);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 24px;
  animation: successPulse 1s ease-in-out;
}

@keyframes successPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}

.success-message h3 {
  font-size: 1.8rem;
  color: var(--text-color);
  margin-bottom: 12px;
  font-weight: 800;
}

.success-message p {
  color: var(--light-text);
  margin-bottom: 32px;
  font-size: 1.05rem;
}

/*======================================================================
# RESPONSIVE
======================================================================*/
@media (max-width: 768px) {
  .sidebar-header {
    padding: 18px 20px;
  }
  
  .sidebar-title {
    font-size: 1.1rem;
  }
  
  .header-nav-btn {
    width: 40px;
    height: 40px;
    font-size: 1.1rem;
  }
  
  .sidebar-content {
    padding: 20px;
  }
  
  .cart-item {
    padding: 14px;
    gap: 12px;
  }
  
  .cart-item-image {
    width: 80px;
    height: 100px;
  }
  
  .sidebar-footer {
    padding: 18px 20px;
  }
}

@media (max-width: 480px) {
  .sidebar-header {
    padding: 16px 18px;
  }
  
  .sidebar-title {
    font-size: 1rem;
  }
  
  .header-nav-btn {
    width: 38px;
    height: 38px;
    font-size: 1rem;
  }
  
  .cart-count-sidebar {
    font-size: 0.75rem;
    padding: 2px 8px;
  }
  
  .sidebar-content {
    padding: 16px 18px;
  }
  
  .cart-item-image {
    width: 70px;
    height: 90px;
  }
}