/* ==================== MODAL BASE ==================== */

.modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(10px);
  z-index: 10000;
}

.modal.show {
  display: flex !important;
  justify-content: center;
  align-items: center;
  animation: modalFadeIn 0.3s ease;
}

@keyframes modalFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-content {
  background: #fff;
  width: 95%;
  max-width: 500px;
  border-radius: 24px;
  border: 2px solid #000;
  box-shadow: 8px 8px 0 rgba(0, 0, 0, 0.1);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  max-height: 90vh;
  position: relative;
}

.modal-content::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, #d4af37, #f3d77a, #d4af37);
  border-radius: 24px 24px 0 0;
}

/* ================= MODAL HEADER ================= */

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 2px solid #000;
}

.modal-header h3 {
  font-size: 1.5rem;
  font-weight: 800;
  margin: 0;
  font-family: 'Montserrat', sans-serif;
}

.modal-header h3 span {
  color: #d4af37;
}

.close-modal {
  background: #000;
  color: #fff;
  border: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  transition: all 0.2s;
}

.close-modal:hover {
  background: #d4af37;
  color: #000;
  transform: rotate(90deg);
}

/* ================= CART MODAL ================= */

.cart-items {
  flex: 1;
  overflow-y: auto;
  margin: 0.5rem 0;
  padding-right: 4px;
  max-height: 60vh;
  scrollbar-width: thin;
  scrollbar-color: #d4af37 #f0f0f0;
}

.cart-items::-webkit-scrollbar {
  width: 4px;
}

.cart-items::-webkit-scrollbar-track {
  background: #f0f0f0;
  border-radius: 4px;
}

.cart-items::-webkit-scrollbar-thumb {
  background: #d4af37;
  border-radius: 4px;
}

/* Empty Cart */
.empty-cart-message {
  text-align: center;
  padding: 2rem 1rem;
  color: #666;
}

.empty-cart-message i {
  font-size: 3rem;
  color: #d4af37;
  opacity: 0.5;
  margin-bottom: 0.5rem;
}

.empty-cart-message p {
  font-size: 1rem;
  margin: 0.25rem 0;
}

.empty-cart-message .shop-now-btn {
  background: #000;
  color: #fff;
  border: 2px solid #000;
  padding: 0.6rem 1.5rem;
  border-radius: 30px;
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  margin-top: 1rem;
  display: inline-block;
  text-decoration: none;
  transition: all 0.2s;
}

.empty-cart-message .shop-now-btn:hover {
  background: #d4af37;
  border-color: #d4af37;
  transform: translateY(-2px);
  box-shadow: 4px 4px 0 rgba(0,0,0,0.1);
}

/* Cart Item */
.cart-item {
  display: flex;
  gap: 1rem;
  padding: 0.75rem;
  border: 2px solid #000;
  border-radius: 16px;
  margin-bottom: 0.75rem;
  background: #fff;
  transition: all 0.2s;
}

.cart-item:last-child {
  margin-bottom: 0;
}

.cart-item:hover {
  border-color: #d4af37;
  transform: translateX(2px);
}

.cart-item-image {
  width: 70px;
  height: 70px;
  border-radius: 12px;
  background-size: cover;
  background-position: center;
  border: 2px solid #000;
  flex-shrink: 0;
  background-color: #f5f5f5;
}

.cart-item-details {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.cart-item-title {
  font-weight: 700;
  font-size: 0.95rem;
  margin: 0;
  font-family: 'Montserrat', sans-serif;
  line-height: 1.3;
}

.cart-item-price {
  font-weight: 800;
  font-size: 1rem;
  color: #d4af37;
  margin: 0;
}

.cart-item-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 0.25rem;
}

.quantity-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: #f5f5f5;
  padding: 0.2rem;
  border-radius: 20px;
  border: 2px solid #000;
}

.quantity-btn {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: none;
  background: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.9rem;
  box-shadow: 2px 2px 0 #000;
  transition: all 0.2s;
}

.quantity-btn:hover {
  background: #d4af37;
  transform: translateY(-1px);
  box-shadow: 3px 3px 0 #000;
}

.quantity-value {
  font-weight: 700;
  min-width: 20px;
  text-align: center;
  font-size: 0.9rem;
}

.remove-btn {
  border: none;
  background: transparent;
  color: #ff4444;
  cursor: pointer;
  padding: 4px;
  font-size: 0.9rem;
  transition: all 0.2s;
}

.remove-btn:hover {
  color: #fff;
  background: #ff4444;
  border-radius: 50%;
  transform: rotate(90deg);
}

/* Cart Footer */
.modal-footer {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 2px dashed #000;
}

.cart-total {
  display: flex;
  justify-content: space-between;
  font-weight: 800;
  font-size: 1.1rem;
  margin-bottom: 1rem;
  padding: 0.5rem 1rem;
  background: #fafafa;
  border-radius: 12px;
  border: 2px solid #000;
}

.cart-total span:last-child {
  color: #d4af37;
  font-size: 1.2rem;
}

.checkout-btn {
  width: 100%;
  padding: 0.8rem;
  border-radius: 40px;
  border: none;
  font-weight: 800;
  background: linear-gradient(135deg, #d4af37, #f3d77a);
  color: #000;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-size: 1rem;
  border: 2px solid #000;
  transition: all 0.2s;
}

.checkout-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 15px rgba(212, 175, 55, 0.3);
}

.checkout-btn i {
  font-size: 1rem;
}

.checkout-btn:hover i {
  transform: translateX(3px);
}

/* ================= PROFILE MODAL ================= */

.profile-wrapper {
  overflow-y: auto;
  max-height: 70vh;
  padding-right: 4px;
  scrollbar-width: thin;
  scrollbar-color: #d4af37 #f0f0f0;
}

.profile-wrapper::-webkit-scrollbar {
  width: 4px;
}

.profile-wrapper::-webkit-scrollbar-track {
  background: #f0f0f0;
  border-radius: 4px;
}

.profile-wrapper::-webkit-scrollbar-thumb {
  background: #d4af37;
  border-radius: 4px;
}

/* Login View */
.login-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 1.5rem 0.5rem;
}

.login-icon {
  width: 60px;
  height: 60px;
  background: #000;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1rem;
  border: 3px solid #d4af37;
}

.login-icon i {
  font-size: 2rem;
  color: #fff;
}

.login-title {
  font-size: 1.6rem;
  font-weight: 800;
  margin: 0 0 0.25rem;
  font-family: 'Montserrat', sans-serif;
}

.login-title span {
  color: #d4af37;
}

.login-subtitle {
  font-size: 0.9rem;
  color: #666;
  margin-bottom: 1.5rem;
}

.google-login-btn {
  width: 100%;
  max-width: 280px;
  padding: 0.8rem 1.5rem;
  border-radius: 40px;
  border: 2px solid #000;
  background: #fff;
  color: #000;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.8rem;
  transition: all 0.2s;
}

.google-login-btn i {
  font-size: 1.1rem;
  color: #4285f4;
}

.google-login-btn:hover {
  background: #000;
  color: #fff;
  transform: translateY(-2px);
  box-shadow: 5px 5px 0 rgba(0,0,0,0.1);
}

.google-login-btn:hover i {
  color: #d4af37;
}

.login-terms {
  font-size: 0.7rem;
  color: #999;
  margin-top: 1rem;
  text-align: center;
}

/* Profile View */
.profile-card {
  padding: 0.5rem 0;
}

.profile-avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  overflow: hidden;
  border: 3px solid #d4af37;
  margin: 0 auto 1rem;
}

.profile-name {
  font-size: 1.4rem;
  font-weight: 800;
  margin: 0 0 0.25rem;
  text-align: center;
  font-family: 'Montserrat', sans-serif;
}

.profile-email {
  font-size: 0.9rem;
  color: #666;
  text-align: center;
  margin-bottom: 1.5rem;
  padding: 0.25rem 1rem;
  background: #f5f5f5;
  border-radius: 20px;
  display: inline-block;
  width: auto;
  margin-left: auto;
  margin-right: auto;
}

/* User Info */
.user-info {
  background: #fafafa;
  border: 2px solid #000;
  border-radius: 16px;
  padding: 1rem;
  margin-bottom: 1.5rem;
}

.user-info-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid #e0e0e0;
}

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

.user-info-item i {
  width: 20px;
  color: #d4af37;
  font-size: 1rem;
  text-align: center;
}

.user-info-item span {
  font-size: 0.9rem;
}

.user-info-item span:first-of-type {
  font-weight: 600;
  min-width: 80px;
  color: #000;
}

/* Logout Button */
.logout-btn {
  width: 100%;
  max-width: 240px;
  padding: 0.8rem;
  border-radius: 40px;
  border: 2px solid #ff4444;
  background: #fff;
  color: #ff4444;
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin: 0 auto;
  transition: all 0.2s;
}

.logout-btn:hover {
  background: #ff4444;
  color: #fff;
  transform: translateY(-2px);
  box-shadow: 5px 5px 0 rgba(255, 68, 68, 0.2);
}

.logout-btn i {
  font-size: 0.9rem;
}

/* Cart Icon Badge */
.cart-icon-wrapper {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  transition: all 0.2s;
}

.cart-count {
  position: absolute;
  top: -2px;
  right: -2px;
  background: #d4af37;
  color: #000;
  font-size: 0.6rem;
  font-weight: 800;
  min-width: 16px;
  height: 16px;
  padding: 0 3px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: 2px solid #fff;
}

/* ================= RESPONSIVE ================= */

@media (max-width: 768px) {
  .modal-content {
    padding: 1.25rem;
    max-width: 450px;
  }

  .modal-header h3 {
    font-size: 1.3rem;
  }

  .cart-item {
    padding: 0.6rem;
    gap: 0.75rem;
  }

  .cart-item-image {
    width: 60px;
    height: 60px;
  }

  .cart-item-title {
    font-size: 0.9rem;
  }

  .cart-total {
    font-size: 1rem;
    padding: 0.4rem 0.8rem;
  }

  .cart-total span:last-child {
    font-size: 1.1rem;
  }
}

@media (max-width: 480px) {
  .modal-content {
    padding: 1rem;
    max-width: 95%;
  }

  .cart-item {
    flex-direction: row;
    align-items: flex-start;
  }

  .cart-item-actions {
    flex-wrap: wrap;
    gap: 0.5rem;
  }

  .profile-avatar {
    width: 70px;
    height: 70px;
  }

  .profile-name {
    font-size: 1.2rem;
  }

  .user-info-item {
    flex-wrap: wrap;
    gap: 0.25rem;
  }

  .user-info-item span:first-of-type {
    min-width: 70px;
  }
}
