/* Bros Pasta 2025 - Modern Modal & Cart Styles */

:root {
  --success-color: #2ecc71;
  --success-dark: #27ae60;
  --text-dark: #222;
  --text-medium: #666;
  --bg-light: #f8f9fa;
  --border-color: #eee;
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.12);
  --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ===== MODAL STYLES - Clean & Modern ===== */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(6px);
  display: none;
  opacity: 0;
  transition: opacity 0.3s ease;
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal.visible {
  opacity: 1;
  display: flex;
}

.modal-content {
  background: white;
  border-radius: 24px;
  padding: 32px;
  position: relative;
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  transform: scale(0.95) translateY(20px);
  opacity: 0;
  transition: all 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(0, 0, 0, 0.05);
  /* Smooth scrolling on mobile */
  -webkit-overflow-scrolling: touch;
}

.modal.visible .modal-content {
  transform: scale(1) translateY(0);
  opacity: 1;
}

.modal-header {
  margin-bottom: 28px;
  text-align: center;
  padding-bottom: 16px;
  border-bottom: 2px solid rgba(0, 0, 0, 0.06);
}

.modal-title {
  font-size: 1.85rem;
  font-weight: 700;
  color: var(--text-dark);
  letter-spacing: -0.5px;
}

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-dark);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-size: 0.85rem;
}

.form-group select,
.form-group input,
.form-group textarea {
  width: 100%;
  padding: 16px 18px;
  border: 2px solid #e8e8e8;
  border-radius: 14px;
  font-size: 16px; /* Prevents zoom on iOS */
  transition: var(--transition-smooth);
  background: #fafafa;
  font-family: inherit;
  -webkit-appearance: none;
  appearance: none;
  /* Better touch targets */
  min-height: 52px;
  touch-action: manipulation;
}

.form-group select:focus,
.form-group input:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--success-color);
  background: white;
  box-shadow: 0 0 0 4px rgba(46, 204, 113, 0.1);
  transform: scale(1.01);
}

/* Better select styling */
.form-group select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%23666' d='M1.41 0L6 4.59 10.59 0 12 1.41l-6 6-6-6z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 16px center;
  background-size: 12px;
  padding-right: 40px;
  cursor: pointer;
}

.form-group textarea {
  min-height: 100px;
  resize: vertical;
}

.extras-container {
  border: 2px solid #e8e8e8;
  border-radius: 12px;
  padding: 4px;
  background: #fafafa;
}

#extras-select {
  border: none;
  background: transparent;
  max-height: 200px;
  padding: 8px;
  font-size: 0.95rem;
}

#extras-select option {
  padding: 10px 12px;
  margin: 2px 0;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s ease;
}

#extras-select option:hover {
  background: rgba(46, 204, 113, 0.1);
}

#extras-select option:checked {
  background: linear-gradient(135deg, var(--success-color) 0%, var(--success-dark) 100%);
  color: white;
  font-weight: 600;
}

.button-group {
  display: flex;
  gap: 12px;
  margin-top: 24px;
}

.button-group button {
  flex: 1;
  padding: 16px;
  border: none;
  border-radius: 14px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-smooth);
  /* Better touch targets */
  min-height: 52px;
  touch-action: manipulation;
}

.button-group button:active {
  transform: scale(0.97);
}

#add-to-cart-btn,
#submit-checkout {
  background: linear-gradient(135deg, var(--success-color) 0%, var(--success-dark) 100%);
  color: white;
  box-shadow: 0 4px 12px rgba(46, 204, 113, 0.3);
}

#add-to-cart-btn:hover,
#submit-checkout:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(46, 204, 113, 0.4);
}

#cancel-btn,
#cancel-checkout {
  background: #f5f5f5;
  color: var(--text-medium);
}

#cancel-btn:hover,
#cancel-checkout:hover {
  background: #e8e8e8;
}

/* ===== MAP MODAL STYLES ===== */
.modal.hidden {
  display: none !important;
}

.map-modal-content {
  max-width: 600px;
}

.map-container {
  margin: 20px 0;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.map-link {
  color: var(--success-color);
  text-decoration: none;
  font-weight: 600;
  transition: var(--transition-smooth);
  border-bottom: 2px solid transparent;
}

.map-link:hover {
  color: var(--success-dark);
  border-bottom-color: var(--success-color);
}

.modal-button {
  background: linear-gradient(135deg, var(--success-color) 0%, var(--success-dark) 100%);
  color: white;
  border: none;
  padding: 12px 24px;
  border-radius: 10px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-smooth);
  box-shadow: 0 4px 12px rgba(46, 204, 113, 0.3);
  width: 100%;
  margin-top: 16px;
}

.modal-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(46, 204, 113, 0.4);
}

.close, .map-modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  font-size: 28px;
  font-weight: bold;
  color: var(--text-medium);
  cursor: pointer;
  transition: var(--transition-smooth);
  background: none;
  border: none;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  /* Better touch target */
  touch-action: manipulation;
  z-index: 10;
}

.close:hover, .map-modal-close:hover {
  color: var(--text-dark);
  background: rgba(0, 0, 0, 0.08);
  transform: rotate(90deg);
}

.close:active, .map-modal-close:active {
  transform: rotate(90deg) scale(0.9);
}

/* ===== FLOATING CART - Full Width Bottom Bar ===== */
#floating-cart {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  width: 100%;
  background: white;
  border-top: 2px solid var(--border-color);
  box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.1);
  z-index: 999;
  transition: var(--transition-smooth);
  opacity: 0;
  transform: translateY(100%);
  pointer-events: none;
}

#floating-cart:not(.cart-hidden) {
  opacity: 1;
  transform: translateY(0);
  pointer-events: all;
}

#floating-cart.expanded {
  box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.15);
}

#floating-cart-header {
  padding: 12px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  /* Light green background with good contrast */
  background: linear-gradient(135deg, rgba(46, 204, 113, 0.12) 0%, rgba(46, 204, 113, 0.08) 100%);
  min-height: 48px;
  border-bottom: 2px solid rgba(46, 204, 113, 0.2);
}

#floating-cart-items {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
}

#floating-cart.expanded #floating-cart-items {
  max-height: 60vh;
  overflow-y: auto;
}

#floating-cart-list {
  padding: 16px 20px;
  list-style: none;
}

#floating-cart-summary {
  font-weight: 600;
  font-size: 1rem;
  color: var(--text-dark);
  display: flex;
  align-items: center;
  gap: 8px;
}

#toggle-cart-btn {
  background: linear-gradient(135deg, var(--success-color) 0%, var(--success-dark) 100%);
  color: white;
  border: none;
  cursor: pointer;
  padding: 8px 16px;
  font-size: 0.9rem;
  font-weight: 600;
  transition: var(--transition-smooth);
  border-radius: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 2px 8px rgba(46, 204, 113, 0.3);
}

#toggle-cart-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(46, 204, 113, 0.4);
}

#toggle-cart-btn i {
  font-size: 1em;
}

.cart-footer {
  padding: 16px 20px;
  border-top: 2px solid var(--border-color);
  background: var(--bg-light);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

#floating-cart-total {
  font-weight: 700;
  font-size: 1.2rem;
  color: var(--text-dark);
  margin: 0;
  flex-shrink: 0;
}

#floating-checkout-btn {
  background: linear-gradient(135deg, var(--success-color) 0%, var(--success-dark) 100%);
  color: white;
  border: none;
  padding: 12px 32px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  transition: var(--transition-smooth);
  box-shadow: 0 4px 12px rgba(46, 204, 113, 0.3);
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

#floating-checkout-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(46, 204, 113, 0.4);
}

#floating-checkout-btn i {
  font-size: 1.1em;
}

/* Cart list item styles */
#floating-cart-list li {
  padding: 12px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

#floating-cart-list li:last-child {
  border-bottom: none;
}

.cart-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  gap: 12px;
}

.item-name {
  font-weight: 600;
  color: var(--text-dark);
  flex: 1;
}

.item-price {
  font-weight: 700;
  color: var(--success-color);
  white-space: nowrap;
}

.item-extras {
  font-size: 0.85rem;
  color: var(--text-medium);
  margin-top: 4px;
}

.remove-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px 8px;
  transition: var(--transition-smooth);
  border-radius: 6px;
  margin-left: 8px;
}

.remove-btn:hover {
  background: rgba(178, 34, 34, 0.1);
}

.remove-btn .fa-trash {
  color: #B22222;
  font-size: 0.9rem;
}

/* ===== MOBILE RESPONSIVENESS ===== */
@media (max-width: 768px) {
  #floating-cart-header {
    padding: 10px 16px;
    min-height: 44px;
  }

  #floating-cart-summary {
    font-size: 0.9rem;
  }

  #toggle-cart-btn {
    padding: 6px 12px;
    font-size: 0.85rem;
  }

  #floating-cart-list {
    padding: 12px 16px;
  }

  .cart-footer {
    padding: 12px 16px;
    flex-direction: column;
    align-items: stretch;
  }

  #floating-cart-total {
    font-size: 1.1rem;
    text-align: center;
    margin-bottom: 8px;
  }

  #floating-checkout-btn {
    width: 100%;
    justify-content: center;
    padding: 12px;
  }

  .modal-content {
    width: 95%;
    padding: 24px 20px;
    max-height: 92vh;
    border-radius: 20px;
  }

  .button-group {
    flex-direction: column;
    gap: 10px;
  }

  .button-group button {
    width: 100%;
    min-height: 48px;
  }
  
  .form-group {
    margin-bottom: 16px;
  }
  
  .form-group select,
  .form-group input,
  .form-group textarea {
    padding: 14px 16px;
    min-height: 48px;
    font-size: 16px; /* Prevent iOS zoom */
  }
  
  .modal-header {
    margin-bottom: 20px;
  }
  
  .modal-title {
    font-size: 1.5rem;
  }
}

/* Custom scrollbar for cart */
#floating-cart-items::-webkit-scrollbar {
  width: 8px;
}

#floating-cart-items::-webkit-scrollbar-track {
  background: var(--bg-light);
}

#floating-cart-items::-webkit-scrollbar-thumb {
  background: var(--text-medium);
  border-radius: 4px;
}

#floating-cart-items::-webkit-scrollbar-thumb:hover {
  background: var(--text-dark);
}
