/*!
 * © 2025 - 2026 Alexandre M.
 * Tous droits réservés.
 * Réutilisation interdite sans autorisation.
 */

:root {
  /* Fond */
  --bg: #0b0c0f;
  --bg-card-alt: #0f1115;

  /* Bordures et surfaces */
  --border: #2a2d34;
  --shadow-soft: 0 18px 45px rgba(0,0,0,0.45);

  /* Texte */
  --text: #e5e5e5;
  --muted: #9b9ea5;

  /* Accent neutre */
  --accent: #d1d5db;
  --accent-soft: rgba(209,213,219,0.15);

  /* Étiquettes */
  --new: #60a5fa;
  --review: #facc15;
  --master: #4ade80;
}

* {
  box-sizing: border-box;
  font-family: system-ui, -apple-system, BlinkMacSystemFont,
    "SF Pro Text", "Segoe UI", sans-serif;
}

html, body {
  overflow-x: hidden;
}

body {
  margin: 0;
  padding: 0;
  /* background: radial-gradient(circle at top, #131416 0%, #0c0d0f 55%, #000 100%); */
  background-color: #0a0a0a;;
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.navbar {
  width: 100%;
  padding: 18px 40px;
  background: #0d0d0d;
  border: none;
  display: flex;
  justify-content: center;
  gap: 48px;
  position: sticky;
  top: 0;
  z-index: 999;
  backdrop-filter: none;
}

.navbar a {
  display: inline-block;
  position: relative;
  color: #e5e5e5;
  text-decoration: none;
  font-size: 1rem;
  font-weight: 500;
  padding-bottom: 4px;
}

.navbar a::after {
  content: '';
  position: absolute;
  width: 100%;
  transform: scaleX(0);
  border-radius: 5px;
  height: 2px;
  bottom: 0;
  left: 0;
  background: currentColor;
  transform-origin: bottom right;
  transition: transform 0.25s ease-out;
}

.navbar a:hover::after {
  transform: scaleX(1);
  transform-origin: bottom left;
}

.hero {
  height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: 0 20px;
  background: rgba(0,0,0,0.45);
  backdrop-filter: blur(3px);
}

.hero img {
  width: 220px;
  height: auto;
  margin-bottom: 1rem;
  user-select: none;
}

.hero .desc {
  font-size: 1.1rem;
  color: #d1d5db;
  max-width: 600px;
}

@media (max-width: 768px) {
  .navbar {
    padding: 20px 0;
    gap: 45px;
    justify-content: center;
    flex-wrap: wrap;
  }

  .navbar a {
    font-size: 0.9rem;
  }
}

@media (max-width: 480px) {
  .navbar {
    padding: 20px 0;
    gap: 25px;
  }

  .navbar a {
    font-size: 0.85rem;
  }
}

.app {
  max-width: 1100px;
  width: 100%;
  padding: 2rem 1rem 3rem;
  margin-top: 1.5rem;
}

.title {
  font-size: clamp(1.8rem, 3vw, 2.2rem);
  font-weight: 700;
  letter-spacing: 0.04em;
  margin-bottom: 0.3rem;
}

.subtitle {
  color: var(--muted);
  font-size: 0.95rem;
  margin-bottom: 1.5rem;
}

.card {
  background:
    radial-gradient(circle at top left, rgba(255,255,255,0.10), transparent 55%),
    radial-gradient(circle at bottom right, rgba(15,15,15,0.45), transparent 55%),
    var(--bg-card);
  border-radius: 1.5rem;
  padding: 1.5rem 1.5rem 1.3rem;
  box-shadow: var(--shadow-soft);
  border: 1px solid rgba(148,163,184,0.24);
  margin-bottom: 1.5rem;
}

.controls {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
  align-items: end;
}

.field label {
  display: block;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 0.3rem;
}

.field input,
.field select {
  width: 100%;
  padding: 0.55rem 0.75rem;
  border-radius: 0.9rem;
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.05);
  color: var(--text);
  font-size: 0.9rem;
  outline: none;
}

.field input[type="file"] {
  padding: 0.35rem 0.4rem;
}

.field input[type="date"]::-webkit-calendar-picker-indicator {
  opacity: 0;
}

.field input:focus,
.field select:focus {
  border-color: rgba(255,255,255,0.35);
  box-shadow: 0 0 0 1px rgba(255,255,255,0.25);
}

.field input.file-input-hidden {
  width: 0;
  height: 0;
  padding: 0;
  border: 0;
}

.checkbox-row {
  padding-top: 1em;
  padding-bottom: 1em;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8rem;
  text-transform: none;
  letter-spacing: normal;
}

.checkbox-row input[type="checkbox"] {
  width: auto;
  margin: 0;
}

.button-primary {
  border: none;
  border-radius: 999px;
  padding: 0.7rem 1.3rem;
  font-size: 0.9rem;
  font-weight: 600;
  text-transform: uppercase;
  text-decoration: none;
  letter-spacing: 0.06em;
  cursor: pointer;
  background: linear-gradient(135deg, #ffffff, #cfcfcf);
  color: #0b0c0f;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  box-shadow: 0 14px 30px rgba(255,255,255,0.05);
  transition: 0.12s ease-out;
}

.button-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 18px 40px rgba(255,255,255,0.08);
}

.button-primary:active {
  transform: translateY(0);
  box-shadow: 0 8px 20px rgba(255,255,255,0.04);
}

.button-primary span.icon {
  font-size: 1rem;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.7rem;
  font-size: 0.78rem;
  color: var(--muted);
}

.chip {
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.15);
  background: rgba(255,255,255,0.06);
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.chip-dot {
  width: 7px;
  height: 7px;
  border-radius: 999px;
}

.chip-dot.new { background: var(--new); }
.chip-dot.review { background: var(--review); }
.chip-dot.master { background: var(--master); }

.summary-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
  color: var(--muted);
  margin-top: 0.7rem;
  border-top: 1px dashed rgba(148,163,184,0.35);
  padding-top: 0.6rem;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.summary-bar strong {
  color: var(--accent);
}

.schedule {
  margin-top: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  max-height: 65vh;
  overflow: auto;
  padding-right: 0.3rem;
}

.day-card {
  background: linear-gradient(120deg, rgba(148,163,184,0.08), transparent);
  border-radius: 1.1rem;
  border: 1px solid rgba(148,163,184,0.35);
  padding: 0.85rem 1rem;
}

.day-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.4rem;
}

.day-date {
  font-size: 0.92rem;
  font-weight: 600;
}

.day-date span {
  color: var(--muted);
  font-weight: 400;
  font-size: 0.82rem;
  margin-left: 0.35rem;
}

.day-count {
  font-size: 0.8rem;
  color: var(--muted);
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  background: rgba(255,255,255,0.05);
  backdrop-filter: blur(4px);
  border: 1px solid rgba(148,163,184,0.4);
}

.items {
  display: grid;
  grid-template-columns: minmax(0, 1.9fr) minmax(0, 1.6fr) minmax(0, 1.2fr);
  gap: 0.25rem 0.6rem;
  font-size: 0.78rem;
  align-items: center;
}

.item {
  display: contents;
}

.item-label {
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
}

.item-type {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.item-tag {
  padding: 0.15rem 0.48rem;
  border-radius: 999px;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  border: 1px solid;
}

.item-tag.new {
  border-color: rgba(59,130,246,0.9);
  background: rgba(59,130,246,0.16);
  color: var(--new);
}

.item-tag.review {
  border-color: rgba(250,204,21,0.9);
  background: rgba(250,204,21,0.16);
  color: var(--review);
}

.item-tag.mastered {
  border-color: rgba(34,197,94,0.95);
  background: rgba(34,197,94,0.18);
  color: var(--master);
}

.item-meta .mastered {
  color: var(--master);
  font-weight: 700;
  text-transform: uppercase;
}

.item-meta {
  text-align: right;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.empty {
  text-align: center;
  color: var(--muted);
  padding: 1.4rem 0.5rem 0.2rem;
  font-size: 0.9rem;
}

.file-input {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.file-button {
  flex: 0 0 220px;
  border-radius: 999px;
  padding: 0.45rem 0.9rem;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #d1d5db;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  transition: 0.2s ease;
}

.file-button:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.25);
  color: #f3f4f6;
}

.file-name {
  flex: 1;
  min-width: 0;
  font-size: 0.8rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.file-input-hidden {
  position: absolute;
  opacity: 0;
  pointer-events: none;
  width: 0;
  height: 0;
}

.config-message {
  margin-top: 8px;
  font-size: 14px;
  opacity: 0;
  transition: opacity 0.3s;
  min-height: 18px;
}

.config-success {
  color: #4CAF50;
}

.config-info {
  color: #2196F3; 
}

.config-error {
  color: #f44336;
}

.config-message.visible {
  opacity: 1;
}

.button-secondary {
  margin-top: 0.45rem;
  border-radius: 999px;
  padding: 0.55rem 1.1rem;
  font-size: 0.8rem;
  font-weight: 500;
  text-transform: uppercase;
  background: transparent;
  border: 1px solid #3a3d44;
  color: var(--muted);
  width: 100%;
}

.button-secondary:hover {
  border-color: #d1d5db;
  color: #d1d5db;
}

.actions-row {
  margin-top: 3rem;
  margin-bottom: 3rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.actions-row .button-primary,
.actions-row .button-secondary {
  width: 280px;
  max-width: 100%;
}

.today-panel {
  position: fixed;
  top: 5rem;
  right: 1.5rem;
  width: 260px;
  max-height: 80vh;
  padding: 1rem 1.2rem;
  background: var(--bg-card);
  border: 1px solid rgba(148,163,184,0.35);
  border-radius: 1.2rem;
  box-shadow: var(--shadow-soft);
  overflow-y: auto;
  z-index: 999;
}

.today-header {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 0.8rem;
  color: var(--text);
}

.today-item {
  padding: 0.55rem 0.4rem;
  border-bottom: 1px solid rgba(148,163,184,0.18);
  font-size: 0.82rem;
}

.today-item:last-child {
  border-bottom: none;
}

.today-item-title {
  font-weight: 600;
}

.today-item-tag {
  display: inline-block;
  margin-top: 0.25rem;
  padding: 0.15rem 0.45rem;
  font-size: 0.7rem;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.today-item-tag.new {
  background: rgba(59,130,246,0.18);
  color: var(--new);
}

.today-item-tag.review {
  background: rgba(250,204,21,0.18);
  color: var(--review);
}

.today-item-tag.master {
  background: rgba(34,197,94,0.18);
  color: var(--master);
}

.empty-today {
  color: var(--muted);
  font-size: 0.85rem;
  padding: 0.5rem 0;
  text-align: center;
}

select {
  background-color: #151820;
  color: #e5e7eb;
  border: 1px solid rgba(148,163,184,0.6);
}

select option {
  background-color: #151820;
  color: #e5e7eb;
}

select option:hover,
select option:focus,
select option:active {
    background-color: #3a3f4b !important;
    color: #ffffff !important;
}

::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: rgba(20,20,20,0.6);
  border-radius: 10px;
}

::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, #3a3a3a, #222);
  border-radius: 10px;
  border: 1px solid #111;
}

::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, #4a4a4a, #2a2a2a);
}

* {
  scrollbar-width: thin;
  scrollbar-color: #333 rgba(20,20,20,0.6);
}

::selection {
  background: rgba(180, 180, 180, 0.25);
  color: #fff;
}

::-moz-selection {
  background: rgba(180, 180, 180, 0.25);
  color: #fff;
}

.site-footer {
  margin-top: auto;
  padding: 20px 0;
  text-align: center;
  font-size: 0.9rem;
  color: #777;
  background-color: #0d0d0d;
  width: 100%;
}

.export-modal.hidden {
  display: none;
}

.export-modal {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
}

.export-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.25);
  backdrop-filter: blur(10px);
}

.export-modal-content {
  position: relative;
  background: rgba(25, 25, 25, 0.82);
  backdrop-filter: blur(12px);
  padding: 24px 28px;
  border-radius: 20px;
  color: #f1f1f1; /* texte blanc doux */
  box-shadow: 0 10px 30px rgba(0,0,0,0.35);
}

.export-modal-actions {
  display: flex;
  gap: 0.75rem;
  margin: 1rem 0;
  flex-wrap: wrap;
}

button#exportCancel {
  border: none;
  color: #666;
  background: transparent;
}

button#exportCancel:hover {
  text-decoration: underline;
}

@media (max-width: 720px) {
  .app { padding-inline: 0.8rem; }.controls {
    grid-template-columns: minmax(0, 1fr);
  }

  .items {
    grid-template-columns: minmax(0, 1.6fr) minmax(0, 1.6fr);
  }

  .item-meta {
    grid-column: 1 / -1;
    text-align: left;
  }

  .day-card {
    padding-inline: 0.8rem;
  }
}

@media (max-width: 900px) {
  .app {
    display: flex;
    flex-direction: column;
  }

  .controls {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .schedule {
    order: 2;
  }

  .summary, .controls {
    order: 0;
  }

  .app > .card:first-of-type {
    order: 0;
  }

  #todayPanel {
    order: 1;
    position: static;
    width: 100%;
    margin-block: 1rem;
  }

  .app > .card:nth-of-type(2) {
    order: 2;
  }
}

@media (max-width: 480px) {
  .controls {
    grid-template-columns: repeat(1, minmax(0, 1fr));
  }

  .file-input {
    flex-direction: column;
    align-items: flex-start;
  }

  .file-button {
    flex: 0 0 auto;
    width: 100%;
    max-width: 100%;
  }

  .file-name {
    white-space: normal;
    text-overflow: clip;
    overflow: visible;
  }

  .export-modal-content {
    width: 90%;
  }
}

.export-overlay {
  position: fixed;
  inset: 0;
  background: #0a0a0a;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.export-overlay.hidden {
  display: none;
}

.export-overlay .spinner {
  width: 48px;
  height: 48px;
  border-radius: 999px;
  border: 4px solid rgba(148,163,184,0.35);
  border-top-color: var(--accent2);
  animation: spin 0.8s linear infinite;
  margin-bottom: 0.75rem;
}

.export-overlay .export-text {
  font-size: 0.95rem;
  color: var(--accent);
}

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

body.pdf-export-mode {
  background: #ffffff !important;
}

body.pdf-export-mode .app {
  max-width: 100%;
  padding: 0;
  box-shadow: none;
}

body.pdf-export-mode .card:not(#planningCard),
body.pdf-export-mode #todayPanel {
  display: none !important;
}

body.pdf-export-mode #planningCard {
  margin-top: 0;
  border-radius: 0;
  border: none;
  background: #ffffff;
  color: #000000;
}

body.pdf-export-mode #schedule,
body.pdf-export-mode #planningCard,
body.pdf-export-mode #planningCard .schedule {
  max-height: none !important;
  height: auto !important;
  overflow: visible !important;
}

.day-card {
  page-break-inside: avoid;
  break-inside: avoid;
}

@media print {
  @page {
    margin: 10mm;
  }

  body {
    background: #ffffff !important;
  }

  .app {
    max-width: 100%;
    padding: 0;
    box-shadow: none;
  }

  .card:not(#planningCard),
  #todayPanel {
    display: none !important;
  }

  #planningCard {
    box-shadow: none;
    border-radius: 0;
    border: none;
    background: #ffffff;
    color: #000000;
  }

  .day-card {
    page-break-inside: avoid;
    margin-bottom: 0.8rem;
  }

  .actions-row,
  .chips,
  .summary-bar {
    display: none !important;
  }

  #schedule,
  #planningCard,
  #planningCard .schedule {
    max-height: none !important;
    height: auto !important;
    overflow: visible !important;
  }

  html, body {
    height: auto !important;
  }

  body {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
}

.app {
  opacity: 0;
  margin-top: 8px;
  transition: opacity 240ms ease, margin-top 240ms ease;
}

body.page-ready .app {
  opacity: 1;
  margin-top: 0;
}

body.page-leave .app {
  opacity: 0;
  margin-top: 8px;
}
