/* Shipping Option Modal (add-on) */
#shipModal {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
}
#shipModal.hidden {
  display: none;
}
#shipModal .modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
}
#shipModal .modal-card {
  position: relative;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.3);
  width: min(760px, 92vw);
  padding: 16px;
}
#shipModal .modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}
#shipModal .modal-header .title {
  font-weight: 800;
  font-size: 1.2rem;
}
#shipModal .icon-btn {
  background: #f3f4f6;
  border: none;
  border-radius: 10px;
  padding: 8px 10px;
  cursor: pointer;
}
#shipModal .modal-body {
  padding: 6px 2px;
  max-height: 60vh;
  overflow: auto;
}
#shipModal .modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 12px;
}
#shipModal .btn {
  border: none;
  border-radius: 12px;
  padding: 10px 16px;
  font-weight: 800;
  cursor: pointer;
}
#shipModal .btn.primary {
  background: linear-gradient(135deg, #2f7d32, #3aa63f);
  color: #fff;
  box-shadow: 0 10px 30px rgba(47, 125, 50, 0.12);
}
#shipModal .btn.secondary {
  background: linear-gradient(135deg, #1976d2, #42a5f5);
  color: #fff;
  box-shadow: 0 10px 30px rgba(25, 118, 210, 0.12);
}
#shipModal .btn.ghost {
  background: #fff;
  border: 1px solid #e5e7eb;
}
#shipModal .ship-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
#shipModal .ship-opt {
  border: 1px solid #e8efe3;
  border-radius: 12px;
  padding: 14px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  background: #fafdf8;
}
#shipModal .ship-opt .meta {
  color: #6b7280;
  font-size: .9rem;
  margin-top: 6px;
}
#shipModal .ship-opt .price {
  font-weight: 800;
}
#shipModal .ship-opt.selected {
  outline: 3px solid #facc15;
  background: #fffbe6;
}
#shipModal .ship-opt.unserviceable {
  opacity: 0.5;
  cursor: not-allowed;
}
#shipModal .ship-opt .check {
  font-size: 18px;
  color: #2f7d32;
  margin-left: 10px;
}

/* Enhanced Address Modal Styles */
.enhanced-address-modal {
  width: min(900px, 95vw);
  max-height: 90vh;
  display: flex;
  flex-direction: column;
}

.enhanced-address-modal .modal-header,
.enhanced-address-modal .modal-footer {
  padding: 10px 14px;
}

.enhanced-address-modal .modal-body {
  padding: 10px 14px;
  flex: 1 1 auto;
  max-height: unset;
  overflow-y: auto;
}

.form-section {
  margin-bottom: 18px;
  padding: 12px 14px 14px;
  background: #f8f9fa;
  border-radius: 8px;
  border: 1px solid #e9ecef;
}

.form-section h4 {
  margin: 0 0 12px 0;
  color: #2f7d32;
  font-size: 1.1rem;
  font-weight: 700;
}

.enhanced-address-modal .addr-row {
  display: flex;
  gap: 12px;
  margin-bottom: 10px;
}

.enhanced-address-modal .addr-row label {
  flex: 1;
  display: flex;
  flex-direction: column;
  font-weight: 600;
  color: #374151;
  font-size: 0.9rem;
  gap: 2px;
}

.enhanced-address-modal .addr-row label.checkbox-inline {
  flex-direction: row;
  align-items: center;
  gap: 8px;
  font-weight: 600;
}

.enhanced-address-modal .addr-row label.checkbox-inline input[type="checkbox"] {
  margin: 0;
  width: 16px;
  height: 16px;
}

.enhanced-address-modal .addr-row label br {
  display: none;
}

.enhanced-address-modal .addr-row label > div:first-child {
  margin-bottom: 0;
}

.enhanced-address-modal .addr-row input,
.enhanced-address-modal .addr-row select,
.enhanced-address-modal .addr-row textarea {
  margin-top: 2px;
  padding: 10px 12px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 0.95rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.enhanced-address-modal .addr-row input:focus,
.enhanced-address-modal .addr-row select:focus,
.enhanced-address-modal .addr-row textarea:focus {
  outline: none;
  border-color: #2f7d32;
  box-shadow: 0 0 0 3px rgba(47, 125, 50, 0.1);
}

.addr-row textarea {
  resize: vertical;
  min-height: 80px;
}

.error-messages {
  margin-top: 8px;
}

.error-msg {
  color: #dc2626;
  font-size: 0.85rem;
  margin-bottom: 4px;
  display: none;
}

.error-msg:not(:empty) {
  display: block;
}

.map-container {
  margin-top: 12px;
}

.map-controls {
  display: flex;
  gap: 12px;
  margin-top: 12px;
  align-items: center;
}

.map-search-input {
  flex: 1;
  padding: 10px 12px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 0.95rem;
}

.coordinates-display {
  margin-top: 8px;
  padding: 8px;
  background: #f3f4f6;
  border-radius: 4px;
  text-align: center;
}

.coordinates-display small {
  color: #6b7280;
}

/* Address list styles */
.addr-list {
  margin-bottom: 16px;
}

.addr-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 16px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  margin-bottom: 12px;
  cursor: pointer;
  transition: all 0.2s;
}

.addr-item:hover {
  border-color: #2f7d32;
  background: #f8fdf8;
}

.addr-item input[type="radio"] {
  margin-top: 4px;
}

.addr-meta {
  flex: 1;
}

.addr-meta .name {
  font-weight: 600;
  margin-bottom: 4px;
}

.addr-meta .full {
  color: #6b7280;
  margin-bottom: 4px;
  line-height: 1.4;
}

.addr-meta .phone {
  color: #6b7280;
  font-size: 0.9rem;
}

.default-tag {
  background: #2f7d32;
  color: white;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 0.75rem;
  margin-left: 8px;
}

.edit-btn {
  background: #f3f4f6;
  border: 1px solid #d1d5db;
  color: #374151;
  padding: 6px 12px;
  font-size: 0.85rem;
}

.edit-btn:hover {
  background: #e5e7eb;
}

.addr-add {
  width: 100%;
  padding: 12px;
  background: #fff;
  border: 2px dashed #d1d5db;
  border-radius: 8px;
  color: #2f7d32;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.addr-add:hover {
  border-color: #2f7d32;
  background: #f8fdf8;
}

.empty {
  text-align: center;
  color: #6b7280;
  padding: 24px;
  font-style: italic;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .enhanced-address-modal {
    width: 95vw;
    margin: 10px;
  }

  .enhanced-address-modal .addr-row {
    flex-direction: column;
    gap: 8px;
  }

  .map-controls {
    flex-direction: column;
    align-items: stretch;
  }

  .form-section {
    padding: 12px;
  }
}
