/* ========================= */
/* Bloco de Endereço Moderno */
/* ========================= */
.address-selector {
  background: rgba(52, 152, 219, 0.06);
  border-radius: 12px;
  padding: 1.2rem 1.2rem 1rem 1.2rem;
  margin-bottom: 1.2rem;
  box-shadow: 0 2px 12px rgba(52, 152, 219, 0.09);
  animation: fadeIn 0.5s;
  border: 1px solid #e3eafc;
}

.address-selector h3 {
  font-size: 1.05rem;
  color: var(--primary-color);
  margin-bottom: 0.7rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

#userAddresses {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  margin-bottom: 0.7rem;
  min-width: 0;
}

.user-address-card {
  background: #fff;
  border: 1.5px solid var(--primary-color, #3498db);
  border-radius: 10px;
  padding: 0.8rem 1.1rem;
  display: flex;
  align-items: center;
  gap: 0.7rem;
  cursor: pointer;
  transition: box-shadow 0.2s, border 0.2s;
  box-shadow: 0 2px 8px rgba(52, 152, 219, 0.08);
  position: relative;
  min-width: 0;
}
.user-address-card.selected {
  border: 2.5px solid var(--primary-color, #3498db);
  box-shadow: 0 4px 16px rgba(52, 152, 219, 0.15);
  background: linear-gradient(90deg, #eaf6fb 0%, #fff 100%);
}
.user-address-card .material-icons {
  color: var(--primary-color, #3498db);
  font-size: 1.3rem;
  margin-right: 0.3rem;
}
.user-address-info {
  flex: 1;
  font-size: 0.97rem;
  color: #222;
}
.user-address-actions {
  display: flex;
  gap: 0.3rem;
}
.user-address-actions button {
  background: none;
  border: none;
  color: var(--danger-color, #e74c3c);
  font-size: 1.1rem;
  cursor: pointer;
  padding: 0.2rem 0.4rem;
  border-radius: 4px;
  transition: background 0.2s;
}
.user-address-actions button:hover {
  background: rgba(231, 76, 60, 0.08);
}

#addNewAddressBtn {
  margin-top: 0.5rem;
  margin-bottom: 0.2rem;
  width: 100%;
  font-size: 0.98rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  border-radius: 8px;
  min-height: 40px;
}

#newAddressForm {
  background: #f8fafd;
  border-radius: 10px;
  padding: 1rem 0.7rem 0.7rem 0.7rem;
  margin-top: 0.5rem;
  box-shadow: 0 2px 8px rgba(52, 152, 219, 0.09);
}
#newAddressForm input[type="text"] {
  display: block;
  width: 100%;
  margin-bottom: 0.5rem;
  padding: 0.7rem 1rem;
  border: 1.2px solid #dbeafe;
  border-radius: 7px;
  font-size: 1rem;
  background: #fff;
  color: #222;
  transition: border 0.2s, box-shadow 0.2s;
  box-shadow: 0 1px 2px rgba(52,152,219,0.03);
}
#newAddressForm input[type="text"]:focus {
  border: 1.5px solid var(--primary-color, #3498db);
  outline: none;
  box-shadow: 0 0 0 2px rgba(52,152,219,0.10);
}
#newCepInput,
#newNumero,
#newEstado,
#newLogradouro,
#newComplemento,
#newBairro,
#newCidade {
  width: 100%;
  display: inline-block;
}
#fetchCepBtn, #saveNewAddressBtn {
  margin-top: 0.2rem;
  width: 100%;
  font-size: 1rem;
  min-height: 38px;
  border-radius: 7px;
}
#cepError {
  color: var(--danger-color, #e74c3c);
  font-size: 0.93rem;
  margin-top: 0.3rem;
}

/* Ajuste visual para integração com o bloco de frete */
.shipping-calculator {
  margin-top: 1.2rem;
}

/* ========== RESPONSIVO ========== */
@media (max-width: 900px) {
  .address-selector {
    padding: 1rem 0.7rem 0.7rem 0.7rem;
  }
  .user-address-card {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.3rem;
    padding: 0.7rem 0.7rem;
    width: 100%;
  }
  #newAddressForm input[type="text"] {
    font-size: 0.97rem;
    padding: 0.6rem 0.8rem;
  }
}
@media (max-width: 640px) {
  .address-selector {
    padding: 0.7rem 0.5rem 0.5rem 0.5rem;
  }
  #addNewAddressBtn {
    font-size: 0.95rem;
    padding: 0.7rem 0.5rem;
  }
  #newAddressForm input[type="text"] {
    font-size: 0.95rem;
    padding: 0.5rem 0.6rem;
  }
}
@media (max-width: 480px) {
  .address-selector {
    padding: 0.5rem 0.2rem 0.2rem 0.2rem;
  }
  .user-address-card {
    font-size: 0.93rem;
    padding: 0.5rem 0.2rem;
  }
  #newAddressForm {
    padding: 0.5rem 0.2rem 0.2rem 0.2rem;
  }
  #newAddressForm input[type="text"] {
    font-size: 0.93rem;
    padding: 0.4rem 0.4rem;
  }
}
/* Estilos para o Modal do Carrinho - Base */
.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: auto;
  background-color: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(3px);
  transition: all 0.3s ease;
}

.modal-content {
  background-color: var(--background-color);
  margin: 2rem auto;
  max-width: 1000px;
  width: 90%;
  border-radius: 12px;
  box-shadow: 0 5px 20px rgba(0, 0, 0, 0.2);
  animation: modalFadeIn 0.4s ease-out;
  overflow: hidden;
}

.cart-modal {
  display: flex;
  flex-direction: column;
  max-height: 90vh;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.2rem 1.5rem;
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
  position: sticky;
  top: 0;
  background-color: var(--background-color);
  z-index: 2;
}

.modal-header h2 {
  font-size: 1.4rem;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--primary-color);
}

.modal-header h2 .material-icons {
  font-size: 1.6rem;
}

.modal-close {
  color: var(--text-color);
  font-size: 1.8rem;
  cursor: pointer;
  padding: 0.2rem;
  transition: all 0.2s ease;
  line-height: 1;
}

.modal-close:hover {
  color: var(--primary-color);
  transform: scale(1.1);
}

.modal-body {
  padding: 1.5rem;
  display: flex;
  gap: 2rem;
  overflow: auto;
}

/* Estilos para os itens do carrinho */
.cart-items {
  flex: 1;
  max-height: 60vh;
  overflow-y: auto;
  padding-right: 1rem;
  scrollbar-width: thin;
}

.cart-item {
  display: flex;
  padding: 1rem 0;
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
  gap: 1rem;
}

.cart-item-image {
  width: 80px;
  height: 110px;
  object-fit: cover;
  border-radius: 6px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.cart-item-details {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.cart-item-title {
  font-weight: 600;
  margin-bottom: 0.3rem;
  color: var(--text-color);
}

.cart-item-price {
  font-weight: 500;
  color: var(--primary-color);
  margin-bottom: 0.5rem;
}

.cart-item-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.quantity-control {
  display: flex;
  align-items: center;
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 4px;
  overflow: hidden;
}

.quantity-btn {
  background: none;
  border: none;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background-color 0.2s;
}

.quantity-btn:hover {
  background-color: rgba(0, 0, 0, 0.05);
}

.quantity-input {
  width: 40px;
  text-align: center;
  border: none;
  font-weight: 500;
  background: transparent;
  color: var(--text-color);
}

.remove-item {
  color: var(--danger-color);
  background: none;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.9rem;
  transition: all 0.2s;
}

.remove-item:hover {
  text-decoration: underline;
}

.empty-cart {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  text-align: center;
  min-height: 200px;
}

.empty-cart .material-icons {
  font-size: 3rem;
  color: var(--disabled-color);
  margin-bottom: 1rem;
}

.empty-cart p {
  margin-bottom: 1.5rem;
  color: var(--disabled-color);
}

/* Estilos para o resumo do carrinho */
.cart-summary {
  flex: 1;
  background-color: rgba(0, 0, 0, 0.02);
  padding: 1.5rem;
  border-radius: 8px;
  min-width: 250px;
  position: sticky;
  top: 1.5rem;
  max-height: 60vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.summary-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 0.8rem;
  font-size: 1rem;
}

.summary-row.total {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(0, 0, 0, 0.1);
  font-weight: 600;
  font-size: 1.2rem;
  color: var(--primary-color);
}

/* Estilos para o calculador de frete */
.shipping-calculator {
  background-color: rgba(255, 255, 255, 0.3);
  border-radius: 8px;
  padding: 1.2rem;
  margin: 1.2rem 0;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.shipping-calculator h3 {
  font-size: 1rem;
  margin: 0 0 1rem 0;
  color: var(--text-color);
}

.shipping-input-group {
  display: flex;
  gap: 0.5rem;
}

.shipping-input-group input {
  flex: 1;
  padding: 0.8rem;
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 6px;
  font-size: 0.9rem;
  background-color: var(--background-color);
  color: var(--text-color);
}

.shipping-input-group button {
  padding: 0 1rem;
  background-color: var(--primary-color);
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 500;
  white-space: nowrap;
}

.shipping-input-group button:hover {
  opacity: 0.9;
}

#shippingFeedback {
  min-height: 2rem;
  margin-top: 0.8rem;
  font-size: 0.85rem;
}

.free-shipping-info {
  font-size: 0.85rem;
  margin-top: 0.8rem;
  padding: 0.6rem;
  background-color: rgba(230, 126, 34, 0.1);
  border-left: 3px solid var(--warning-color);
  border-radius: 4px;
}

/* Estilos para as ações do carrinho */
.cart-actions {
  display: flex;
  gap: 1rem;
  margin-top: 1.5rem;
}

.cart-actions button {
  flex: 1;
  padding: 0.8rem;
  border: none;
  border-radius: 6px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.cart-actions .button.secondary {
  background-color: transparent;
  border: 1px solid var(--primary-color);
  color: var(--primary-color);
}

.cart-actions .button.primary {
  background-color: var(--primary-color);
  color: white;
}

.cart-actions .button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.cart-actions .button:not(:disabled):hover {
  transform: translateY(-2px);
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.1);
}

/* Animações */
@keyframes modalFadeIn {
  from {
    opacity: 0;
    transform: translateY(-30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Responsividade */
@media screen and (max-width: 900px) {
  .modal-content {
    width: 95%;
    margin: 1rem auto;
  }

  .modal-body {
    flex-direction: column;
    gap: 1.5rem;
    padding: 1.2rem;
    max-height: calc(90vh - 80px);
    overflow-y: auto;
  }

  .cart-items {
    max-height: none;
    overflow-y: visible;
    padding-right: 0;
  }

  .cart-summary {
    width: 100%;
    position: relative;
    top: 0;
    max-height: none;
    order: -1;
  }

  .cart-item {
    flex-direction: row;
    align-items: center;
  }
}

@media screen and (max-width: 640px) {
  .modal-header h2 {
    font-size: 1.2rem;
  }

  .modal-body {
    padding: 1rem;
  }

  .cart-item {
    flex-direction: column;
  }

  .cart-item-image {
    width: 70px;
    height: 100px;
  }

  .cart-item-actions {
    width: 100%;
    justify-content: space-between;
    margin-top: 0.8rem;
  }

  .shipping-input-group {
    flex-direction: column;
  }

  .cart-actions {
    flex-direction: column;
  }

  .quantity-control {
    margin-right: auto;
  }
}

@media screen and (max-width: 480px) {
  .modal-header {
    padding: 1rem;
  }

  .cart-summary {
    padding: 1rem;
  }

  .shipping-calculator {
    padding: 1rem;
  }

  .cart-item {
    padding: 1rem 0;
  }

  .cart-item-details {
    width: 100%;
  }

  .summary-row.total {
    font-size: 1.1rem;
  }
}
/* Estilos para o botão de finalizar compra */

#selectedAddressDisplay, #shippingMethodDisplay p {
  color: #2c2c2c;
}