/* Cart Page Styles */

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px;
  margin-bottom: 20px;
}

.back-btn {
  color: var(--text-primary);
  text-decoration: none;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  transition: var(--transition);
}

.back-btn:hover {
  background-color: var(--bg-card);
}

.page-header h1 {
  font-size: 24px;
  margin: 0;
}

.cart-items {
  padding: 0 20px;
  margin-bottom: 24px;
}

.cart-item {
  background-color: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 16px;
  margin-bottom: 12px;
  display: flex;
  gap: 16px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1),
              0 0 10px rgba(255, 114, 105, 0.15),
              0 0 20px rgba(255, 114, 105, 0.08);
  border: 1px solid rgba(255, 114, 105, 0.1);
  transition: transform 0.2s, box-shadow 0.2s;
  animation: neonGlowCartItem 3s ease-in-out infinite alternate;
}

@media (max-width: 768px) {
  .cart-item {
    flex-direction: column;
    gap: 12px;
    padding: 12px;
  }
}

.cart-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15),
              0 0 20px rgba(255, 114, 105, 0.4),
              0 0 40px rgba(255, 114, 105, 0.3),
              0 0 60px rgba(255, 114, 105, 0.2);
  border-color: rgba(255, 114, 105, 0.4);
}

@keyframes neonGlowCartItem {
  from {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1),
                0 0 10px rgba(255, 114, 105, 0.15),
                0 0 20px rgba(255, 114, 105, 0.08);
  }
  to {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1),
                0 0 15px rgba(255, 114, 105, 0.25),
                0 0 30px rgba(255, 114, 105, 0.15);
  }
}

.cart-item-image {
  width: 80px;
  height: 80px;
  border-radius: var(--radius);
  overflow: hidden;
  flex-shrink: 0;
}

@media (max-width: 768px) {
  .cart-item-image {
    width: 100%;
    height: 180px;
    align-self: center;
  }
}

.cart-item-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.cart-item-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0; /* Prevents flex item from overflowing */
}

@media (max-width: 768px) {
  .cart-item-info {
    width: 100%;
    gap: 6px;
  }
  
  .cart-item-name {
    font-size: 15px;
  }
  
  .cart-item-price {
    font-size: 16px;
  }
}

.cart-item-name {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}

.cart-item-price {
  font-size: 14px;
  color: var(--accent-color);
  font-weight: 600;
}

.cart-item-controls {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
}

@media (max-width: 768px) {
  .cart-item-controls {
    gap: 10px;
  }
}

.quantity-control {
  display: flex;
  align-items: center;
  gap: 12px;
  background-color: var(--bg-input);
  border-radius: var(--radius);
  padding: 6px 12px;
  width: fit-content;
}

@media (max-width: 768px) {
  .quantity-control {
    width: 100%;
    justify-content: center;
    padding: 8px 12px;
  }
}

.quantity-btn {
  background: none;
  border: none;
  color: var(--text-primary);
  font-size: 20px;
  cursor: pointer;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: var(--transition);
}

.quantity-btn:hover {
  background-color: var(--bg-card);
}

.quantity-value {
  min-width: 30px;
  text-align: center;
  font-weight: 600;
  color: var(--text-primary);
}

.remove-btn {
  background: rgba(244, 67, 54, 0.1);
  border: 1px solid var(--error-color);
  color: var(--error-color);
  cursor: pointer;
  padding: 8px 12px;
  border-radius: var(--radius);
  transition: var(--transition);
  font-size: 12px;
  font-weight: 500;
}

@media (max-width: 768px) {
  .remove-btn {
    flex: 1;
    min-width: 0;
    padding: 10px 12px;
    font-size: 13px;
  }
  
  .cart-item-controls > div[style*="display: flex"] {
    flex-direction: row !important;
    gap: 8px !important;
  }
  
  .cart-item-controls .btn-secondary {
    flex: 1;
    min-width: 0;
    padding: 10px 12px;
    font-size: 13px;
  }
}

.remove-btn:hover {
  background-color: rgba(244, 67, 54, 0.2);
}

.delivery-section,
.payment-section {
  padding: 0 20px;
  margin-bottom: 24px;
}

.delivery-section h3,
.payment-section h3 {
  font-size: 18px;
  margin-bottom: 12px;
  color: var(--text-primary);
}

.address-card {
  background-color: var(--bg-card);
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 0 10px rgba(255, 114, 105, 0.15),
              0 0 20px rgba(255, 114, 105, 0.08);
  border: 1px solid rgba(255, 114, 105, 0.1);
  animation: neonGlowAddressCard 3s ease-in-out infinite alternate;
}

.address-card:hover {
  box-shadow: 0 0 15px rgba(255, 114, 105, 0.3),
              0 0 30px rgba(255, 114, 105, 0.2),
              0 0 45px rgba(255, 114, 105, 0.1);
  border-color: rgba(255, 114, 105, 0.3);
}

@keyframes neonGlowAddressCard {
  from {
    box-shadow: 0 0 10px rgba(255, 114, 105, 0.15),
                0 0 20px rgba(255, 114, 105, 0.08);
  }
  to {
    box-shadow: 0 0 15px rgba(255, 114, 105, 0.25),
                0 0 30px rgba(255, 114, 105, 0.15);
  }
}

@media (max-width: 768px) {
  .address-card {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
  
  .address-card p {
    width: 100%;
    margin-bottom: 0;
  }
  
  .address-card .btn {
    align-self: flex-end;
    width: auto;
  }
}

.address-card p {
  margin: 0;
  color: var(--text-primary);
  flex: 1;
  font-size: 14px;
  line-height: 1.5;
}

.address-card p:empty::before {
  content: "Endereço não cadastrado";
  color: var(--text-secondary);
  font-style: italic;
}

.btn-sm {
  padding: 8px 16px;
  font-size: 12px;
}

.payment-options {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.payment-option {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background-color: var(--bg-card);
  border-radius: var(--radius);
  cursor: pointer;
  transition: var(--transition);
}

.payment-option:hover {
  background-color: var(--bg-secondary);
}

.payment-option input[type="radio"] {
  width: 20px;
  height: 20px;
  accent-color: var(--accent-color);
  cursor: pointer;
}

.payment-option span {
  color: var(--text-primary);
  font-size: 14px;
}

.change-option {
  margin-top: 16px;
  padding: 16px;
  background-color: var(--bg-card);
  border-radius: var(--radius);
}

.change-option label {
  display: block;
  margin-bottom: 8px;
  color: var(--text-primary);
  font-size: 14px;
  font-weight: 500;
}

#changeDisplay {
  margin-top: 12px;
  padding: 12px;
  background-color: var(--bg-secondary);
  border-radius: var(--radius);
  border: 1px solid var(--border-color);
}

#changeValue {
  font-size: 18px;
  font-weight: 700;
}

.cart-summary {
  background-color: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin: 0 20px 24px;
}

.summary-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 12px;
  color: var(--text-secondary);
  font-size: 14px;
}

.summary-row.total {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border-color);
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
}

.btn-large {
  padding: 16px;
  font-size: 16px;
  margin: 0 20px 40px;
}

@media (max-width: 768px) {
  .btn-large {
    margin: 0 20px 100px; /* Extra space for bottom nav */
    padding: 14px;
    font-size: 15px;
  }
  
  .cart-summary {
    margin-bottom: 20px;
  }
  
  .delivery-section,
  .payment-section {
    margin-bottom: 20px;
  }
  
  .page-header {
    padding: 16px;
  }
  
  .page-header h1 {
    font-size: 20px;
  }
  
  .cart-items {
    padding: 0 16px;
  }
}

.empty-cart {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-secondary);
}

.empty-cart svg {
  width: 80px;
  height: 80px;
  margin-bottom: 20px;
  opacity: 0.5;
}

.empty-cart h3 {
  margin-bottom: 12px;
  color: var(--text-primary);
}

.empty-cart p {
  margin-bottom: 24px;
}

/* Spinner */
.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid var(--bg-card);
  border-top: 4px solid var(--accent-color);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 40px auto;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.cart-item-unit-price {
  font-size: 12px;
  color: var(--text-secondary);
  margin: 4px 0 0 0;
}

/* Address History */
#addressHistory {
  position: relative;
  z-index: 1;
}

#addressHistoryList {
  position: relative;
  z-index: 1;
}

.address-history-item {
  position: relative;
  z-index: 1;
}

/* Google Places Autocomplete dropdown styling */
.pac-container {
  z-index: 10002 !important;
  background-color: var(--bg-card) !important;
  border: 1px solid var(--border-color) !important;
  border-radius: var(--radius) !important;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3) !important;
  margin-top: 4px !important;
  position: fixed !important;
  max-width: 100% !important;
  max-height: 300px !important;
  overflow-y: auto !important;
}

.pac-container .pac-item {
  padding: 12px !important;
  cursor: pointer !important;
  border-top: 1px solid var(--border-color) !important;
  color: var(--text-primary) !important;
  background-color: var(--bg-card) !important;
  font-size: 14px !important;
  min-height: 44px !important;
  display: flex !important;
  align-items: center !important;
}

.pac-container .pac-item:first-child {
  border-top: none !important;
}

.pac-container .pac-item:hover,
.pac-container .pac-item:active {
  background-color: var(--bg-secondary) !important;
}

.pac-container .pac-item-selected {
  background-color: var(--bg-secondary) !important;
}

.pac-container .pac-item-query {
  color: var(--text-primary) !important;
  font-size: 14px !important;
}

.pac-container .pac-icon {
  margin-right: 8px !important;
  width: 15px !important;
  height: 20px !important;
}

.pac-container .pac-matched {
  font-weight: 600 !important;
  color: var(--accent-color) !important;
}

/* Mobile specific fixes */
@media (max-width: 768px) {
  .pac-container {
    z-index: 10002 !important;
    position: fixed !important;
    max-height: 250px !important;
    max-width: calc(100vw - 40px) !important;
  }
  
  .modal .pac-container {
    position: fixed !important;
    max-width: calc(100vw - 80px) !important;
    max-height: 200px !important;
  }
  
  .pac-container .pac-item {
    padding: 16px !important;
    min-height: 48px !important;
    font-size: 16px !important;
    -webkit-tap-highlight-color: rgba(0, 0, 0, 0.1) !important;
  }
}
