/* === EDIT TRIP PAGE === */
.edit-trip-page {
  max-width: 1200px;
  margin: 40px auto;
  padding: 40px;
  background: white;
  border-radius: 20px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.08);
}

.edit-trip-page h2 {
  font-size: 2.2rem;
  font-weight: 800;
  color: #1a1a1a;
  margin-bottom: 40px;
  text-align: center;
  letter-spacing: -0.02em;
}

/* === FORM ELEMENTS === */
.edit-trip-page label {
  display: block;
  font-weight: 600;
  color: #333;
  margin-bottom: 8px;
  margin-top: 20px;
  font-size: 0.95rem;
}

.edit-trip-page input[type="text"],
.edit-trip-page input[type="number"],
.edit-trip-page textarea,
.edit-trip-page select {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid #e9ecef;
  border-radius: 12px;
  font-size: 1rem;
  box-sizing: border-box;
  transition: all 0.3s ease;
  background: #f8f9fa;
}

.edit-trip-page input[type="text"]:focus,
.edit-trip-page input[type="number"]:focus,
.edit-trip-page textarea:focus,
.edit-trip-page select:focus {
  outline: none;
  border-color: #FF6B35;
  background: white;
  box-shadow: 0 0 0 4px rgba(255, 107, 53, 0.1);
}

.edit-trip-page textarea {
  resize: vertical;
  min-height: 120px;
  font-family: inherit;
  line-height: 1.6;
}

.edit-trip-page input[type="file"] {
  width: 100%;
  padding: 12px;
  border: 2px dashed #dee2e6;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.3s ease;
  background: #f8f9fa;
}

.edit-trip-page input[type="file"]:hover {
  border-color: #FF6B35;
  background: rgba(255, 107, 53, 0.05);
}

/* === BUTTONS === */
.edit-trip-page .btn {
  background: linear-gradient(135deg, #FF6B35 0%, #ff8c61 100%);
  color: white;
  font-weight: 700;
  padding: 14px 32px;
  border-radius: 12px;
  border: none;
  cursor: pointer;
  transition: all 0.3s ease;
  font-size: 1rem;
  box-shadow: 0 4px 15px rgba(255, 107, 53, 0.3);
}

.edit-trip-page .btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 25px rgba(255, 107, 53, 0.4);
}

.edit-trip-page .btn:active {
  transform: translateY(0);
}

.btn-delete {
  background: linear-gradient(135deg, #dc3545 0%, #c82333 100%);
  color: white;
  font-weight: 700;
  padding: 14px 32px;
  border-radius: 12px;
  border: none;
  cursor: pointer;
  margin-left: 10px;
  transition: all 0.3s ease;
  font-size: 1rem;
  box-shadow: 0 4px 15px rgba(220, 53, 69, 0.3);
}

.btn-delete:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 25px rgba(220, 53, 69, 0.4);
}

.btn-delete:active {
  transform: translateY(0);
}

/* === GPX SECTION === */
#gpx-section {
  margin: 30px 0;
  padding: 20px;
  background: #f8f9fa;
  border-radius: 12px;
  border-left: 4px solid #FF6B35;
}

#gpx-section p {
  margin: 0 0 10px 0;
  color: #333;
}

#gpx-section a {
  color: #FF6B35;
  text-decoration: none;
  font-weight: 600;
}

#gpx-section a:hover {
  text-decoration: underline;
}

.delete-gpx-btn {
  background: #dc3545;
  color: white;
  font-weight: 600;
  padding: 8px 16px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  margin-top: 10px;
  transition: all 0.3s ease;
}

.delete-gpx-btn:hover {
  background: #c82333;
  transform: translateY(-2px);
}

/* === IMAGE SECTION === */
#image-section {
  margin: 40px 0;
}

/* Header immagini con pulsante elimina tutto */
.images-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding: 20px 0 15px;
  border-bottom: 3px solid #e9ecef;
}

.images-header p {
  margin: 0;
  font-size: 1.3rem;
  font-weight: 700;
  color: #1a1a1a;
}

.btn-delete-all-images {
  background: #dc3545;
  color: white;
  border: none;
  padding: 12px 24px;
  border-radius: 10px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.3s ease;
  font-size: 0.95rem;
  box-shadow: 0 4px 12px rgba(220, 53, 69, 0.2);
}

.btn-delete-all-images:hover {
  background: #c82333;
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(220, 53, 69, 0.3);
}

.btn-delete-all-images:active {
  transform: translateY(0);
}

/* Cover hint */
.cover-hint {
  color: #6c757d;
  font-size: 0.9rem;
  font-style: italic;
  margin-bottom: 20px;
  padding: 12px 16px;
  background: rgba(255, 107, 53, 0.05);
  border-left: 3px solid #FF6B35;
  border-radius: 8px;
}

/* === IMAGE GALLERY === */
.image-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 20px;
  margin-bottom: 30px;
}

.image-thumb {
  position: relative;
  width: 100%;
  padding-top: 75%;
  /* Proporzione 4:3 */
  overflow: hidden;
  border: 3px solid #e9ecef;
  border-radius: 12px;
  transition: all 0.3s ease;
  cursor: pointer;
  background: #f8f9fa;
}

.image-thumb:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.12);
  border-color: #dee2e6;
}

.image-thumb.is-cover {
  border-color: #FF6B35;
  box-shadow: 0 0 0 3px rgba(255, 107, 53, 0.2);
}

.image-thumb.is-cover:hover {
  box-shadow: 0 8px 25px rgba(255, 107, 53, 0.3);
}

.image-thumb img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Delete button su immagine singola */
.image-thumb .delete-image-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(220, 53, 69, 0.95);
  color: white;
  border: none;
  border-radius: 50%;
  width: 32px;
  height: 32px;
  cursor: pointer;
  font-weight: bold;
  font-size: 1.3rem;
  line-height: 32px;
  text-align: center;
  transition: all 0.3s ease;
  z-index: 3;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.image-thumb .delete-image-btn:hover {
  background: rgba(220, 53, 69, 1);
  transform: scale(1.1);
}

/* === COVER IMAGE SELECTION === */
/* Nascondi il radio button reale */
.cover-radio {
  position: absolute;
  left: -9999px;
  opacity: 0;
}

/* Label cliccabile per la copertina */
.cover-label {
  position: absolute;
  top: 8px;
  left: 8px;
  cursor: pointer;
  z-index: 2;
}

.cover-badge {
  display: inline-block;
  background: rgba(255, 107, 53, 0.95);
  color: white;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 700;
  opacity: 0;
  transition: all 0.3s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Mostra badge in hover o quando selezionato */
.image-thumb:hover .cover-badge {
  opacity: 0.9;
}

.image-thumb.is-cover .cover-badge,
.cover-radio:checked+.cover-label .cover-badge {
  opacity: 1;
  background: #FF6B35;
}

/* === FORM ACTIONS === */
.form-actions {
  display: flex;
  gap: 15px;
  margin-top: 40px;
  padding-top: 30px;
  border-top: 2px solid #e9ecef;
  justify-content: flex-end;
}

/* === RESPONSIVE === */
@media (max-width: 1024px) {
  .edit-trip-page {
    padding: 30px;
  }

  .image-grid {
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 15px;
  }
}

@media (max-width: 768px) {
  .edit-trip-page {
    margin: 20px;
    padding: 25px 20px;
    border-radius: 16px;
  }

  .edit-trip-page h2 {
    font-size: 1.8rem;
    margin-bottom: 30px;
  }

  .images-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 15px;
  }

  .btn-delete-all-images {
    width: 100%;
  }

  .image-grid {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 12px;
  }

  .form-actions {
    flex-direction: column;
  }

  .btn-delete {
    margin-left: 0;
    width: 100%;
  }
}

@media (max-width: 480px) {
  .edit-trip-page {
    margin: 10px;
    padding: 20px 15px;
  }

  .edit-trip-page h2 {
    font-size: 1.5rem;
  }

  .image-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* === LOADING STATE === */
.edit-trip-page form.loading {
  opacity: 0.6;
  pointer-events: none;
}

.edit-trip-page form.loading::after {
  content: 'Caricamento...';
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(0, 0, 0, 0.8);
  color: white;
  padding: 20px 40px;
  border-radius: 12px;
  font-weight: 600;
  z-index: 9999;
}

.help-text {
  font-size: 0.85rem;
  color: #6c757d;
  font-style: italic;
  margin: 8px 0 0 0;
  padding: 8px 12px;
  background: rgba(255, 107, 53, 0.05);
  border-left: 3px solid #FF6B35;
  border-radius: 4px;
}