/* InteracMap - Style Moderne & Fluide */

:root {
  --primary: #0066FF;
  --primary-dark: #0052CC;
  --secondary: #00D9FF;
  --accent: #FF6B35;
  --text-light: #2D3436;
  --text-muted: #636E72;
  --bg-light: #F8FAFB;
  --bg-alt: #FFFFFF;
  --border: #E8EBEF;
}

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

html, body {
  width: 100%;
  height: 100%;
}

body {
  font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, 'Helvetica Neue', sans-serif;
  overflow: hidden;
  background: linear-gradient(135deg, #E8F0FE 0%, #F0E8FE 100%);
  transition: background 0.3s ease, color 0.3s ease;
  color: var(--text-light);
}

body.dark {
  background: linear-gradient(135deg, #0F1419 0%, #1A1F2E 100%);
  color: #E0E0E0;
}

/* Header */
header {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: white;
  padding: 1.4rem 1.8rem;
  text-align: center;
  box-shadow: 0 8px 24px rgba(0, 102, 255, 0.25);
  position: relative;
  backdrop-filter: blur(10px);
}

header h1 {
  font-size: 1.8rem;
  margin-bottom: 0.3rem;
  font-weight: 700;
}

header p {
  opacity: 0.95;
  font-size: 0.95rem;
  font-weight: 500;
}

#themeToggle {
  position: absolute;
  top: 50%;
  right: 1.5rem;
  transform: translateY(-50%);
  background: rgba(255, 255, 255, 0.2);
  border: 2px solid rgba(255, 255, 255, 0.3);
  color: white;
  padding: 0.6rem 0.8rem;
  border-radius: 50%;
  cursor: pointer;
  font-size: 1.2rem;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

#themeToggle:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: translateY(-50%) scale(1.05);
}

/* Container */
.container {
  display: flex;
  height: calc(100vh - 80px);
  gap: 0;
}

/* Map */
#map {
  flex: 1;
  background: white;
  border-radius: 12px 0 0 12px;
  overflow: hidden;
  box-shadow: inset -4px 0 15px rgba(0, 0, 0, 0.1);
}

body.dark #map {
  background: #2a2a3e;
}

/* Sidebar */
.sidebar {
  width: 360px;
  background: var(--bg-alt);
  backdrop-filter: blur(20px);
  overflow-y: auto;
  overflow-x: hidden;
  box-shadow: -8px 0 32px rgba(0, 0, 0, 0.12);
  border-radius: 0;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--border);
}

body.dark .sidebar {
  background: rgba(26, 31, 46, 0.98);
  box-shadow: -8px 0 32px rgba(0, 0, 0, 0.4);
  border-color: rgba(255, 255, 255, 0.08);
}

/* Tabs */
.tab-buttons {
  display: flex;
  background: linear-gradient(135deg, var(--bg-light) 0%, var(--bg-alt) 100%);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  gap: 0;
  padding: 0.6rem;
}

body.dark .tab-buttons {
  background: rgba(0, 0, 0, 0.15);
  border-color: rgba(255, 255, 255, 0.08);
}

.tab-btn {
  flex: 1;
  padding: 0.8rem 1rem;
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-muted);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  border-radius: 8px;
  white-space: nowrap;
}

body.dark .tab-btn {
  color: #A0A9B8;
}

.tab-btn:hover {
  background: rgba(0, 102, 255, 0.08);
  color: var(--primary);
}

.tab-btn.active {
  color: white;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  box-shadow: 0 4px 12px rgba(0, 102, 255, 0.3);
}

/* Tab Content */
.tab-content {
  display: none;
  padding: 1.3rem;
  overflow-y: auto;
  flex: 1;
}

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

/* Sections */
.section {
  background: white;
  border-radius: 12px;
  padding: 1.3rem;
  margin-bottom: 1.2rem;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
  border: 1px solid var(--border);
  border-left: 4px solid var(--primary);
  transition: all 0.3s ease;
}

.section:hover {
  box-shadow: 0 4px 16px rgba(0, 102, 255, 0.12);
  border-left: 4px solid var(--secondary);
}

body.dark .section {
  background: rgba(255, 255, 255, 0.05);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.2);
  border-color: rgba(0, 102, 255, 0.3);
}

.section h3 {
  color: var(--primary);
  font-size: 0.95rem;
  margin-bottom: 1rem;
  font-weight: 700;
  text-transform: none;
  letter-spacing: 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

body.dark .section h3 {
  color: #7DD3FC;
}

/* Labels and Inputs */
label {
  display: block;
  margin-bottom: 0.8rem;
  font-size: 0.9rem;
  color: var(--text-light);
  cursor: pointer;
}

body.dark label {
  color: #c0c0c0;
}

label input[type="checkbox"],
label input[type="radio"] {
  margin-right: 0.6rem;
  cursor: pointer;
  width: 18px;
  height: 18px;
  accent-color: var(--primary);
}

input[type="text"],
input[type="number"],
input[type="color"] {
  width: 100%;
  padding: 0.6rem 0.8rem;
  border: 2px solid rgba(0, 0, 0, 0.1);
  border-radius: 6px;
  font-size: 0.9rem;
  margin-top: 0.4rem;
  transition: all 0.3s ease;
  margin-bottom: 0.8rem;
}

body.dark input[type="text"],
body.dark input[type="number"],
body.dark input[type="color"] {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
  color: #e0e0e0;
}

input[type="text"]:focus,
input[type="number"]:focus,
input[type="color"]:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

input[type="range"] {
  width: 100%;
  height: 6px;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.1);
  outline: none;
  -webkit-appearance: none;
  appearance: none;
  margin-bottom: 0.5rem;
}

body.dark input[type="range"] {
  background: rgba(255, 255, 255, 0.1);
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--primary);
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(99, 102, 241, 0.4);
  transition: all 0.3s ease;
}

input[type="range"]::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--primary);
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(99, 102, 241, 0.4);
  border: none;
  transition: all 0.3s ease;
}

input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.2);
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.6);
}

/* Buttons */
button {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: white;
  border: none;
  padding: 0.8rem 1.2rem;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.9rem;
  transition: all 0.3s ease;
  width: 100%;
  margin-bottom: 0.6rem;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

button:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.5);
}

button:active {
  transform: translateY(0);
}

/* Color Filters */
#colorFilters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
}

.color-filter {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.4);
  cursor: pointer;
  padding: 0;
  margin: 0;
  transition: all 0.3s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.color-filter:hover {
  border-color: rgba(255, 255, 255, 0.8);
  transform: scale(1.05);
}

.color-filter.active {
  border-color: white;
  transform: scale(1.15);
  box-shadow: 0 0 0 5px var(--primary), 0 4px 12px rgba(99, 102, 241, 0.5);
}

/* Scrollbar */
.sidebar::-webkit-scrollbar {
  width: 8px;
}

.sidebar::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.05);
  border-radius: 10px;
}

body.dark .sidebar::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.05);
}

.sidebar::-webkit-scrollbar-thumb {
  background: rgba(99, 102, 241, 0.3);
  border-radius: 10px;
}

.sidebar::-webkit-scrollbar-thumb:hover {
  background: rgba(99, 102, 241, 0.6);
}

/* Leaflet Overrides */
.leaflet-container {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

/* Responsive */
@media (max-width: 768px) {
  .container {
    flex-direction: column;
  }
  
  #map {
    border-radius: 12px 12px 0 0;
  }
  
  .sidebar {
    width: 100%;
    height: 40%;
    border-radius: 12px 12px 0 0;
    max-height: 50vh;
  }
  
  .tab-btn {
    font-size: 0.8rem;
    padding: 0.7rem 0.3rem;
  }
  
  .section {
    padding: 1rem;
    margin-bottom: 0.8rem;
  }
}

/* ========== SÉLECTIONS VISUELLES ==========*/

/* Points de sélection */
.selection-point {
  animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
  0% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.7;
    transform: scale(1.2);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

/* Étiquettes de sélection */
.selection-label {
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3));
}

/* Ligne d'aperçu */
.preview-line {
  animation: fadeIn 0.2s ease-in;
}

.preview-line-dynamic {
  opacity: 0.5 !important;
  animation: fadeIn 0.1s ease-in;
}

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

/* Icône texte */
.text-icon {
  animation: slideIn 0.3s ease-out;
}

/* Label des numéros */
.number-label {
  animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
  from {
    transform: scale(0.8);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

/* ========== NEW FORM STYLES ==========*/

.form-group {
  margin-bottom: 1rem;
  display: flex;
  flex-direction: column;
}

.form-group label {
  font-weight: 600;
  color: var(--primary);
  margin-bottom: 0.4rem;
}

body.dark .form-group label {
  color: #a5b4fc;
}

.color-input,
.input-text,
.input-number,
.select-input {
  padding: 0.7rem 0.8rem;
  border: 2px solid rgba(99, 102, 241, 0.2);
  border-radius: 6px;
  font-size: 0.9rem;
  transition: all 0.3s ease;
  font-family: inherit;
}

body.dark .color-input,
body.dark .input-text,
body.dark .input-number,
body.dark .select-input {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(99, 102, 241, 0.3);
  color: #e0e0e0;
}

.color-input,
.input-text,
.input-number,
.select-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.slider {
  width: 100%;
  height: 6px;
  margin-bottom: 0.4rem;
}

.slider-value {
  font-size: 0.85rem;
  color: #666;
  font-weight: 500;
}

body.dark .slider-value {
  color: #a0a0a0;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: white;
  padding: 0.8rem 1.2rem;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 700;
  font-size: 0.9rem;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  width: 100%;
  margin-bottom: 0.6rem;
  box-shadow: 0 4px 16px rgba(0, 102, 255, 0.3);
  position: relative;
  overflow: hidden;
}

.btn-primary::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  transform: translate(-50%, -50%);
  transition: width 0.6s, height 0.6s;
}

.btn-primary:hover::before {
  width: 300px;
  height: 300px;
}

.btn-primary:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(0, 102, 255, 0.4);
}

.btn-primary:active {
  transform: translateY(-1px);
}

.btn-secondary {
  background: rgba(0, 102, 255, 0.1);
  color: var(--primary);
  padding: 0.8rem 1.2rem;
  border: 2px solid rgba(0, 102, 255, 0.3);
  border-radius: 10px;
  cursor: pointer;
  font-weight: 700;
  font-size: 0.9rem;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  width: 100%;
  margin-bottom: 0.6rem;
}

body.dark .btn-secondary {
  background: rgba(0, 102, 255, 0.08);
  color: #7DD3FC;
  border-color: rgba(0, 102, 255, 0.5);
}

.btn-secondary:hover {
  transform: translateY(-3px);
  background: rgba(0, 102, 255, 0.15);
  border-color: var(--primary);
  box-shadow: 0 4px 12px rgba(0, 102, 255, 0.2);
}

.btn-secondary:active {
  transform: translateY(-1px);
}

.checkbox-group {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.checkbox-group label {
  display: flex;
  align-items: center;
  margin-bottom: 0;
  font-weight: 500;
}

.checkbox-group input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin-right: 0.8rem;
  cursor: pointer;
  accent-color: var(--primary);
}

.color-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
  justify-content: center;
  margin-top: 0.8rem;
}

.color-filters .color-filter {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  border: 3px solid rgba(99, 102, 241, 0.2);
  cursor: pointer;
  padding: 0;
  transition: all 0.3s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

body.dark .color-filters .color-filter {
  border-color: rgba(99, 102, 241, 0.4);
}

.color-filters .color-filter:hover {
  border-color: var(--primary);
  transform: scale(1.1);
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.color-filters .color-filter.active {
  border-color: var(--primary);
  transform: scale(1.2);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2), 0 4px 12px rgba(99, 102, 241, 0.4);
}

.element-count {
  background: rgba(99, 102, 241, 0.1);
  padding: 0.8rem;
  border-radius: 6px;
  text-align: center;
  font-size: 0.9rem;
  margin-top: 0.8rem;
  border-left: 4px solid var(--primary);
}

body.dark .element-count {
  background: rgba(99, 102, 241, 0.15);
  color: #a5b4fc;
}

.element-count strong {
  color: var(--primary);
  display: block;
  margin-bottom: 0.4rem;
}

body.dark .element-count strong {
  color: #c7d2fe;
}

.element-count span {
  font-size: 1.3rem;
  font-weight: 700;
}

.info-box {
  background: rgba(99, 102, 241, 0.08) !important;
  border-color: rgba(99, 102, 241, 0.3) !important;
}

body.dark .info-box {
  background: rgba(99, 102, 241, 0.12) !important;
}

.info-box h3 {
  margin-bottom: 0.8rem;
}

.info-box ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.info-box li {
  padding: 0.5rem 0;
  font-size: 0.85rem;
  color: var(--text-light);
  border-bottom: 1px solid rgba(99, 102, 241, 0.2);
}

body.dark .info-box li {
  color: #c0c0c0;
  border-color: rgba(99, 102, 241, 0.3);
}

.info-box li:last-child {
  border-bottom: none;
}

.info-box strong {
  color: var(--primary);
}

body.dark .info-box strong {
  color: #a5b4fc;
}

/* ========== LIGNE EDITING ==========*/

@keyframes blink {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.2;
  }
}

.editing-line {
  animation: blink 0.6s ease-in-out;
}

#editSection {
  background: linear-gradient(135deg, #FFF8F0 0%, #F0F8FF 100%) !important;
  border-left: 4px solid var(--accent) !important;
  border-top: 2px dashed var(--accent);
}

body.dark #editSection {
  background: linear-gradient(135deg, rgba(255, 107, 53, 0.15) 0%, rgba(0, 102, 255, 0.1) 100%) !important;
  border-color: rgba(255, 107, 53, 0.5) !important;
}

#editSection h3 {
  color: var(--accent);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

body.dark #editSection h3 {
  color: #FF9D6B;
}

.color-picker-wrapper {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.color-input {
  width: 60px;
  height: 40px;
  border: 2px solid var(--accent);
  border-radius: 6px;
  cursor: pointer;
  transition: transform 0.2s ease;
}

.color-input:hover {
  transform: scale(1.05);
}

.color-input:active {
  transform: scale(0.95);
}

.color-preview {
  flex: 1;
  padding: 8px 12px;
  background: var(--accent);
  border-radius: 6px;
  font-weight: 600;
  color: white;
  font-size: 0.9rem;
}

.select-input {
  width: 100%;
  padding: 8px 12px;
  background: white;
  color: #2D3436;
  border: 2px solid var(--accent);
  border-radius: 6px;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.select-input:hover {
  background: #f8f9fa;
  box-shadow: 0 2px 8px rgba(0, 102, 255, 0.2);
}

.select-input:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(0, 102, 255, 0.1);
}

body.dark .select-input {
  background: #1e1e1e;
  color: #e0e0e0;
  border-color: #FF9D6B;
}

body.dark .select-input:hover {
  background: #2a2a2a;
  box-shadow: 0 2px 8px rgba(255, 107, 53, 0.2);
}

