*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

.admin-program-note {
  font-size: 13px;
  color: #374151;
  background: #fff7ed;
  border-left: 4px solid #f97316;
  padding: 8px 12px;
  border-radius: 8px;
  margin-bottom: 10px;
}

.admin-program-label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  margin-bottom: 6px;
}

.admin-program-feedback {
  font-size: 13px;
  margin-top: 6px;
  color: #475569;
}
.admin-program-feedback.ok {
  color: #065f46; /* green */
}
.admin-program-feedback.error {
  color: #b91c1c; /* red */
}

/* QR modal styles */
.qr-modal-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(15,23,42,0.5);
  z-index: 99999;
}
.qr-modal {
  background: white;
  border-radius: 12px;
  padding: 16px;
  max-width: 540px;
  width: min(92vw, 540px);
  box-shadow: 0 20px 60px rgba(2,6,23,0.6);
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: center;
}
.qr-modal .qr-content img { max-width: 100%; height: auto; display: block; }
.qr-modal .qr-actions { display:flex; gap:8px; }
.qr-modal .qr-close { position: absolute; right: 14px; top: 10px; border:none; background:transparent; font-size:18px; cursor:pointer; }
.qr-modal .qr-download-btn { text-decoration:none; }

:root {
  --bg: #f5f5f7;
  --card-bg: #ffffff;
  --primary: #111827;
  --muted: #6b7280;
  --accent: #f97316;
  --green: #22c55e;
  --red: #ef4444;
  --border-soft: #e5e7eb;
  --radius-lg: 14px;
  --radius-pill: 999px;
  --shadow-soft: 0 10px 30px rgba(15, 23, 42, 0.06);
  --font-main: system-ui, -apple-system, BlinkMacSystemFont, "SF Pro Text",
    "Segoe UI", sans-serif;
}

html,
body {
  height: 100%;
}

body {
  font-family: var(--font-main);
  background: radial-gradient(circle at top left, #e0f2fe 0, #f5f5f7 40%, #f9fafb 100%);
  color: var(--primary);
  display: flex;
  flex-direction: column;
  padding: 16px;
}

.app-header {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 18px;
}

.header-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.app-kicker {
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #4b5563;
  margin-bottom: 3px;
}

.app-title {
  font-size: 22px;
  line-height: 1.1;
}

.profile-meta {
  margin-top: 4px;
  font-size: 13px;
  color: var(--muted);
}

.admin-toggle {
  border: 1px solid #cbd5e1;
  background: #ffffff;
  color: #1f2937;
  border-radius: var(--radius-pill);
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.08);
  transition: background 0.2s ease, transform 0.1s ease;
}

.admin-toggle:hover {
  background: #f8fafc;
  transform: translateY(-1px);
}

.admin-toggle:active {
  transform: translateY(0);
}

.calendar-scroll {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 8px 4px;
  -webkit-overflow-scrolling: touch;
}

.day-card {
  position: relative;
  border: 1px solid transparent;
  background: rgba(255, 255, 255, 0.9);
  border-radius: var(--radius-pill);
  padding: 6px 12px;
  min-width: 60px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.08);
  transition:
    background 0.2s ease,
    transform 0.1s ease,
    box-shadow 0.2s ease,
    border-color 0.2s ease;
}

.day-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.12);
}

.day-card:active {
  transform: translateY(0);
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.06);
}

.day-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.day-number {
  font-size: 16px;
  font-weight: 600;
}

.day-card.active {
  background: #0f172a;
  color: #f9fafb;
  border-color: #020617;
}

.day-card.active .day-label {
  color: #e5e7eb;
}

.day-card.past {
  opacity: 0.9;
}

.event-count {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: var(--radius-pill);
  background: var(--accent);
  color: #fff7ed;
  font-size: 10px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  box-shadow: 0 4px 10px rgba(249, 115, 22, 0.35);
}

.day-card.active .event-count {
  background: #f59e0b;
  color: #1f2937;
}

.dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  margin-top: 2px;
}

.dot.green {
  background: var(--green);
}

.dot.red {
  background: var(--red);
}

.dot.orange {
  background: var(--accent);
}

.task-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.tile {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  padding: 12px 14px;
  box-shadow: var(--shadow-soft);
  border: 1px solid var(--border-soft);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.tile-main {
  display: flex;
  align-items: center;
  gap: 10px;
}

.tile-img {
  width: 32px;
  height: 32px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f3f4f6;
  font-size: 18px;
}

.tile-content h3 {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 2px;
}

.tile-content p {
  font-size: 13px;
  color: var(--muted);
}

.status-badge {
  margin-left: auto;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 4px 8px;
  border-radius: var(--radius-pill);
  background: #fef3c7;
  color: #92400e;
}

.tile-action {
  align-self: flex-start;
  padding: 6px 12px;
  border-radius: var(--radius-pill);
  border: none;
  background: #0f172a;
  color: #f9fafb;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition:
    background 0.2s ease,
    transform 0.1s ease,
    box-shadow 0.2s ease;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.25);
}

.tile-action:hover {
  background: #111827;
  transform: translateY(-1px);
}

.tile-action:active {
  transform: translateY(0);
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.2);
}

/* Disabled action appearance */
.tile-action[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
  background: #e5e7eb !important;
  color: #6b7280 !important;
  box-shadow: none !important;
}

.tile-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.tile-action-secondary {
  background: #e5e7eb;
  color: #1f2937;
  box-shadow: none;
}

.tile-action-secondary:hover {
  background: #d1d5db;
}

.tile-action-secondary:active {
  box-shadow: none;
}

.tile-note {
  font-size: 12px;
  color: var(--muted);
}

.admin-panel {
  position: fixed;
  inset: 0;
  display: none;
  justify-content: flex-end;
  background: rgba(15, 23, 42, 0.35);
  padding: 14px;
  z-index: 30;
}

.admin-panel.open {
  display: flex;
}

.admin-panel-inner {
  width: min(420px, 100%);
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 18px;
  box-shadow: 0 16px 40px rgba(15, 23, 42, 0.2);
  padding: 14px;
  height: fit-content;
}

.admin-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.admin-header h2 {
  font-size: 17px;
}

.admin-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.admin-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* Install button is hidden by default and shown when the browser fires beforeinstallprompt */
#install-app-button,
.install-button {
  display: none;
}

.status-done {
  border-color: rgba(34, 197, 94, 0.2);
}

.status-done .tile-img {
  background: rgba(34, 197, 94, 0.08);
}

.status-today {
  border-color: rgba(249, 115, 22, 0.25);
}

.status-locked {
  /* no global dimming for locked status; presentation handled in .tile.status-locked */
}

.tile-extra {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 4px;
}

.field span {
  display: block;
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
  margin-bottom: 3px;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  font-family: inherit;
  font-size: 13px;
  border-radius: 10px;
  border: 1px solid var(--border-soft);
  padding: 6px 8px;
  outline: none;
  resize: vertical;
  background: #f9fafb;
  transition:
    border-color 0.2s ease,
    box-shadow 0.2s ease,
    background 0.2s ease;
}

.date-input-row {
  display: flex;
  gap: 8px;
  align-items: center;
}
/* kept date-input-row for layout when needed */

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: #0f172a;
  background: #ffffff;
  box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.1);
}

/* Splashscreen */
#splash {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #24303a; /* adapter selon thème */
  z-index: 9999;
  transition: opacity .4s ease, visibility .4s;
}
#splash.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}
#splash img {
  max-width: 60%;
  height: auto;
  filter: drop-shadow(0 8px 20px rgba(0,0,0,.4));
  animation: splash-entrance 1s cubic-bezier(.2,.8,.2,1);
}
@keyframes splash-entrance {
  from { transform: scale(.95); opacity: 0; }
  to   { transform: scale(1);   opacity: 1; }
}

@media (max-width: 640px) {
  .header-top {
    align-items: stretch;
    flex-direction: column;
  }

  .admin-toggle {
    width: fit-content;
  }
}

/* Locked tasks: presentation only (informational) */
.tile.status-locked {
  /* Visually aligned with 'today' tiles but with a distinct background and typography
     Keep controls hidden (informational) while matching the emphasis of today's tasks. */
  background: linear-gradient(180deg, #fffaf0 0%, #fff7ed 100%);
  border-radius: var(--radius-lg);
  border: 1px solid rgba(249,115,22,0.12);
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.04);
  cursor: default;
}

.tile.status-locked .tile-img {
  background: rgba(249,115,22,0.06);
  opacity: 1;
}

.tile.status-locked .tile-img img.status-logo {
  max-width: 56px;
  max-height: 56px;
  display: block;
}

/* Hide any interactive controls when a task is locked (visual-only) */
.tile.status-locked .tile-actions,
.tile.status-locked .tile-extra,
.tile.status-locked .tile-action,
.tile.status-locked textarea,
.tile.status-locked select {
  display: none !important;
}

.tile.status-locked .tile-content h3 {
  color: #92400e; /* warmer emphasis matching the background */
  font-weight: 700;
}

.tile.status-locked .tile-content p {
  color: #475569; /* slightly stronger than muted for readability */
  font-weight: 500;
}

/* Future tasks: cannot be modified; visual cue but not using locked styles */
.tile.status-future {
  background: linear-gradient(180deg, #ffffff 0%, #fcfcfd 100%);
  border-color: rgba(15,23,42,0.04);
  cursor: default;
}

.tile.status-future .tile-actions,
.tile.status-future .tile-extra,
.tile.status-future .tile-action,
.tile.status-future textarea,
.tile.status-future select {
  display: none !important;
}

.tile.status-future .tile-content p {
  color: #6b7280;
}

.admin-program-note {
  font-size: 13px;
  color: #374151;
  background: #fff7ed;
  border-left: 4px solid #f97316;
  padding: 8px 12px;
  border-radius: 8px;
  margin-bottom: 10px;
}
