/* === GeoPhoto Editor - Premium Stylesheet === */

:root {
  /* Color Palette - Premium Theme */
  --bg-start: #0f172a;
  /* Deep Slate Base */
  --bg-end: #1e293b;
  /* Dark Slate Gradient End */
  --card-bg: rgba(30, 41, 59, 0.4);
  /* Glassmorphism Card Background */
  --card-blur: 24px;
  --text-main: #f8fafc;
  /* Crisp White Text */
  --text-muted: #94a3b8;
  /* Soft Gray Text */

  /* Vibrant Accents */
  --primary: #3b82f6;
  /* Bright Blue */
  --primary-hover: #60a5fa;
  /* Lighter Blue */
  --accent-gradient: linear-gradient(135deg, #3b82f6, #8b5cf6, #ec4899);
  /* Blue to Purple to Pink */

  /* Secondary Elements */
  --secondary: rgba(51, 65, 85, 0.6);
  --secondary-hover: rgba(71, 85, 105, 0.8);
  --secondary-text: #f1f5f9;

  /* Borders and State Colors */
  --border: rgba(148, 163, 184, 0.15);
  /* Subtle Borders */
  --border-focus: rgba(59, 130, 246, 0.5);
  --error-bg: rgba(153, 27, 27, 0.3);
  --error-text: #fca5a5;
  --error-border: rgba(220, 38, 38, 0.5);

  /* Shadows & Depth */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4), 0 2px 4px -2px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5), 0 4px 6px -4px rgba(0, 0, 0, 0.4);
  --shadow-glow: 0 0 20px rgba(59, 130, 246, 0.3);

  /* Radii */
  --radius-sm: 0.375rem;
  --radius-md: 0.75rem;
  --radius-lg: 1.25rem;
  --radius-xl: 2rem;

  /* Animations */
  --transition-fast: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-smooth: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Base Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background-color: var(--bg-start);
  background-image:
    radial-gradient(circle at 15% 50%, rgba(59, 130, 246, 0.12) 0%, transparent 40%),
    radial-gradient(circle at 85% 30%, rgba(139, 92, 246, 0.12) 0%, transparent 40%),
    linear-gradient(135deg, var(--bg-start), var(--bg-end));
  background-attachment: fixed;
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 3rem 1.5rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* Typography */
h1,
h2,
h3 {
  line-height: 1.2;
}

/* Layout Containers */
.container {
  width: 100%;
  max-width: 1100px;
  /* Slightly wider for better dual-panel layout */
  display: flex;
  flex-direction: column;
  gap: 2rem;
  position: relative;
  z-index: 10;
}

/* Header Section */
header {
  text-align: center;
  margin-bottom: 1rem;
  animation: fadeInDown 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  opacity: 0;
}

h1 {
  font-size: 3rem;
  font-weight: 800;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 0.75rem;
  letter-spacing: -0.03em;
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.2));
}

.subtitle {
  color: var(--text-muted);
  font-size: 1.2rem;
  font-weight: 400;
  max-width: 600px;
  margin: 0 auto;
}

/* Main Application Card (Glassmorphism) */
.main-card {
  background: var(--card-bg);
  backdrop-filter: blur(var(--card-blur));
  -webkit-backdrop-filter: blur(var(--card-blur));
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 2.5rem;
  box-shadow: var(--shadow-lg), inset 0 1px 0 rgba(255, 255, 255, 0.05);
  transition: var(--transition-smooth);
  animation: fadeInUp 0.8s cubic-bezier(0.16, 1, 0.3, 1) 0.2s forwards;
  opacity: 0;
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

/* Upload Area */
.upload-area {
  border: 2px dashed var(--border);
  border-radius: var(--radius-lg);
  padding: 4rem 2rem;
  text-align: center;
  cursor: pointer;
  transition: var(--transition-smooth);
  background: rgba(255, 255, 255, 0.015);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.25rem;
  position: relative;
  overflow: hidden;
}

/* Animated gradient border effect on hover */
.upload-area::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  border-radius: inherit;
  padding: 2px;
  background: var(--accent-gradient);
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  mask-composite: exclude;
  opacity: 0;
  transition: var(--transition-smooth);
  pointer-events: none;
}

.upload-area:hover,
.upload-area.dragover {
  border-color: transparent;
  /* Hide solid border */
  background: rgba(59, 130, 246, 0.03);
  transform: translateY(-2px);
  box-shadow: var(--shadow-glow);
}

.upload-area:hover::before,
.upload-area.dragover::before {
  opacity: 1;
  /* Show gradient border */
}

.upload-icon {
  width: 72px;
  height: 72px;
  background: rgba(59, 130, 246, 0.1);
  border: 1px solid rgba(59, 130, 246, 0.2);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary-hover);
  transition: var(--transition-smooth);
}

.upload-area:hover .upload-icon {
  transform: translateY(-8px) scale(1.05);
  background: rgba(59, 130, 246, 0.2);
  color: #fff;
  box-shadow: 0 10px 25px -5px rgba(59, 130, 246, 0.5);
}

.upload-text {
  font-size: 1.35rem;
  font-weight: 600;
  color: var(--text-main);
  letter-spacing: -0.01em;
}

.upload-subtext {
  color: var(--text-muted);
  font-size: 1rem;
}

/* Error Alerts */
.alert {
  padding: 1.25rem 1.5rem;
  border-radius: var(--radius-md);
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 1rem;
  animation: fadeIn 0.4s ease-out;
  backdrop-filter: blur(8px);
}

.alert.error {
  background: var(--error-bg);
  color: var(--error-text);
  border: 1px solid var(--error-border);
  box-shadow: 0 4px 12px rgba(220, 38, 38, 0.15);
}

/* Two-Column Content Layout (Updated to 2x2 Grid Rows) */
.content-grid {
  display: flex;
  flex-direction: column;
  gap: 2rem;
  animation: slideUpFade 0.7s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  opacity: 0;
}

.layout-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
  align-items: stretch;
}

@media (min-width: 900px) {
  .layout-row.row-top {
    grid-template-columns: 1fr 1fr;
  }

  .layout-row.row-bottom {
    grid-template-columns: 1.2fr 1fr;
    /* Make map slightly wider */
  }
}


/* Image Preview Section */
.image-wrapper {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.image-container {
  position: relative;
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-md);
  background: #000;
  aspect-ratio: 4/3;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  transition: var(--transition-smooth);
}

.image-container:hover {
  border-color: rgba(255, 255, 255, 0.2);
  box-shadow: var(--shadow-lg);
}

#preview {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  transition: opacity 0.3s ease;
  opacity: 0;
  /* Starts hidden, script changes to 1 */
}

.filename-edit {
  display: flex;
  align-items: center;
  background: rgba(15, 23, 42, 0.4);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  padding: 0 0.5rem;
  overflow: hidden;
}

.filename-edit input {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-main);
  font-size: 0.9rem;
  font-weight: 500;
  padding: 0.5rem;
  width: 100%;
}

.filename-edit input:focus {
  outline: none;
}

.filename-edit .extension {
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 500;
  padding-right: 0.5rem;
  user-select: none;
}

.image-container::after {
  /* Subtle inner shadow for image container */
  content: '';
  position: absolute;
  inset: 0;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.05);
  pointer-events: none;
  border-radius: inherit;
}


/* Coordinates & EXIF Control Panels */
.coords-card,
.exif-card {
  background: rgba(15, 23, 42, 0.6);
  /* Darker inner card */
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  border: 1px solid var(--border);
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.2);
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.section-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-main);
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.75rem;
  margin-bottom: 0.5rem;
}

.section-header h3 {
  font-size: 1rem;
  font-weight: 600;
  margin: 0;
}

.section-header svg {
  color: var(--primary);
}

.exif-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
}

.exif-item {
  display: flex;
  flex-direction: column;
}

.exif-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.25rem;
}

.exif-value {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text-main);
  word-break: break-all;
}

.input-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.input-group label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.input-wrapper {
  position: relative;
}

.input-wrapper input {
  width: 100%;
  padding: 0.875rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: rgba(30, 41, 59, 0.8);
  color: var(--text-main);
  font-family: 'Inter', monospace;
  font-size: 1.05rem;
  font-weight: 500;
  transition: var(--transition-fast);
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

.input-wrapper input::placeholder {
  color: rgba(148, 163, 184, 0.4);
}

.input-wrapper input:focus {
  outline: none;
  border-color: var(--primary);
  background: rgba(30, 41, 59, 1);
  box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.15), inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Buttons */
.actions {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-top: 0.5rem;
}

button {
  font-family: inherit;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  width: 100%;
  padding: 1rem 1.5rem;
  border: none;
  border-radius: var(--radius-md);
  font-size: 1.05rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-fast);
  position: relative;
  overflow: hidden;
}

button svg {
  transition: transform 0.3s ease;
}

button:hover svg {
  transform: scale(1.1);
}

button:active {
  transform: translateY(1px);
}

.btn-primary {
  background: var(--accent-gradient);
  color: white;
  box-shadow: 0 4px 15px rgba(59, 130, 246, 0.4);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.btn-primary::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  transition: left 0.7s ease;
}

.btn-primary:hover {
  box-shadow: 0 6px 20px rgba(59, 130, 246, 0.6);
  filter: brightness(1.1);
}

.btn-primary:hover::before {
  left: 100%;
}

.btn-secondary {
  background: var(--secondary);
  color: var(--secondary-text);
  border: 1px solid var(--border);
  backdrop-filter: blur(4px);
}

.btn-secondary:hover {
  background: var(--secondary-hover);
  border-color: rgba(255, 255, 255, 0.2);
}

.btn-danger {
  background: rgba(220, 38, 38, 0.15);
  color: #fca5a5;
  border: 1px solid rgba(220, 38, 38, 0.3);
  backdrop-filter: blur(4px);
}

.btn-danger:hover {
  background: rgba(220, 38, 38, 0.25);
  border-color: rgba(220, 38, 38, 0.5);
  box-shadow: 0 4px 15px rgba(220, 38, 38, 0.2);
  filter: brightness(1.1);
}

/* Map Container */
.map-container {
  height: 100%;
  min-height: 480px;
  /* Taller map for better UX */
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border);
  position: relative;
  background: var(--secondary);
  transition: var(--transition-smooth);
}

.map-container:hover {
  border-color: rgba(255, 255, 255, 0.2);
  box-shadow: var(--shadow-lg);
}

#map {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1;
  /* Keep map below modals/dropdowns if any */
}

/* Customizing Leaflet Controls for Dark Theme */
.leaflet-control-zoom {
  border: none !important;
  box-shadow: var(--shadow-md) !important;
  border-radius: var(--radius-sm) !important;
  overflow: hidden;
}

.leaflet-control-zoom a {
  background-color: var(--card-bg) !important;
  color: var(--text-main) !important;
  border-color: var(--border) !important;
  backdrop-filter: blur(8px);
}

.leaflet-control-zoom a:hover {
  background-color: var(--secondary-hover) !important;
}

/* Animations Keyframes */
@keyframes fadeInDown {
  from {
    opacity: 0;
    transform: translateY(-30px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes pulseError {
  0% {
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7);
  }

  50% {
    box-shadow: 0 0 0 10px rgba(239, 68, 68, 0);
  }

  100% {
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0);
  }
}

@keyframes slideUpFade {
  from {
    opacity: 0;
    transform: translateY(40px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@keyframes spin {
  100% {
    transform: rotate(360deg);
  }
}

.animate-spin {
  animation: spin 1s linear infinite;
}

/* Toggle Switch Styles (V3.1) */
.switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--secondary);
  transition: .4s;
  border: 1px solid var(--border);
}

.slider:before {
  position: absolute;
  content: "";
  height: 16px;
  width: 16px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .4s;
  box-shadow: var(--shadow-sm);
}

input:checked+.slider {
  background-color: var(--primary);
  border-color: var(--primary);
}

input:checked+.slider:before {
  transform: translateX(20px);
}

.slider.round {
  border-radius: 24px;
}

.slider.round:before {
  border-radius: 50%;
}

.setting-label:hover {
  background: rgba(59, 130, 246, 0.12) !important;
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

/* Help Button (Header) */
.btn-help {
  position: absolute;
  top: 0;
  right: 0;
  background: rgba(59, 130, 246, 0.1);
  /* Light blue tint makes it visible */
  border: 1px solid rgba(59, 130, 246, 0.3);
  color: var(--primary);
  /* Blue color instead of muted gray */
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition-fast);
}

.btn-help:hover {
  background: rgba(59, 130, 246, 0.2);
  color: #fff;
  border-color: var(--primary);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.2);
}

/* Help Modal Overlay */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  animation: fadeIn 0.3s ease-out;
}

.modal-content {
  background: var(--card-bg);
  backdrop-filter: blur(var(--card-blur));
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.1);
  width: 100%;
  max-width: 600px;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  padding: 2.5rem;
  color: var(--text-main);
  animation: slideUpFade 0.4s ease-out;
}

.modal-close {
  position: absolute;
  top: 1rem;
  right: 0.5rem;
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.5rem;
  border-radius: var(--radius-sm);
  transition: var(--transition-fast);
  display: flex;
  align-items: center;
  justify-content: center;
  width: auto;
  /* <-- C'est LA ligne qui corrige le problème ! */
}

.modal-close:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-main);
}

.modal-content h2 {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
  color: #fff;
  text-align: center;
  /* Ajouté pour centrer le titre */
}

.modal-subtitle {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin-bottom: 2rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: 1rem;
  text-align: center;
  /* Ajouté pour centrer le titre */
}

.modal-body {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.help-section h3 {
  font-size: 1.1rem;
  color: var(--primary);
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
}

.help-section ul {
  list-style-type: none;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding-left: 0.5rem;
}

.help-section li {
  position: relative;
  padding-left: 1.25rem;
  color: var(--text-main);
  line-height: 1.5;
  font-size: 0.95rem;
}

.help-section li::before {
  content: "•";
  color: var(--text-muted);
  position: absolute;
  left: 0;
  font-size: 1.2rem;
  line-height: 1.2;
}

.help-privacy-note {
  margin-top: 1rem;
  padding: 1rem;
  background: rgba(16, 185, 129, 0.1);
  /* Emerald tint */
  border: 1px solid rgba(16, 185, 129, 0.2);
  border-radius: var(--radius-sm);
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
}

.help-privacy-note p {
  color: #a7f3d0;
  font-size: 0.9rem;
  line-height: 1.5;
}

/* Custom Scrollbar for Modal */
.modal-content::-webkit-scrollbar {
  width: 8px;
}

.modal-content::-webkit-scrollbar-track {
  background: transparent;
}

.modal-content::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 4px;
}

.modal-content::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* Footer */
.app-footer {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-top: 1rem;
  padding: 1rem;
  animation: fadeIn 1s ease-out;
}

.app-footer a {
  color: var(--primary);
  text-decoration: none;
  transition: var(--transition-fast);
}

.app-footer a:hover {
  color: var(--primary-hover);
  text-decoration: underline;
}

/* Responsive Adjustments */
@media (max-width: 640px) {
  body {
    padding: 1.5rem 1rem;
  }

  h1 {
    font-size: 2.25rem;
  }

  .main-card {
    padding: 1.5rem;
    border-radius: var(--radius-lg);
  }

  .upload-area {
    padding: 3rem 1.5rem;
  }

  .map-container {
    min-height: 350px;
  }

}

.btn-telechargement {
  display: inline-block;
  padding: 12px 24px;
  background-color: rgba(255, 255, 255, 0.05);
  /* Fond très légèrement transparent */
  color: #fff;
  text-decoration: none;
  border-radius: 8px;
  font-family: Arial, sans-serif;
  font-weight: bold;
  border: 1px solid #7b61ff;
  /* Bordure violette pour rappeler votre thème */
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(123, 97, 255, 0.2);
  /* Léger halo lumineux violet */
}

.btn-telechargement:hover {
  background-color: rgba(123, 97, 255, 0.15);
  /* S'éclaire au survol */
  transform: translateY(-2px);
  /* Remonte très légèrement */
}

/* Cache le bouton de téléchargement si l'application est installée (PWA) */
@media (display-mode: standalone) {
  .btn-telechargement {
    display: none;
  }
}

/* Cache le bouton .exe sur les écrans de téléphone ou tablette (largeur inférieure à 768px) */
@media (max-width: 768px) {
  .desktop-download-wrapper {
    display: none !important;
  }
}

/* === Styles des Onglets V3 (Mode Dossier) === */
.tabs-container {
  display: flex;
  border-bottom: 2px solid var(--border);
  margin-bottom: 1.5rem;
  background: rgba(15, 23, 42, 0.4);
  border-radius: 8px 8px 0 0;
  overflow: hidden;
}

.tab-btn {
  flex: 1;
  padding: 12px 16px;
  background: transparent;
  border: none;
  border-bottom: 3px solid transparent;
  color: var(--text-muted);
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  font-size: 0.95rem;
}

.tab-btn:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-main);
}

.tab-btn.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  background: rgba(59, 130, 246, 0.1);
}

.tab-content {
  display: none;
  animation: fadeIn 0.4s ease forwards;
}

.tab-content.active {
  display: block;
}

/* === Système de Notifications (Toasts) === */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  pointer-events: none;
  width: 350px;
  /* Fixe définitivement la largeur de la colonne invisible */
  max-width: calc(100vw - 48px);
}

.toast {
  width: 100%;
  box-sizing: border-box;
  display: block;
  /* Séparation violente de Flex */
  background: var(--surface);
  color: var(--text);
  padding: 16px 20px;
  margin-top: 12px;
  border-radius: 8px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
  font-size: 0.95rem;
  line-height: 1.4;
  border-left: 4px solid var(--primary);
  pointer-events: auto;
  opacity: 0;
  transform: translateX(50px);
  animation: slideInRight 0.3s ease forwards;
  position: relative;
  overflow: hidden;
}

.toast.error {
  border-left-color: #ef4444;
}

.toast.success {
  border-left-color: #10b981;
}

.toast.warning {
  border-left-color: #f59e0b;
}

.toast-icon {
  float: left;
  /* Flotte à gauche du texte pour gagner de la place sans flex */
  margin-top: 2px;
  margin-right: 12px;
}

.toast.info .toast-icon {
  color: var(--primary);
}

.toast.error .toast-icon {
  color: #ef4444;
}

.toast.success .toast-icon {
  color: #10b981;
}

.toast.warning .toast-icon {
  color: #f59e0b;
}

/* === Bulles d'aide (?) === */
.help-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background-color: var(--primary);
  color: white;
  font-size: 0.75rem;
  font-weight: bold;
  margin-left: 8px;
  cursor: pointer;
  transition: transform 0.2s, background-color 0.2s;
  vertical-align: middle;
}

.help-icon:hover {
  transform: scale(1.15);
  background-color: #2563eb;
}

.toast-message {
  display: block;
  overflow: hidden;
  /* Déclenche un nouveau contexte de formattage à côté du float */
  white-space: normal;
  word-wrap: break-word;
  /* Oblige l'impression bout à bout */
  padding-right: 24px;
  /* Espace réservé pour la croix de fermeture */
}

.toast-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0;
  font-size: 1.2rem;
  opacity: 0.7;
  transition: opacity 0.2s;
  position: absolute;
  top: 16px;
  right: 16px;
}

.toast-close:hover {
  opacity: 1;
}

.toast.hiding {
  animation: slideOutRight 0.3s ease forwards;
}

@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(100%);
  }

  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes slideOutRight {
  from {
    opacity: 1;
    transform: translateX(0);
  }

  to {
    opacity: 0;
    transform: translateX(100%);
  }
}

/* === Multi-Image Batch Mode (V3) === */
.file-table tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background-color 0.2s;
  cursor: pointer;
}

.file-table tbody tr:hover {
  background-color: rgba(255, 255, 255, 0.03);
}

.file-table tbody tr.selected-row {
  background-color: rgba(59, 130, 246, 0.1);
}

.file-table tbody tr.focus-row {
  background-color: rgba(16, 185, 129, 0.1);
  border-left: 3px solid #10b981;
}

.file-table td {
  padding: 0.75rem;
  vertical-align: middle;
}

.status-badge {
  display: inline-block;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
  margin-left: 6px;
}

.status-badge.modified {
  background-color: rgba(16, 185, 129, 0.2);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.status-badge.secured {
  background-color: rgba(239, 68, 68, 0.2);
  color: #fca5a5;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.upload-area-mini:hover {
  border-color: var(--primary) !important;
  background-color: rgba(59, 130, 246, 0.05);
}

/* --- Mode 2: File Table Styles --- */

.file-table tbody tr {
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.15s ease;
}

.file-table tbody tr:hover {
  background: rgba(59, 130, 246, 0.08);
}

.file-table tbody tr.focus-row {
  background: rgba(139, 92, 246, 0.15) !important;
  border-left: 3px solid #8b5cf6;
}

.file-table td {
  padding: 0.6rem 0.75rem;
  vertical-align: middle;
}

/* Mode cards hover */
.mode-card:not(:disabled):hover {
  border-color: var(--primary) !important;
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
}

.mode-card:not(:disabled):active {
  transform: translateY(-1px);
}

/* Folder path validated state */
input.folder-validated {
  color: #10b981 !important;
  -webkit-text-fill-color: #10b981 !important;
  border-color: #10b981 !important;
  border-width: 2px !important;
  background-color: #0f172a !important;
}

/* Override browser autofill white/yellow background */
input.folder-validated:-webkit-autofill,
input.folder-validated:-webkit-autofill:hover,
input.folder-validated:-webkit-autofill:focus,
#visualFolderPathInput:-webkit-autofill,
#visualFolderPathInput:-webkit-autofill:hover,
#visualFolderPathInput:-webkit-autofill:focus,
#batchFolderTextInput:-webkit-autofill,
#batchFolderTextInput:-webkit-autofill:hover,
#batchFolderTextInput:-webkit-autofill:focus {
  -webkit-box-shadow: 0 0 0 1000px #0f172a inset !important;
  -webkit-text-fill-color: #10b981 !important;
  background-color: #0f172a !important;
  border-color: #10b981 !important;
  caret-color: #10b981 !important;
}

/* Also ensure non-validated autofill stays dark */
#visualFolderPathInput,
#batchFolderTextInput {
  background-color: #0f172a !important;
  color: #f8fafc !important;
}

/* Visual Map height */
#visualMap {
  height: 100%;
  width: 100%;
  min-height: 220px;
  z-index: 1;
}

/* Responsive: stack columns on mobile */
@media (max-width: 768px) {
  #visualContentSection {
    grid-template-columns: 1fr !important;
  }
}