/* Stand Map Plugin Styles */

/* Container principale */
.stand-map-container {
  display: flex;
  width: 100%;
  height: 600px;
  border: 1px solid #ddd;
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

/* Sidebar sinistra */
.stand-map-sidebar {
  width: 350px;
  min-width: 350px;
  flex-shrink: 0;
  height: 100%;
  overflow-y: auto;
  border-right: 1px solid #ddd;
  background: #fafafa;
}

/* Placeholder quando nessun luogo selezionato */
.sidebar-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  padding: 30px;
  text-align: center;
  color: #666;
}

.sidebar-placeholder .placeholder-icon {
  font-size: 48px;
  margin-bottom: 15px;
  opacity: 0.5;
}

.sidebar-placeholder p {
  margin: 5px 0;
  font-size: 14px;
}

.placeholder-icon img {
  width: 150px;
  height: 150px;
}

/* Contenuto sidebar */
.sidebar-content {
  padding: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  height: 100%;
}

/* Immagine luogo */
.place-image-container {
  width: 100%;
  height: 200px;
  background: #eee;
  overflow: hidden;
}

.place-image-container img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.place-name {
  margin: 20px 20px 10px;
  font-size: 22px;
  font-weight: 600;
  color: #03d8db;
}

.place-address {
  margin: 0 20px 15px;
  font-size: 14px;
  color: #000080;
}

.place-address:before {
  content: "\1F4CD ";
}

.place-address:empty {
  display: none;
}

.place-description {
  margin: 0 20px 20px;
  font-size: 14px;
  line-height: 1.6;
  color: #000080;
}

/* Azioni sidebar (admin) */
.sidebar-actions {
  display: flex;
  gap: 10px;
  padding: 15px 20px;
  margin-top: auto;
}

.btn-edit {
  flex: 1;
  padding: 10px;
  background: #000080;
  color: #fff;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  transition: background 0.2s;
}

.btn-edit:hover {
  background: #0000b3;
}

.btn-delete {
  flex: 1;
  padding: 10px;
  background: #dc3545;
  color: #fff;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  transition: background 0.2s;
}

.btn-delete:hover {
  background: #c82333;
}

/* Wrapper mappa */
.stand-map-wrapper {
  flex: 1;
  min-width: 0;
  height: 100%;
  position: relative;
}

#stand-map {
  width: 100%;
  height: 100%;
}

/* Bottone aggiungi luogo */
.btn-add-place {
  position: absolute;
  top: 15px;
  right: 15px;
  z-index: 1000;
  width: 44px;
  height: 44px;
  background: #000080;
  color: #fff;
  border: none;
  border-radius: 50%;
  font-size: 28px;
  font-weight: 300;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-add-place:hover {
  background: #000080;
  transform: scale(1.1);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

/* Autocompletamento indirizzo */
.address-autocomplete-wrapper {
  position: relative;
}

.address-suggestions {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: #fff;
  border: 1px solid #ddd;
  border-top: none;
  border-radius: 0 0 4px 4px;
  max-height: 200px;
  overflow-y: auto;
  z-index: 100;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.suggestion-item {
  padding: 10px 12px;
  cursor: pointer;
  font-size: 13px;
  border-bottom: 1px solid #eee;
  transition: background 0.15s;
}

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

.suggestion-item:hover {
  background: #f0f7ff;
}

/* Modal */
.stand-map-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 10000;
}

.stand-map-modal.active {
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
}

.modal-content {
  position: relative;
  width: 90%;
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
  background: #fff;
  border-radius: 8px;
  padding: 30px;
  box-shadow: 0 5px 30px rgba(0, 0, 0, 0.3);
}

.modal-close {
  position: absolute;
  top: 15px;
  right: 15px;
  width: 30px;
  height: 30px;
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: #666;
  line-height: 1;
}

.modal-close:hover {
  color: #333;
}

.modal-content h2 {
  margin: 0 0 25px;
  font-size: 20px;
  color: #333;
}

/* Form */
.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  margin-bottom: 5px;
  font-weight: 500;
  color: #333;
  font-size: 14px;
}

.form-group input[type="text"],
.form-group textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 14px;
  transition: border-color 0.2s;
  box-sizing: border-box;
}

.form-group input[type="text"]:focus,
.form-group textarea:focus {
  outline: none;
  border-color: #0073aa;
}

.form-group textarea {
  resize: vertical;
  min-height: 80px;
}

.form-group .hint {
  font-size: 12px;
  color: #999;
  margin-top: 5px;
}

/* Mini mappa nel form */
.mini-map-container {
  margin-top: 10px;
  border: 1px solid #ddd;
  border-radius: 6px;
  overflow: hidden;
}

#mini-map {
  width: 100%;
  height: 250px;
  z-index: 0;
}

/* Image upload */
.image-upload-area {
  border: 2px dashed #ddd;
  border-radius: 4px;
  padding: 20px;
  text-align: center;
}

#image-preview {
  position: relative;
  margin-bottom: 10px;
  display: inline-block;
}

#image-preview img {
  max-width: 100%;
  max-height: 150px;
  border-radius: 4px;
}

.btn-remove-image {
  position: absolute;
  top: 5px;
  right: 5px;
  width: 24px;
  height: 24px;
  background: rgba(0, 0, 0, 0.7);
  color: #fff;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
}

.btn-upload {
  padding: 8px 16px;
  background: #0073aa;
  color: #fff;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  transition: background 0.2s;
}

.btn-upload:hover {
  background: #005a87;
}

/* Form actions */
.form-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 25px;
  padding-top: 20px;
  border-top: 1px solid #eee;
}

.btn-cancel {
  padding: 10px 20px;
  background: #f5f5f5;
  color: #333;
  border: 1px solid #ddd;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  transition: background 0.2s;
}

.btn-cancel:hover {
  background: #eee;
}

.btn-submit {
  padding: 10px 20px;
  background: #28a745;
  color: #fff;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  transition: background 0.2s;
}

.btn-submit:hover {
  background: #218838;
}

/* Pin type selector */
.pin-type-selector {
  display: flex;
  gap: 15px;
}

.pin-type-option {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 10px 15px;
  border: 2px solid #ddd;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
  flex: 1;
  text-align: center;
}

.pin-type-option:hover {
  border-color: #999;
}

.pin-type-option.selected {
  border-color: #000080;
  background: #f0f0ff;
}

.pin-type-option input[type="radio"] {
  display: none;
}

.pin-type-icon {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.pin-type-icon img {
  max-width: 40px;
  max-height: 40px;
  object-fit: contain;
}

.pin-type-placeholder {
  width: 32px;
  height: 32px;
  background: #ddd;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  color: #666;
  font-size: 14px;
}

.pin-type-label {
  font-size: 12px;
  color: #555;
  font-weight: 500;
}

/* Custom map pin markers */
.custom-pin-marker {
  background: none !important;
  border: none !important;
}

.custom-pin-marker img {
  width: 36px !important  ;
  height: 36px !important;
  object-fit: contain !important;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3)) !important;
}

/* Leaflet marker fix */
.leaflet-marker-icon {
  cursor: pointer;
}

.leaflet-container {
  font-family: inherit;
}

/* Responsive */
@media (max-width: 768px) {
  .stand-map-container {
    flex-direction: column;
    height: auto;
  }

  .stand-map-sidebar {
    width: 100%;
    min-width: 100%;
    height: auto;
    min-height: 200px;
    max-height: 300px;
    border-right: none;
    border-bottom: 1px solid #ddd;
    order: 2;
  }

  .stand-map-wrapper {
    width: 100%;
    height: 400px;
    flex: none;
    order: 1;
  }

  .modal-content {
    width: 95%;
    padding: 20px;
    max-height: 85vh;
  }

  .btn-add-place {
    top: 10px;
    right: 10px;
    width: 40px;
    height: 40px;
    font-size: 24px;
  }

  .pin-type-selector {
    gap: 10px;
  }

  .pin-type-option {
    padding: 8px 10px;
  }
}

@media (max-width: 480px) {
  .stand-map-container {
    border-radius: 4px;
  }

  .stand-map-wrapper {
    height: 300px;
  }

  .stand-map-sidebar {
    max-height: 250px;
  }

  .place-name {
    font-size: 18px;
    margin: 15px 15px 8px;
  }

  .place-address {
    margin: 0 15px 10px;
    font-size: 13px;
  }

  .place-description {
    margin: 0 15px 15px;
    font-size: 13px;
  }

  .place-image-container {
    height: 150px;
  }

  .modal-content {
    padding: 15px;
  }

  .modal-content h2 {
    font-size: 18px;
  }
}
