:root {
  color-scheme: dark;
  --bg-start: #3d2817;
  --bg-end: #5c4033;
  --card: rgba(255, 255, 255, 0.08);
  --text: #f5ebe0;
  --muted: #c9b8a3;
  --accent: #c85a17;
  --accent-2: #d4a574;
  --border: rgba(212, 165, 116, 0.18);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: 'Inter', sans-serif;
  background:
    radial-gradient(circle at top left, rgba(212, 165, 116, 0.2), transparent 34%),
    radial-gradient(circle at bottom right, rgba(200, 90, 23, 0.18), transparent 28%),
    linear-gradient(135deg, var(--bg-start), var(--bg-end));
  color: var(--text);
  min-height: 100vh;
}

.page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  padding: 24px;
}

.card {
  width: 100%;
  max-width: none;
  background: var(--card);
  backdrop-filter: blur(18px);
  border: 1px solid var(--border);
  border-radius: 28px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.4);
  padding: 32px 24px;
}

.card-header {
  text-align: center;
  margin-bottom: 24px;
}

.card-header h1 {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--text);
}

.card-header p {
  color: var(--muted);
  font-size: 0.95rem;
}

.filter-container {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
  padding: 0 4px;
}

.filter-badge {
  display: inline-block;
  padding: 6px 12px;
  border-radius: 20px;
  background: rgba(212, 165, 116, 0.15);
  border: 1px solid rgba(212, 165, 116, 0.25);
  color: var(--text);
  font-size: 0.85rem;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  transition: all 0.2s ease;
}

.filter-badge:hover {
  background: rgba(212, 165, 116, 0.25);
  border-color: rgba(212, 165, 116, 0.4);
}

.filter-badge.active {
  background: rgba(200, 90, 23, 0.35);
  border-color: rgba(200, 90, 23, 0.5);
  box-shadow: 0 2px 8px rgba(200, 90, 23, 0.2);
}

.settings-container {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 20px;
  padding: 16px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(212, 165, 116, 0.12);
  justify-content: center;
}

.setting-item {
  display: flex;
  align-items: center;
  gap: 10px;
}

.setting-item label {
  color: var(--accent-2);
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
}

.setting-input {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(212, 165, 116, 0.25);
  border-radius: 10px;
  padding: 10px 14px;
  color: var(--text);
  font-family: 'Inter', sans-serif;
  font-size: 0.95rem;
  outline: none;
  transition: all 0.2s ease;
}

.setting-input:focus {
  border-color: rgba(212, 165, 116, 0.5);
  background: rgba(255, 255, 255, 0.12);
}

.setting-input::-webkit-calendar-picker-indicator {
  filter: invert(1) opacity(0.7);
  cursor: pointer;
}

.speed-unit {
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

#svg-container {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 400px;
}

#svg-container svg {
  max-width: 100%;
  height: auto;
  border-radius: 16px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}

.file-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
  padding: 8px;
  margin-bottom: 20px;
}

.file-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(212, 165, 116, 0.12);
  color: var(--text);
  font-size: 0.9rem;
  transition: all 0.2s ease;
  cursor: pointer;
  list-style: none;
}

.file-item:hover {
  background: rgba(212, 165, 116, 0.1);
  border-color: rgba(212, 165, 116, 0.2);
  transform: translateY(-1px);
}

.file-item-stats {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
}

.file-item-distance {
    flex: 0 0 52px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 52px;
    padding: 6px 8px;
    border-radius: 12px;
    background: linear-gradient(135deg, rgba(200, 90, 23, 0.25), rgba(212, 165, 116, 0.18));
    border: 1px solid rgba(200, 90, 23, 0.35);
    white-space: nowrap;
    box-shadow: 0 4px 12px rgba(200, 90, 23, 0.15);
    line-height: 1;
}

.file-item-elevation {
    flex: 0 0 52px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 52px;
    padding: 6px 8px;
    border-radius: 12px;
    background: linear-gradient(135deg, rgba(180, 100, 50, 0.25), rgba(212, 165, 116, 0.18));
    border: 1px solid rgba(180, 100, 50, 0.35);
    white-space: nowrap;
    box-shadow: 0 4px 12px rgba(180, 100, 50, 0.15);
    line-height: 1;
}

.file-item-headwind {
    flex: 0 0 auto;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 6px 10px;
    border-radius: 12px;
    background: linear-gradient(135deg, rgba(100, 150, 200, 0.25), rgba(116, 185, 212, 0.18));
    border: 1px solid rgba(100, 150, 200, 0.35);
    white-space: nowrap;
    box-shadow: 0 4px 12px rgba(100, 150, 200, 0.15);
}

.headwind-value {
  font-size: 0.9rem;
  font-weight: 700;
  color: #a8d5e8;
  line-height: 1;
}

.headwind-unit {
  font-size: 0.8rem;
  color: #a8d5e8;
  opacity: 0.9;
}

.headwind-unit i {
  font-size: 0.85rem;
}

.file-item-rain {
    flex: 0 0 auto;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 6px 10px;
    border-radius: 12px;
    background: linear-gradient(135deg, rgba(100, 150, 200, 0.2), rgba(116, 165, 185, 0.15));
    border: 1px solid rgba(100, 150, 200, 0.3);
    white-space: nowrap;
    box-shadow: 0 4px 12px rgba(100, 150, 200, 0.12);
}

.rain-value {
  font-size: 0.85rem;
  font-weight: 700;
  color: #a8c8d8;
  line-height: 1;
}

.rain-unit {
  font-size: 0.8rem;
  color: #a8c8d8;
  opacity: 0.9;
}

.rain-unit i {
  font-size: 0.85rem;
}

.file-item-duration {
    flex: 0 0 auto;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 6px 10px;
    border-radius: 12px;
    background: linear-gradient(135deg, rgba(100, 150, 200, 0.2), rgba(116, 165, 185, 0.15));
    border: 1px solid rgba(100, 150, 200, 0.3);
    white-space: nowrap;
    box-shadow: 0 4px 12px rgba(100, 150, 200, 0.12);
}

.duration-value {
  font-size: 0.85rem;
  font-weight: 700;
  color: #a8c8d8;
  line-height: 1;
}

.duration-unit {
  font-size: 0.8rem;
  color: #a8c8d8;
  opacity: 0.9;
}

.duration-unit i {
  font-size: 0.85rem;
}

.file-item-climb {
    flex: 0 0 auto;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 6px 10px;
    border-radius: 12px;
    background: linear-gradient(135deg, rgba(100, 150, 200, 0.2), rgba(116, 165, 185, 0.15));
    border: 1px solid rgba(100, 150, 200, 0.3);
    white-space: nowrap;
    box-shadow: 0 4px 12px rgba(100, 150, 200, 0.12);
}

.file-item-arrival {
    flex: 0 0 auto;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 6px 10px;
    border-radius: 12px;
    background: linear-gradient(135deg, rgba(100, 150, 200, 0.2), rgba(116, 165, 185, 0.15));
    border: 1px solid rgba(100, 150, 200, 0.3);
    white-space: nowrap;
    box-shadow: 0 4px 12px rgba(100, 150, 200, 0.12);
}

.arrival-value {
  font-size: 0.85rem;
  font-weight: 700;
  color: #a8c8d8;
  line-height: 1;
}

.arrival-unit {
  font-size: 0.8rem;
  color: #a8c8d8;
  opacity: 0.9;
}

.arrival-unit i {
  font-size: 0.85rem;
}

.climb-value {
  font-size: 0.85rem;
  font-weight: 700;
  color: #a8c8d8;
  line-height: 1;
}

.climb-unit {
  font-size: 0.8rem;
  color: #a8c8d8;
  opacity: 0.9;
}

.climb-unit i {
  font-size: 0.85rem;
}

.distance-value,
.elevation-value {
  display: block;
  font-size: 1rem;
  font-weight: 700;
  color: #e8c59a;
  line-height: 1.2;
}

.distance-unit,
.elevation-unit {
  display: block;
  font-size: 0.6rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 2px;
  opacity: 0.9;
}

.file-item-activity {
    flex: 0 0 70px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 6px 8px;
    border-radius: 12px;
    background: linear-gradient(135deg, rgba(60, 100, 60, 0.3), rgba(100, 140, 100, 0.2));
    border: 1px solid rgba(60, 100, 60, 0.4);
    white-space: nowrap;
    box-shadow: 0 4px 12px rgba(60, 100, 60, 0.2);
    font-size: 0.8rem;
    font-weight: 600;
    color: #a8d8a0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.file-item-thumbnail {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.25);
  padding: 4px;
}

.file-item-name {
    flex: 1 1 auto;
    font-weight: 700;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 0.95rem;
    letter-spacing: -0.02em;
    margin-right: 12px;
}

.placeholder {
  color: var(--muted);
  text-align: center;
  padding: 40px;
}

.placeholder i {
  font-size: 3rem;
  margin-bottom: 16px;
  opacity: 0.5;
  color: var(--accent);
}

/* Fenêtre modale */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(8px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 24px;
}

.modal-overlay.modal-active {
    display: flex;
}

.modal-content {
    background: var(--card);
    backdrop-filter: blur(18px);
    border: 1px solid var(--border);
    border-radius: 28px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.4);
    max-width: 900px;
    width: 100%;
    max-height: 90vh;
    overflow: auto;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
}

.modal-header h2 {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--text);
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    color: var(--muted);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    transition: all 0.2s ease;
}

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

.modal-body {
    padding: 24px;
    display: flex;
    justify-content: center;
}

.modal-body svg {
    max-width: 100%;
    height: auto;
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

@media (max-width: 768px) {
  .page {
    padding: 16px;
  }

  .card {
    padding: 24px 18px;
    border-radius: 22px;
  }
  
  .modal-content {
    max-height: 95vh;
  }
  
  .modal-header {
    padding: 16px 20px;
  }
  
  .modal-body {
    padding: 16px;
  }
}
