/**
 * Feuille de style : Mise en page GPX / PicToSpot
 * Plugin : 070_gpx_downloader
 * Description : Layout moderne, visuel + QR + upload + boutons
 * Auteur : Christophe Delire
 * Dernière mise à jour : 04/10/2025
 */

/* ===============================
   STRUCTURE DE BASE GPX / PICTOSPOT
   =============================== */
.gpx-layout.gpx-flat {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  padding: 2rem;
  border-radius: 12px;
  position: relative;
  background: #fff;
  margin-bottom: 10px;
}

.gpx-left {
  flex: 1 1 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.gpx-right {
  flex: 1 1 45%;
  padding-left: 2rem;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  height: 100%;
}

@media screen and (max-width: 768px) {
  .gpx-layout.gpx-flat {
    flex-direction: column;
    padding: 1rem;
  }
  .gpx-left, .gpx-right {
    flex: 1 1 100%;
    padding: 0;
  }
  .gpx-right {
    margin-top: 2rem;
    text-align: center;
  }
}

/* ===============================
   TITRES ET TEXTES
   =============================== */
.gpx-titre {
  font-size: 1.6rem;
  font-weight: 700;
  margin-bottom: 1rem;
  color: #000;
  text-align: center;
  border-bottom: 3px solid #ff6600;
  display: inline-block;
  padding-bottom: .3rem;
}

.gpx-desc {
  background: #f9f9f9;
  border-left: 4px solid #0073aa;
  padding: 12px 16px;
  margin: 1em 0;
  font-size: 15px;
  line-height: 1.5;
  color: #333;
  border-radius: 4px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.gpx-desc strong {
  color: #0073aa;
}

/* ===============================
   IMAGES ET THUMBNAILS
   =============================== */
.gpx-thumbnail {
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 3px 10px rgba(0,0,0,0.2);
  margin-bottom: 1rem;
}
.gpx-thumbnail img {
  width: 100%;
  border-radius: 12px;
}

/* QR overlay */
.gpx-thumbnail .qr-overlay {
  position: absolute;
  bottom: 5%;
  right: 5%;
  width: 35%;
  background: #fff;
  padding: 2%;
  border-radius: 6px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.25);
  transition: transform 0.2s ease;
}
.gpx-thumbnail .qr-overlay:hover {
  transform: scale(1.1);
}

/* ===============================
   CHALLENGE BOX
   =============================== */
.pictospot-challenge {
  width: 100%;
  margin: 1rem 0;
  padding: 1rem 1.2rem;
  border: 2px dashed #ff9800;
  border-radius: 12px;
  background: #fffaf2;
  text-align: center;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.pictospot-challenge h3 {
  color: #ff6600;
  font-size: 1.3rem;
  margin-top: 0;
}

.pictospot-challenge .challenge-text {
  font-size: 1rem;
  font-weight: 600;
  color: #333;
}

/* ===============================
   BOUTONS GÉNÉRAUX
   =============================== */
.gpx-btn,
.gpx-btn-mobile {
  display: block;
  width: 100%;
  text-align: center;
  padding: 14px;
  border-radius: 10px;
  font-size: 1.05rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.3s, transform 0.2s;
  box-sizing: border-box;
}

.gpx-btn-primary,
.gpx-btn-mobile {
  background: #ff6600;
  color: #fff !important;
  border: none;
  box-shadow: 0 3px 10px rgba(255,102,0,0.3);
}
.gpx-btn-primary:hover,
.gpx-btn-mobile:hover {
  background: #e05500;
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(255,102,0,0.4);
}

.gpx-btn-tertiary {
  display: inline-block;
  padding: 6px 12px;
  background: #eee;
  color: #333;
  border-radius: 6px;
  text-decoration: none;
  transition: background 0.2s;
}
.gpx-btn-tertiary:hover {
  background: #ddd;
}

/* ===============================
   UPLOAD PHOTO
   =============================== */
.stcd-file-upload {
  text-align: center;
  margin: 1.5rem auto;
}
.stcd-file-label {
  display: block;
  width: 100%;
  background: #007bff;
  color: white;
  padding: 14px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 1.1rem;
  font-weight: 600;
  transition: background 0.3s;
}
.stcd-file-label:hover { background: #0056b3; }
.stcd-file-label.disabled {
  background: #ccc;
  color: #666;
  cursor: not-allowed;
}
#stcd-picto-file { display: none; }

.stcd-file-wrapper {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #f7f7f7;
  border: 1px solid #ddd;
  border-radius: 8px;
  padding: 10px 12px;
  margin-top: 10px;
}
.stcd-file-name {
  font-size: 0.95rem;
  color: #444;
  font-style: italic;
  word-wrap: break-word;
  text-align: left;
  flex: 1;
}
.stcd-file-remove {
  background: transparent;
  border: none;
  font-size: 1.2rem;
  color: #ff3b30;
  cursor: pointer;
  margin-left: 10px;
}

/* ===============================
   POPUP RELATIONS / MENU
   =============================== */
.gpx-popup {
  display: none;
  position: fixed;
  top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(0,0,0,0.6);
  z-index: 9999;
  align-items: center;
  justify-content: center;
}
.gpx-popup.visible { display: flex; }

.gpx-popup-content {
  background: #fff;
  border-radius: 10px;
  padding: 2em;
  max-width: 500px;
  width: 90%;
  box-shadow: 0 0 20px rgba(0,0,0,0.3);
  position: relative;
}
.gpx-popup-close {
  position: absolute;
  top: 10px; right: 10px;
  background: none;
  border: none;
  font-size: 1.5em;
  cursor: pointer;
}
.gpx-trail-popup-list {
  list-style: none;
  padding: 0;
  margin: 1em 0 0;
}
.gpx-trail-popup-list li { margin-bottom: .5em; }

/* ===============================
   ANIMATIONS
   =============================== */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes pulse {
  0%, 100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(255,0,0,0.4); }
  70% { transform: scale(1.5); box-shadow: 0 0 0 10px rgba(255,0,0,0); }
}

/* Loader / marker */
.pulse-marker {
  width: 20px;
  height: 20px;
  background: red;
  border-radius: 50%;
  animation: pulse 1s infinite;
}

/* ===============================
   MESSAGE DE RÉPONSE UPLOAD
   =============================== */
#stcd-picto-loader,
#stcd-picto-thanks {
  margin-top: 1.5rem;
  text-align: center;
  font-size: 1.1rem;
  font-weight: 500;
}

#stcd-picto-loader p {
  color: #ff9800;
  animation: blink 1.2s infinite;
}
#stcd-picto-thanks p {
  color: #2e7d32;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}
/* ========================================
   STYLE SPÉCIFIQUE : GPX TEMPLATE HURLUS
   ======================================== */
#gpx-template-hurlus {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  overflow: hidden;
  margin: 2rem auto;
  padding: 2rem;
  position: relative;
  font-family: "Segoe UI", Roboto, sans-serif;
}

/* Partie gauche = image + titre */
#gpx-template-hurlus .gpx-left {
  flex: 1 1 45%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  text-align: center;
}

#gpx-template-hurlus .gpx-titre {
  font-size: 1.6rem;
  font-weight: 700;
  margin-bottom: 1.2rem;
  color: #111;
}

#gpx-template-hurlus .gpx-thumbnail {
  position: relative;
  width: 100%;
  max-width: 500px;
}

#gpx-template-hurlus .gpx-thumbnail img {
  width: 100%;
  height: auto;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

#gpx-template-hurlus .gpx-badge-gpx {
  position: absolute;
  top: 10px;
  right: 10px;
  background: #ff6600;
  color: #fff;
  font-weight: bold;
  font-size: 0.8rem;
  padding: 4px 8px;
  border-radius: 6px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

/* Partie droite = boutons + texte */
#gpx-template-hurlus .gpx-right {
  flex: 1 1 50%;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding-left: 2rem;
}

#gpx-template-hurlus .gpx-trace-description {
  font-size: 1rem;
  line-height: 1.6;
  background: #fffaf2;
  border-left: 4px solid #ffb300;
  padding: 1rem 1.2rem;
  border-radius: 6px;
  color: #333;
  margin-bottom: 1.5rem;
}

/* Bloc de boutons */
#gpx-template-hurlus .gpx-block {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

#gpx-template-hurlus .gpx-row {
  display: flex;
  justify-content: center;
  align-items: center;
}

/* Boutons stylisés */
#gpx-template-hurlus .gpx-btn {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;

  width: 100%;
  height: 100px;
  border-radius: 12px;
  background: linear-gradient(135deg, #ff6600, #ff7b2f);
  font-size: 1rem;
  font-weight: bold;
  color: #fff;
  text-align: center;
  line-height: 1.2;
  border: none;
  text-decoration: none;
  box-shadow: 0 3px 8px rgba(0,0,0,0.2);
  transition: transform 0.2s ease, background 0.2s ease;
}

#gpx-template-hurlus .gpx-btn:hover {
  transform: translateY(-2px);
  background: linear-gradient(135deg, #e05500, #ff6600);
}

/* Icône au-dessus du texte */
#gpx-template-hurlus .gpx-btn::before {
  content: attr(data-icon);
  font-size: 1.8rem;
  margin-bottom: .4rem;
}

/* Section FAQ */
#gpx-template-hurlus .gpx-faq {
  margin-top: 1.5rem;
}
#gpx-template-hurlus .gpx-faq details {
  background: #f9f9f9;
  border: 1px solid #ddd;
  border-radius: 6px;
  padding: .8rem 1rem;
}
#gpx-template-hurlus .gpx-faq summary {
  font-weight: 600;
  cursor: pointer;
}
#gpx-template-hurlus .gpx-faq summary:hover {
  color: #ff6600;
}

/* Responsive */
@media (max-width: 900px) {
  #gpx-template-hurlus {
    flex-direction: column;
    padding: 1.2rem;
  }
  #gpx-template-hurlus .gpx-right {
    padding-left: 0;
    margin-top: 1.5rem;
  }
  #gpx-template-hurlus .gpx-block {
    grid-template-columns: 1fr;
  }
}
/* ================================
   GALERIE PICPIC – STYLE MODERNE
   ================================ */

/* Conteneur global */
.stcd-picpic-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 16px;
  margin: 2rem auto;
  max-width: 1000px;
  padding: 0 1rem;
}

/* Chaque image */
.stcd-picpic-item {
  position: relative;
  overflow: hidden;
  border-radius: 12px;
  background: #fafafa;
  box-shadow: 0 4px 10px rgba(0,0,0,0.1);
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.stcd-picpic-item img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  border-radius: 12px;
  transition: transform 0.35s ease;
}

/* Effet au survol */
.stcd-picpic-item:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 18px rgba(0,0,0,0.15);
}
.stcd-picpic-item:hover img {
  transform: scale(1.08);
}

/* Zoom icon (facultatif) */
.stcd-picpic-item::after {
  content: "🔍";
  position: absolute;
  bottom: 8px;
  right: 10px;
  font-size: 1.3rem;
  opacity: 0;
  transition: opacity 0.25s ease;
}
.stcd-picpic-item:hover::after {
  opacity: 0.9;
}

/* Galerie vide */
.stcd-picpic-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f0f0f0;
  color: #aaa;
  font-size: 2rem;
  border-radius: 12px;
  min-height: 150px;
}

/* Mode style-1 : coins arrondis et fond clair */
.stcd-picpic-gallery.style-1 .stcd-picpic-item {
  background: #fff;
  border: 1px solid #eee;
}

/* Bouton retour */
.stcd-picpic-return {
  margin: 2rem auto;
  text-align: center;
}

.stcd-picpic-return .gpx-btn-secondary {
  display: inline-block;
  background: linear-gradient(135deg, #f4f4f4, #e8e8e8);
  color: #333 !important;
  font-weight: 600;
  padding: 12px 20px;
  border-radius: 8px;
  text-decoration: none;
  border: 2px solid #ccc;
  box-shadow: 0 3px 6px rgba(0,0,0,0.1);
  transition: background 0.2s ease, transform 0.2s ease;
}
.stcd-picpic-return .gpx-btn-secondary:hover {
  background: linear-gradient(135deg, #0073aa, #0099dd);
  color: #fff !important;
  transform: translateY(-2px);
}

/* Lightbox (optionnelle, pour .stcd-picpic-lightbox future) */
.stcd-lightbox-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.85);
  justify-content: center;
  align-items: center;
  z-index: 9999;
}
.stcd-lightbox-overlay.visible {
  display: flex;
}
.stcd-lightbox-overlay img {
  max-width: 90vw;
  max-height: 85vh;
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.4);
}
.stcd-lightbox-close {
  position: absolute;
  top: 20px;
  right: 30px;
  color: #fff;
  font-size: 2rem;
  background: none;
  border: none;
  cursor: pointer;
  transition: opacity 0.2s ease;
}
.stcd-lightbox-close:hover {
  opacity: 0.7;
}

/* Responsive */
@media (max-width: 600px) {
  .stcd-picpic-gallery {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 10px;
  }
}
/* === Pictospot Modal (création via carte) === */
.pictospot-modal {
  display: none; /* caché par défaut */
  position: fixed;
  top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(0,0,0,0.65);
  z-index: 99999;
  justify-content: center;
  align-items: center;
  animation: fadeIn 0.3s ease;
}

.pictospot-modal.visible {
  display: flex;
}

.pictospot-modal-content {
  background: #fff;
  padding: 25px 30px;
  border-radius: 10px;
  max-width: 600px;
  width: 95%;
  box-shadow: 0 8px 30px rgba(0,0,0,0.3);
  position: relative;
  animation: slideUp 0.35s ease;
}

.pictospot-modal-close {
  background: none;
  border: none;
  font-size: 22px;
  color: #666;
  cursor: pointer;
  position: absolute;
  top: 12px; right: 15px;
  transition: color 0.2s ease;
}

.pictospot-modal-close:hover {
  color: #000;
}

/* === Formulaire === */
.pictospot-form label {
  font-weight: 600;
  margin-bottom: 4px;
  display: block;
  color: #333;
}

.pictospot-form input[type="text"],
.pictospot-form textarea,
.pictospot-form input[type="file"] {
  width: 100%;
  border: 1px solid #ccc;
  border-radius: 6px;
  padding: 8px 10px;
  margin-bottom: 15px;
  font-size: 14px;
  transition: border 0.2s ease, box-shadow 0.2s ease;
}

.pictospot-form input[type="text"]:focus,
.pictospot-form textarea:focus,
.pictospot-form input[type="file"]:focus {
  border-color: #0073aa;
  box-shadow: 0 0 4px rgba(0,115,170,0.3);
  outline: none;
}

/* Bouton principal */
.pictospot-form button[type="submit"] {
  background: #0073aa;
  color: #fff;
  font-weight: 600;
  border: none;
  border-radius: 6px;
  padding: 10px 18px;
  cursor: pointer;
  transition: background 0.2s ease;
}

.pictospot-form button[type="submit"]:hover {
  background: #005f8d;
}

/* Feedback / loader */
.pictospot-feedback {
  margin-top: 10px;
  font-size: 14px;
  font-weight: bold;
  color: #0073aa;
}

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

@keyframes slideUp {
  from { transform: translateY(30px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}
/* === Bouton de fermeture Pictospot (croix en haut à droite) === */
.pictospot-overlay-container {
  position: relative;
  display: inline-block;
  max-width: 100%;
}

.pictospot-close-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(0,0,0,0.6);
  color: #fff;
  border: none;
  border-radius: 50%;
  width: 26px;
  height: 26px;
  line-height: 24px;
  font-size: 16px;
  cursor: pointer;
  text-align: center;
  z-index: 10;
  transition: background 0.2s ease-in-out;
}
.pictospot-close-btn:hover {
  background: rgba(0,0,0,0.8);
}

/* === QR Code sous l’image principale === */
.gpx-popup-images img[alt*="QR Code"] {
  display: block;
  margin: 15px auto 0;
  max-width: 180px;
  height: auto;
  border-radius: 8px;
  box-shadow: 0 0 6px rgba(0,0,0,0.2);
}

/* === Ajustement responsive === */
@media (max-width: 600px) {
  .gpx-popup-images img[alt*="QR Code"] {
    max-width: 140px;
    margin-top: 10px;
  }
  .pictospot-close-btn {
    top: 4px;
    right: 4px;
    width: 22px;
    height: 22px;
    font-size: 14px;
    line-height: 20px;
  }
}
/* ============================================
   🎯 Ajustement complet du popup PicToSpot
   ============================================ */
.gpx-popup-images {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.pictospot-overlay-container {
  position: relative;
  display: inline-block;
  width: 100%;
  max-width: 500px;
}

.pictospot-base {
  width: 100%;
  height: auto;
  border-radius: 10px;
  display: block;
}

/* Logo PicToSpot en haut à droite */
.pictospot-logo {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 100% !important;
  height: auto;
  z-index: 3;
}

/* Overlay SCAN ME centré sur l’image */
.pictospot-overlay {
  position: absolute;
  bottom: 15px;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  height: auto;
  z-index: 2;
  pointer-events: none;
}

/* QR Code sous l’image, même largeur */
.gpx-popup-images img[alt*="QR Code"] {
  display: block;
  width: 100%;
  max-width: 500px;
  height: auto;
  margin-top: 12px;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.25);
}

/* Popup centré proprement */
.gpx-popup-content {
  background: #fff;
  border-radius: 10px;
  padding: 1.5em;
  max-width: 520px;
  width: 95%;
  box-shadow: 0 0 20px rgba(0,0,0,0.3);
  position: relative;
}

.gpx-popup-close {
  position: absolute;
  top: 8px;
  right: 10px;
  font-size: 1.6em;
  background: none;
  border: none;
  cursor: pointer;
  color: #000;
  z-index: 5;
}

/* Bouton capture */
.gpx-btn-capture {
  margin-top: 1em;
  font-size: 1rem;
}

/* Responsive */
@media (max-width: 600px) {
  .pictospot-logo {
    width: 50px;
    top: 8px;
    right: 8px;
  }
  .pictospot-overlay {
    width: 90px;
    bottom: 10px;
  }
  .gpx-popup-images img[alt*="QR Code"] {
    max-width: 90%;
  }
}