@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap");

:root {
  --bg0: #080b10;
  --panel: rgba(16, 20, 28, 0.78);
  --elev: #171c26;
  --ink: #eef2f7;
  --muted: #8a94a6;
  --line: rgba(255, 255, 255, 0.06);
  --line-strong: rgba(255, 255, 255, 0.1);
  --teal: #2dd4bf;
  --teal-dim: rgba(45, 212, 191, 0.15);
  --amber: #f5c542;
  --amber-dim: rgba(245, 197, 66, 0.14);
  --danger: #f07178;
  --danger-dim: rgba(240, 113, 120, 0.14);
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --font: "Inter", "SF Pro Text", system-ui, sans-serif;
  --r: 1.25rem;
  --r-sm: 0.75rem;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg0);
  -webkit-font-smoothing: antialiased;
  -webkit-user-select: none;
  user-select: none;
}

.rdv-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  background:
    radial-gradient(70% 50% at 15% 0%, rgba(45, 212, 191, 0.14), transparent 55%),
    radial-gradient(55% 40% at 90% 100%, rgba(245, 197, 66, 0.1), transparent 50%),
    #080b10;
}

.rdv-shell {
  position: relative;
  z-index: 1;
  max-width: 42rem;
  margin: 0 auto;
  padding: 1.25rem 0.9rem 5rem;
}

/* Brand strip outside card — quiet */
.rdv-brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.85rem;
  padding: 0 0.15rem;
}
.rdv-brand__name {
  margin: 0;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--muted);
}
.rdv-brand__name::before {
  content: "";
  display: inline-block;
  width: 0.4rem;
  height: 0.4rem;
  margin-right: 0.4rem;
  border-radius: 50%;
  background: var(--teal);
  box-shadow: 0 0 10px rgba(45, 212, 191, 0.5);
  vertical-align: 0.05em;
}
.rdv-brand__tag { display: none; }

.rdv-card {
  background: var(--panel);
  backdrop-filter: blur(20px) saturate(1.2);
  -webkit-backdrop-filter: blur(20px) saturate(1.2);
  border: 1px solid var(--line-strong);
  border-radius: var(--r);
  padding: 0.85rem 0.85rem 0.95rem;
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.03) inset,
    0 28px 70px rgba(0, 0, 0, 0.5);
  animation: rdv-enter 260ms var(--ease-out) both;
}
@keyframes rdv-enter {
  from { opacity: 0; transform: translateY(8px) scale(0.985); }
  to { opacity: 1; transform: none; }
}

/* App toolbar inside card */
.rdv-topbar {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-wrap: wrap;
  margin: 0 0 0.95rem;
  padding: 0.35rem 0.4rem 0.85rem;
  border-bottom: 1px solid var(--line);
}
.rdv-topbar__left {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
  flex: 1;
}
.rdv-topbar__dot {
  width: 0.45rem;
  height: 0.45rem;
  border-radius: 50%;
  background: var(--teal);
  box-shadow: 0 0 12px rgba(45, 212, 191, 0.55);
  flex-shrink: 0;
}
.rdv-topbar__title {
  font-size: 0.98rem;
  font-weight: 650;
  letter-spacing: -0.025em;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.rdv-topbar__job {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--muted);
  padding: 0.28rem 0.65rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rdv-meta {
  display: grid;
  gap: 0.65rem;
  margin-bottom: 0.85rem;
}
.rdv-meta--readonly {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem;
}
.rdv-meta__row { display: grid; gap: 0.35rem; }
.rdv-field-label {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--muted);
  letter-spacing: 0;
  text-transform: none;
}
.rdv-field-hint {
  font-style: normal;
  font-weight: 400;
  opacity: 0.75;
  font-size: 0.7rem;
}
.rdv-meta .rdv-field[hidden] {
  display: none !important;
}
.rdv-meta .rdv-field {
  display: grid;
  gap: 0.35rem;
}
.rdv-scope-note {
  margin: 0;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--muted);
  line-height: 1.35;
}

.rdv-meta textarea,
.rdv-meta input#rdvVisio {
  font: inherit;
  color: var(--ink);
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  padding: 0.6rem 0.95rem;
  background: rgba(0, 0, 0, 0.28);
  font-weight: 500;
  font-size: 0.88rem;
  min-height: 0;
  height: 2.5rem;
  resize: none;
  -webkit-user-select: text;
  user-select: text;
  transition: border-color 150ms var(--ease-out), box-shadow 150ms var(--ease-out);
  width: 100%;
  box-sizing: border-box;
}
.rdv-meta textarea:focus,
.rdv-meta input#rdvVisio:focus {
  outline: none;
  border-color: rgba(45, 212, 191, 0.45);
  box-shadow: 0 0 0 3px var(--teal-dim);
}

.rdv-mode {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.25rem;
  padding: 0.2rem;
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid var(--line);
  border-radius: 999px;
}
.rdv-mode button {
  border: none;
  background: transparent;
  border-radius: 999px;
  padding: 0.5rem 0.7rem;
  font: inherit;
  font-weight: 600;
  font-size: 0.84rem;
  cursor: pointer;
  color: var(--muted);
  transition: background 140ms var(--ease-out), color 140ms var(--ease-out), transform 110ms var(--ease-out), box-shadow 140ms var(--ease-out);
}
.rdv-mode button.is-on {
  background: var(--elev);
  color: #fff;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.06) inset, 0 4px 12px rgba(0, 0, 0, 0.25);
}
.rdv-mode button:active { transform: scale(0.97); }

/* Compact tool row — like modern app chrome */
.rdv-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem;
  margin: 0 0 0.75rem;
}

.rdv-brush {
  display: inline-grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.2rem;
  padding: 0.18rem;
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid var(--line);
  border-radius: 999px;
}
.rdv-brush button {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  border: none;
  background: transparent;
  border-radius: 999px;
  padding: 0.42rem 0.75rem;
  font: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  color: var(--muted);
  white-space: nowrap;
  transition: background 140ms var(--ease-out), color 140ms var(--ease-out), transform 110ms var(--ease-out), box-shadow 140ms var(--ease-out);
}
.rdv-brush button:active { transform: scale(0.97); }
.rdv-brush button.is-on {
  background: var(--elev);
  color: #fff;
  box-shadow: 0 0 0 1px var(--line-strong), 0 0 18px rgba(45, 212, 191, 0.12);
}
.rdv-brush button.is-on[data-brush="available"] {
  box-shadow: 0 0 0 1px rgba(45, 212, 191, 0.35), 0 0 20px rgba(45, 212, 191, 0.18);
}
.rdv-brush button.is-on[data-brush="unavailable"] {
  box-shadow: 0 0 0 1px rgba(240, 113, 120, 0.35), 0 0 18px rgba(240, 113, 120, 0.12);
}

.rdv-dot {
  width: 0.45rem;
  height: 0.45rem;
  border-radius: 50%;
  display: inline-block;
}
.rdv-dot--free { background: var(--teal); box-shadow: 0 0 8px rgba(45, 212, 191, 0.6); }
.rdv-dot--busy { background: var(--danger); box-shadow: 0 0 8px rgba(240, 113, 120, 0.45); }

.rdv-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin: 0;
}
.rdv-presets button {
  border: 1px solid var(--line-strong);
  background: rgba(255, 255, 255, 0.03);
  border-radius: 999px;
  padding: 0.4rem 0.7rem;
  font-size: 0.74rem;
  font-weight: 600;
  cursor: pointer;
  color: var(--ink);
  transition: transform 110ms var(--ease-out), background 140ms var(--ease-out), border-color 140ms var(--ease-out);
}
.rdv-presets button:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.16);
}
.rdv-presets button.is-ghost { color: var(--muted); }
.rdv-presets button:active { transform: scale(0.97); }

.rdv-cal-wrap {
  overflow-x: auto;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  background: rgba(0, 0, 0, 0.22);
  touch-action: none;
}
.rdv-cal {
  display: grid;
  grid-template-columns: 2.4rem repeat(var(--rdv-days, 5), minmax(3.9rem, 1fr));
  min-width: 24rem;
}
.rdv-cal__corner,
.rdv-cal__day,
.rdv-cal__hour,
.rdv-cal__cell {
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.rdv-cal__corner {
  position: sticky;
  left: 0;
  background: #10141c;
  z-index: 2;
}
.rdv-cal__day {
  padding: 0.5rem 0.1rem;
  text-align: center;
  font-size: 0.65rem;
  font-weight: 650;
  background: #10141c;
  line-height: 1.2;
  color: #c8d0dc;
  letter-spacing: -0.01em;
}
.rdv-cal__day small {
  display: block;
  margin-top: 0.12rem;
  font-weight: 500;
  color: var(--muted);
  text-transform: capitalize;
}
.rdv-cal__hour {
  position: sticky;
  left: 0;
  z-index: 1;
  padding: 0.25rem 0.28rem;
  font-size: 0.6rem;
  font-weight: 600;
  color: var(--muted);
  text-align: right;
  background: #0c1016;
  font-variant-numeric: tabular-nums;
}
.rdv-cal__cell {
  min-height: 2rem;
  cursor: crosshair;
  background: transparent;
  transition: background 40ms linear, box-shadow 40ms linear;
}
.rdv-cal__cell:hover { background: rgba(255, 255, 255, 0.03); }
.rdv-dot--gold {
  background: linear-gradient(135deg, #f5d76e, #c9a227);
  box-shadow: 0 0 10px rgba(245, 197, 66, 0.65);
}
.rdv-legend-inline {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin-left: auto;
  font-size: 0.72rem;
  font-weight: 600;
  color: #e8d48b;
}

.rdv-weeknav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin: 0 0 0.55rem;
  padding: 0.15rem 0.1rem;
}
.rdv-weeknav__label {
  flex: 1;
  text-align: center;
  font-size: 0.8rem;
  font-weight: 650;
  letter-spacing: -0.02em;
  color: #d5dde8;
  text-transform: capitalize;
}
.rdv-weeknav__btn {
  width: 2rem;
  height: 2rem;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: rgba(255, 255, 255, 0.04);
  color: var(--ink);
  font-size: 1.15rem;
  line-height: 1;
  cursor: pointer;
  transition: transform 110ms var(--ease-out), background 140ms var(--ease-out), border-color 140ms var(--ease-out);
}
.rdv-weeknav__btn:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.18);
}
.rdv-weeknav__btn:active:not(:disabled) { transform: scale(0.95); }
.rdv-weeknav__btn:disabled {
  opacity: 0.35;
  cursor: default;
}

.rdv-cal__cell.is-past {
  opacity: 0.35;
  cursor: not-allowed;
  pointer-events: none;
}
.rdv-cal__cell.is-available {
  background: var(--teal-dim);
  box-shadow: inset 0 0 0 1px rgba(45, 212, 191, 0.4), 0 0 12px rgba(45, 212, 191, 0.1);
}
.rdv-cal__cell.is-unavailable {
  background: repeating-linear-gradient(
    -45deg,
    var(--danger-dim),
    var(--danger-dim) 3px,
    transparent 3px,
    transparent 7px
  );
  box-shadow: inset 0 0 0 1px rgba(240, 113, 120, 0.28);
}
/* Commun = doré (prioritaire sur le teal dispo) */
.rdv-cal__cell.is-common,
.rdv-cal__cell.is-available.is-common {
  background: linear-gradient(160deg, rgba(245, 215, 110, 0.42), rgba(201, 162, 39, 0.28));
  box-shadow:
    inset 0 0 0 1.5px rgba(245, 197, 66, 0.85),
    0 0 18px rgba(245, 197, 66, 0.35);
  outline: none;
  z-index: 1;
}
.rdv-cal__cell:active { filter: brightness(1.1); }

.rdv-live-hint.is-live {
  color: var(--teal);
}
.rdv-live-hint.is-live::before {
  content: "";
  display: inline-block;
  width: 0.4rem;
  height: 0.4rem;
  margin-right: 0.4rem;
  border-radius: 50%;
  background: var(--teal);
  box-shadow: 0 0 8px rgba(45, 212, 191, 0.7);
  vertical-align: 0.05em;
  animation: rdv-pulse 1.6s var(--ease-out) infinite;
}
@keyframes rdv-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

.rdv-dock {
  position: sticky;
  bottom: 0.55rem;
  margin-top: 0.85rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.4rem 0.4rem 0.85rem;
  background: rgba(10, 13, 18, 0.88);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.45);
}
.rdv-dock .hint {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 500;
  flex: 1;
  min-width: 0;
}
.rdv-dock button.primary {
  background: var(--teal);
  color: #041410;
  border: none;
  border-radius: 999px;
  padding: 0.65rem 1.15rem;
  font: inherit;
  font-weight: 700;
  font-size: 0.86rem;
  letter-spacing: -0.01em;
  cursor: pointer;
  box-shadow: 0 0 28px rgba(45, 212, 191, 0.35);
  transition: transform 110ms var(--ease-out), filter 140ms var(--ease-out), box-shadow 140ms var(--ease-out);
}
.rdv-dock button.primary:hover {
  filter: brightness(1.05);
  box-shadow: 0 0 36px rgba(45, 212, 191, 0.45);
}
.rdv-dock button.primary:active { transform: scale(0.97); }
.rdv-dock button.primary:disabled { opacity: 0.5; cursor: wait; box-shadow: none; }

.rdv-status {
  margin: 0 0 0.85rem;
  padding: 0.65rem 0.85rem;
  border-radius: var(--r-sm);
  background: var(--teal-dim);
  color: var(--teal);
  font-weight: 600;
  font-size: 0.88rem;
  border: 1px solid rgba(45, 212, 191, 0.3);
}
.rdv-error { color: var(--danger); margin: 0; font-weight: 600; }
.rdv-loading { color: var(--muted); margin: 0; font-weight: 500; padding: 0.5rem; }

/* Legacy unused */
.rdv-legend { display: none; }
.rdv-card h1,
.rdv-card .lead { display: none; }

@media (prefers-reduced-motion: reduce) {
  .rdv-card { animation: none; }
  .rdv-mode button,
  .rdv-brush button,
  .rdv-presets button,
  .rdv-dock button.primary { transition: none !important; }
  .rdv-mode button:active,
  .rdv-brush button:active,
  .rdv-presets button:active,
  .rdv-dock button.primary:active { transform: none; }
}

@media (max-width: 560px) {
  .rdv-shell { padding: 0.85rem 0.6rem 4.5rem; }
  .rdv-card { padding: 0.7rem; border-radius: 1rem; }
  .rdv-cal { min-width: 21rem; }
  .rdv-cal__cell { min-height: 1.85rem; }
  .rdv-tools { flex-direction: column; align-items: stretch; }
  .rdv-brush { display: grid; width: 100%; }
  .rdv-presets { justify-content: flex-start; }
}
