/* nDatePicker widget styles (Blazor). Scoped under .ndp-root; theme via CSS custom properties.
   Ported from the JS implementation so both controls look identical. */
.ndp-root {
  --ndp-bg: #ffffff; --ndp-fg: #1d2530; --ndp-muted: #6b7686; --ndp-border: #d4dae3;
  --ndp-accent: #2f6fed; --ndp-accent-soft: #e7f0ff; --ndp-today: #2f6fed;
  --ndp-sheet: #ffffff; --ndp-invalid: #d6453d;
  --ndp-radius: 10px; --ndp-shadow: 0 12px 32px rgba(20,32,52,.14), 0 2px 6px rgba(20,32,52,.08);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  position: relative; display: inline-block;
}
@media (prefers-color-scheme: dark) {
  .ndp-root:not([data-theme="light"]) {
    --ndp-bg: #1b1f27; --ndp-fg: #e8edf4; --ndp-muted: #98a2b3; --ndp-border: #333a47;
    --ndp-accent: #5b8dff; --ndp-accent-soft: #21304e; --ndp-sheet: #1b1f27;
    --ndp-shadow: 0 12px 32px rgba(0,0,0,.5);
  }
}
.ndp-root[data-theme="dark"] {
  --ndp-bg: #1b1f27; --ndp-fg: #e8edf4; --ndp-muted: #98a2b3; --ndp-border: #333a47;
  --ndp-accent: #5b8dff; --ndp-accent-soft: #21304e; --ndp-sheet: #1b1f27;
  --ndp-shadow: 0 12px 32px rgba(0,0,0,.5);
}
.ndp-root *, .ndp-root *::before, .ndp-root *::after { box-sizing: border-box; }

.ndp-field {
  display: flex; align-items: center; gap: 8px; background: var(--ndp-bg);
  border: 1px solid var(--ndp-border); border-radius: var(--ndp-radius);
  padding: 0 8px 0 12px; min-height: 44px; transition: border-color .15s, box-shadow .15s;
}
.ndp-root.ndp-focus .ndp-field { border-color: var(--ndp-accent); box-shadow: 0 0 0 3px var(--ndp-accent-soft); }
.ndp-root.ndp-invalid .ndp-field { border-color: var(--ndp-invalid); box-shadow: 0 0 0 3px rgba(214,69,61,.15); }
.ndp-input { flex: 1; border: 0; outline: 0; background: transparent; color: var(--ndp-fg); font-size: 15px; min-width: 0; height: 42px; }
.ndp-toggle { border: 0; background: transparent; cursor: pointer; color: var(--ndp-muted); padding: 8px; border-radius: 8px; display: grid; place-items: center; }
.ndp-toggle:hover { background: var(--ndp-accent-soft); color: var(--ndp-accent); }
.ndp-preview { font-size: 12.5px; margin-top: 6px; min-height: 17px; color: var(--ndp-muted); }
.ndp-preview b { color: var(--ndp-accent); font-weight: 600; }
.ndp-root.ndp-invalid .ndp-preview b { color: var(--ndp-invalid); }

.ndp-backdrop { display: none; }
.ndp-panel {
  position: absolute; top: calc(100% + 8px); left: 0; z-index: 1000; display: none;
  background: var(--ndp-bg); border: 1px solid var(--ndp-border); border-radius: 14px;
  box-shadow: var(--ndp-shadow); padding: 14px;
}
.ndp-root.ndp-open .ndp-panel { display: flex; gap: 12px; }
.ndp-body { width: 280px; }
.ndp-tabs, .ndp-grab, .ndp-foot, .ndp-sheet-head { display: none; }

/* ── embed (unstyled) mode: behaviour-only, host input keeps its own styling ── */
.ndp-root.ndp-unstyled { display: contents; }
.ndp-root.ndp-unstyled .ndp-toggle { position: absolute; z-index: 5; padding: 4px; }
/* panel position is set inline (relative to the host input) by the JS positionOverlay() glue */

/* calendar */
.ndp-cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.ndp-title { border: 0; background: transparent; color: var(--ndp-fg); cursor: pointer; font: inherit; font-weight: 600; font-size: 14px; padding: 4px 8px; border-radius: 8px; }
.ndp-title:hover { background: var(--ndp-accent-soft); color: var(--ndp-accent); }
.ndp-nav { display: flex; gap: 4px; }
.ndp-nav button { border: 0; background: transparent; color: var(--ndp-fg); cursor: pointer; width: 32px; height: 32px; border-radius: 8px; font-size: 17px; display: grid; place-items: center; }
.ndp-nav button:hover { background: var(--ndp-accent-soft); color: var(--ndp-accent); }
.ndp-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.ndp-dow { text-align: center; font-size: 11px; color: var(--ndp-muted); padding: 4px 0; font-weight: 600; }
.ndp-day { border: 0; background: transparent; color: var(--ndp-fg); cursor: pointer; min-height: 38px; border-radius: 8px; font-size: 13px; }
.ndp-day:hover { background: var(--ndp-accent-soft); }
.ndp-day.ndp-out { color: var(--ndp-muted); opacity: .5; }
.ndp-day.ndp-today { box-shadow: inset 0 0 0 1.5px var(--ndp-today); font-weight: 600; }
.ndp-day.ndp-selected { background: var(--ndp-accent); color: #fff; font-weight: 600; }
.ndp-day.ndp-focused { outline: 2px solid var(--ndp-accent); outline-offset: -2px; }
.ndp-day:disabled { color: var(--ndp-muted); opacity: .3; cursor: default; }
.ndp-cells { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.ndp-cell { border: 0; background: transparent; color: var(--ndp-fg); cursor: pointer; padding: 14px 0; border-radius: 8px; font-size: 13px; font-variant-numeric: tabular-nums; }
.ndp-cell:hover { background: var(--ndp-accent-soft); }
.ndp-cell.ndp-today { box-shadow: inset 0 0 0 1.5px var(--ndp-today); font-weight: 600; }
.ndp-cell.ndp-selected { background: var(--ndp-accent); color: #fff; font-weight: 600; }
.ndp-cell:disabled { color: var(--ndp-muted); opacity: .3; cursor: default; }
.ndp-cal-foot { display: flex; justify-content: space-between; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--ndp-border); }
.ndp-link { border: 0; background: transparent; cursor: pointer; font: inherit; font-size: 13px; color: var(--ndp-accent); font-weight: 600; padding: 4px 8px; border-radius: 8px; }
.ndp-link:hover { background: var(--ndp-accent-soft); }

/* time column */
.ndp-time { width: 150px; border-left: 1px solid var(--ndp-border); padding-left: 12px; display: flex; flex-direction: column; }
.ndp-time-title { font-size: 12px; font-weight: 600; color: var(--ndp-muted); margin-bottom: 8px; text-transform: uppercase; letter-spacing: .04em; }
.ndp-time-lists { display: flex; gap: 6px; flex: 1; min-height: 0; }
.ndp-scroll { flex: 1; overflow-y: auto; max-height: 232px; border: 1px solid var(--ndp-border); border-radius: 8px; padding: 4px; scrollbar-width: thin; }
.ndp-scroll button { display: block; width: 100%; border: 0; background: transparent; color: var(--ndp-fg); cursor: pointer; padding: 6px 0; border-radius: 6px; font-size: 13px; font-variant-numeric: tabular-nums; }
.ndp-scroll button:hover { background: var(--ndp-accent-soft); }
.ndp-scroll button.ndp-sel { background: var(--ndp-accent); color: #fff; font-weight: 600; }
.ndp-now { margin-top: 8px; border: 1px solid var(--ndp-border); background: transparent; color: var(--ndp-accent); font: inherit; font-weight: 600; border-radius: 8px; padding: 7px 0; cursor: pointer; font-size: 13px; }
.ndp-now:hover { background: var(--ndp-accent-soft); }

@media (prefers-reduced-motion: no-preference) {
  .ndp-sheet-mode .ndp-panel { transition: transform .25s cubic-bezier(.2,.8,.2,1); }
}

/* ── mobile: bottom sheet ── */
@media (max-width: 540px) {
  .ndp-root.ndp-sheet-mode .ndp-backdrop {
    display: block; position: fixed; inset: 0; z-index: 999; background: rgba(10,16,28,.45);
    opacity: 0; visibility: hidden; transition: opacity .2s;
  }
  .ndp-root.ndp-sheet-mode.ndp-open .ndp-backdrop { opacity: 1; visibility: visible; }
  .ndp-root.ndp-sheet-mode .ndp-panel {
    position: fixed; left: 0; right: 0; bottom: 0; top: auto; width: 100%;
    flex-direction: column; gap: 0; border: 0; border-radius: 22px 22px 0 0;
    padding: 8px 16px calc(18px + env(safe-area-inset-bottom)); max-height: 90vh; overflow: auto;
    transform: translateY(100%);
  }
  .ndp-root.ndp-sheet-mode.ndp-open .ndp-panel { display: flex; transform: translateY(0); }
  .ndp-grab { display: block; cursor: grab; touch-action: none; padding-bottom: 4px; }
  .ndp-grab:active { cursor: grabbing; }
  .ndp-handle { width: 40px; height: 5px; border-radius: 99px; background: var(--ndp-border); margin: 6px auto 12px; }
  .ndp-grab:active .ndp-handle { background: var(--ndp-muted); }
  .ndp-sheet-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
  .ndp-sheet-sel { font-size: 13px; color: var(--ndp-muted); }
  .ndp-sheet-sel b { color: var(--ndp-fg); }
  .ndp-close { border: 0; background: transparent; color: var(--ndp-muted); font-size: 20px; cursor: pointer; padding: 4px 8px; border-radius: 8px; }
  .ndp-tabs { display: flex; background: var(--ndp-accent-soft); border-radius: 12px; padding: 4px; margin-bottom: 14px; }
  .ndp-tabs button { flex: 1; border: 0; background: transparent; color: var(--ndp-muted); font: inherit; font-weight: 600; font-size: 14px; padding: 9px 0; border-radius: 9px; cursor: pointer; }
  .ndp-tabs button[aria-selected="true"] { background: var(--ndp-bg); color: var(--ndp-fg); box-shadow: 0 1px 3px rgba(0,0,0,.12); }
  .ndp-body { width: 100%; }
  .ndp-day { min-height: 44px; font-size: 15px; }
  .ndp-cell { padding: 18px 0; font-size: 15px; }
  /* tabbed panes on mobile */
  .ndp-panel[data-tab="date"] .ndp-time { display: none; }
  .ndp-panel[data-tab="time"] .ndp-body { display: none; }
  .ndp-time { width: 100%; border-left: 0; padding-left: 0; }
  .ndp-foot { display: flex; align-items: center; gap: 10px; margin-top: 16px; }
  .ndp-done { flex: 1; border: 0; background: var(--ndp-accent); color: #fff; font: inherit; font-weight: 700; font-size: 15px; padding: 14px 0; border-radius: 12px; cursor: pointer; }
  .ndp-cal-foot { display: none; }
}
