/* Planning → Calendrier — mobile-first, clair/sombre. */

:root {
  --bg: #eef2f7;
  --surface: #ffffff;
  --text: #1f2937;
  --muted: #6b7280;
  --accent: #1d4ed8;
  --accent-soft: #dbeafe;
  --border: #d8dee9;
  --warn: #b45309;
  --warn-bg: #fef3c7;
  --error: #b91c1c;
  --error-bg: #fee2e2;
  --shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
  --radius: 16px;
}

[data-theme="dark"] {
  --bg: #0f172a;
  --surface: #1e293b;
  --text: #e2e8f0;
  --muted: #94a3b8;
  --accent: #60a5fa;
  --accent-soft: #1e3a5f;
  --border: #334155;
  --warn: #fbbf24;
  --warn-bg: #3d2f10;
  --error: #f87171;
  --error-bg: #431a1a;
  --shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f172a;
    --surface: #1e293b;
    --text: #e2e8f0;
    --muted: #94a3b8;
    --accent: #60a5fa;
    --accent-soft: #1e3a5f;
    --border: #334155;
    --warn: #fbbf24;
    --warn-bg: #3d2f10;
    --error: #f87171;
    --error-bg: #431a1a;
    --shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  }
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.topbar-inner {
  max-width: 760px;
  margin: 0 auto;
  padding: 0.6rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand { font-weight: 700; font-size: 1.05rem; }

main {
  max-width: 760px;
  margin: 0 auto;
  padding: 1rem;
  display: grid;
  gap: 1rem;
}

.card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  padding: 1.25rem;
}

h1 { font-size: 1.35rem; margin: 0 0 0.5rem; }
h2 { font-size: 1.1rem; margin: 0 0 0.75rem; }
p { margin: 0.4rem 0; }

.steps {
  list-style: none;
  padding: 0;
  margin: 0.9rem 0 0;
  display: grid;
  gap: 0.5rem;
}

.steps li { display: flex; align-items: center; gap: 0.6rem; font-weight: 500; }

.steps span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.7rem;
  height: 1.7rem;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 0.9rem;
  flex-shrink: 0;
}

.dropzone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1rem;
  text-align: center;
  transition: border-color 0.15s, background 0.15s;
}

.dropzone.dragover { border-color: var(--accent); background: var(--accent-soft); }
.dropzone-icon { font-size: 2.2rem; }
.dropzone-title { font-weight: 600; margin: 0.35rem 0 0.15rem; }
.dropzone-sub { color: var(--muted); font-size: 0.85rem; margin: 0 0 0.8rem; }

.dropzone-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  justify-content: center;
}

button, .button-like {
  font: inherit;
  border: none;
  border-radius: 12px;
  padding: 0.7rem 1.1rem;
  cursor: pointer;
  font-weight: 600;
  transition: filter 0.15s, transform 0.05s;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  justify-content: center;
  min-height: 44px;
}

button:active { transform: scale(0.98); }
button:disabled { opacity: 0.5; cursor: not-allowed; }

.primary { background: var(--accent); color: #fff; width: 100%; margin-top: 0.9rem; font-size: 1rem; }
.primary:hover:not(:disabled) { filter: brightness(1.1); }

.secondary {
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid var(--border);
}
.secondary:hover { filter: brightness(1.05); }

.ghost { background: transparent; font-size: 1.1rem; padding: 0.4rem 0.6rem; }
.danger { color: var(--error); }

.thumbs {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  padding: 0;
  margin: 0.9rem 0 0;
}

.thumbs li {
  position: relative;
  width: 86px;
  margin: 0 0.4rem 0.4rem 0;
}

.thumbs img {
  width: 86px;
  height: 86px;
  object-fit: cover;
  border-radius: 10px;
  border: 1px solid var(--border);
  display: block;
}

.thumbs .thumb-remove {
  position: absolute;
  top: -12px;
  right: -12px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--error);
  color: #fff;
  font-size: 0.8rem;
  padding: 0;
  line-height: 1;
}

.selection-summary {
  color: var(--muted);
  font-size: 0.85rem;
}

.thumbs .thumb-name {
  font-size: 0.7rem;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: block;
}

.tips { color: var(--muted); font-size: 0.85rem; }

.progress-track {
  height: 10px;
  border-radius: 5px;
  background: var(--accent-soft);
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  width: 0%;
  border-radius: 5px;
  background: var(--accent);
  transition: width 0.4s ease;
}

.progress-label { font-weight: 600; }

.analysis-recovery {
  margin-top: 1rem;
  padding: 0.9rem;
  border: 1px solid var(--error);
  border-radius: 12px;
  background: var(--error-bg);
  color: var(--error);
}

.analysis-recovery h3 { margin: 0; font-size: 1rem; }

.analysis-actions {
  display: grid;
  gap: 0.6rem;
  margin-top: 0.8rem;
}

.analysis-actions .primary { margin-top: 0; }

.warnings, .errors {
  border-radius: 12px;
  padding: 0.7rem 0.9rem;
  font-size: 0.9rem;
  margin-bottom: 0.8rem;
}

.warnings { background: var(--warn-bg); color: var(--warn); }
.errors { background: var(--error-bg); color: var(--error); }
.warnings ul, .errors ul { margin: 0.2rem 0 0; padding-left: 1.2rem; }

.badge-sample {
  background: var(--warn-bg);
  color: var(--warn);
  border-radius: 6px;
  padding: 0 0.3rem;
  font-size: 0.8rem;
}

.events-list { display: grid; gap: 0.9rem; }

.event-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.9rem;
  display: grid;
  gap: 0.6rem;
}

.event-title { margin: 0; font-size: 1rem; }

.event-card .event-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 0.5rem;
  align-items: center;
}

.event-card .event-head .field:first-child { grid-column: 1 / -1; }

.event-delete {
  justify-self: end;
  background: transparent;
  color: var(--error);
  font-size: 1.05rem;
  padding: 0.3rem 0.5rem;
}

.field {
  display: grid;
  gap: 0.2rem;
}

.field label {
  font-size: 0.75rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  display: flex;
  gap: 0.4rem;
  align-items: center;
}

.field .badge {
  background: var(--warn-bg);
  color: var(--warn);
  border-radius: 6px;
  padding: 0 0.3rem;
  text-transform: none;
  letter-spacing: 0;
}

input, select {
  font: inherit;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.55rem 0.65rem;
  width: 100%;
  min-height: 44px;
}

input:focus, select:focus, button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.dropzone:focus-visible, summary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.field.warn input { border-color: var(--warn); background: var(--warn-bg); }
.field.warn select, .warn-input { border-color: var(--warn); background: var(--warn-bg); }

.corrected-hint {
  font-size: 0.75rem;
  color: var(--muted);
}

.corrected-hint button {
  background: none;
  color: var(--accent);
  padding: 0;
  font-size: 0.75rem;
  text-decoration: underline;
}

.field-row { display: grid; gap: 0.3rem; margin-bottom: 0.8rem; }
.field-row label { font-weight: 600; font-size: 0.9rem; }

.export-buttons { display: grid; gap: 0.6rem; }
.export-buttons .secondary { width: 100%; padding: 0.8rem; }

.host-result {
  margin-top: 0.9rem;
  background: var(--accent-soft);
  border-radius: 12px;
  padding: 0.8rem;
}

.host-url-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 0.5rem; }
.host-url-row input { min-width: 0; font-size: 0.85rem; }
.host-url-row button { flex-shrink: 0; }

.status-message { color: var(--muted); font-size: 0.9rem; }

.howto { margin-top: 1rem; }
.howto summary { cursor: pointer; font-weight: 600; }
.howto p { font-size: 0.9rem; }

footer {
  max-width: 760px;
  margin: 0 auto;
  padding: 0 1rem 2rem;
  color: var(--muted);
  font-size: 0.8rem;
  text-align: center;
}

@media (min-width: 640px) {
  h1 { font-size: 1.6rem; }
  .steps { grid-template-columns: repeat(3, 1fr); }
  .export-buttons { grid-template-columns: 1fr 1fr; }
  .primary { width: auto; }
  .analysis-actions { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .event-card .event-head { grid-template-columns: minmax(10rem, 1fr) minmax(7rem, 0.75fr) minmax(8rem, 0.75fr) auto; }
  .event-card .event-head .field:first-child { grid-column: auto; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }

  button:active { transform: none; }
}
