/* ── Time Picker Component ─────────────────────────────────────────────────── */

/* Hide native inputs until JS transforms them into custom components */
.time-picker > input[type="time"] {
  display: none;
}

/* Shadow used by the expanded popup (card reuses --shadow from the system) */
:root {
  --tp-shadow-lg:
    0 8px 32px rgba(0, 0, 0, 0.14),
    0 2px 8px rgba(0, 0, 0, 0.08);
}

@media (prefers-color-scheme: dark) {
  :root {
    --tp-shadow-lg:
      0 8px 40px rgba(0, 0, 0, 0.55),
      0 2px 8px rgba(0, 0, 0, 0.40);
  }
}

/* Container */
.time-pickers-container {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;

  gap: 1rem;

  align-items: center;
  justify-content: center;

  opacity: 0; /* Hidden until JS initializes components */
  transition: opacity 0.4s ease;
}



/* ── Overlay ───────────────────────────────────────────────────────────────── */

.tp-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  opacity: 0;
  pointer-events: none;
  display: none;
  z-index: 1100;
  transition: opacity 0.35s ease;
}

.tp-overlay--active {
  opacity: 1;
  pointer-events: auto;
  display: block;
}

/* Samsung Internet: no backdrop-filter */
.samsung .tp-overlay--active {
  background: rgba(0, 0, 0, 0.55);
}

/* ── Card (collapsed state) ────────────────────────────────────────────────── */

.tp-card {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0.75rem;

  width: 100%;
  padding: 0.75rem 1rem;
  border-radius: 18px;

  background: var(--background-color-secondary);
  border: 1.5px solid color-mix(in srgb, var(--text-color-accent) 20%, transparent);
  color: var(--text-color-primary);

  box-shadow:
    inset 1px 1px 0 rgba(255, 255, 255, 0.3),
    inset -1px -1px 0 rgba(255, 255, 255, 0.1),
    var(--shadow);

  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  font-family: "Nunito", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

  transition:
    scale 0.2s cubic-bezier(0.34, 1.56, 0.64, 1),
    box-shadow 0.2s ease,
    background 0.2s ease;

  touch-action: manipulation;
}

@media (hover: hover) {
  .tp-card:hover {
    scale: 1.02;
    background: color-mix(in srgb, var(--text-color-accent) 8%, var(--background-color-secondary));
    box-shadow:
      inset 1px 1px 0 rgba(255, 255, 255, 0.3),
      inset -1px -1px 0 rgba(255, 255, 255, 0.1),
      0 4px 20px color-mix(in srgb, var(--text-color-accent) 20%, transparent),
      var(--shadow);
  }
}

.tp-card:active {
  scale: 0.97;
}

@media (min-width: 52rem) {
  .tp-card {
    display: none;
  }
}

.tp-popup__header {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
  width: 100%;
}

.tp-popup__header-text {
  display: flex;
  flex-direction: column;
  text-align: start;
}

.tp-popup__switch {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0.3rem;
  flex-shrink: 0;
  padding: 0.35rem 0.65rem;
  border-radius: 999px;
  border: none;
  cursor: pointer;
  font-family: "Nunito", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  background: color-mix(in srgb, var(--text-color-accent) 14%, transparent);
  color: var(--text-color-accent);
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  transition: background 0.15s ease, scale 0.15s ease;
}

.tp-popup__switch .material-symbols-outlined {
  font-size: 16px !important;
}

@media (hover: hover) {
  .tp-popup__switch:hover {
    background: color-mix(in srgb, var(--text-color-accent) 22%, transparent);
  }
}

.tp-popup__switch:active {
  scale: 0.94;
}

/* Hidden in desktop inline mode — no modal to switch between */
.tp-popup--inline .tp-popup__switch {
  display: none;
}

/* ── Desktop inline mode ─────────────────────────────────────────────── */

@media (min-width: 52rem) {
  .time-pickers-container > .time-picker {
    flex: 0 0 17rem;
    overflow: hidden;
  }
}

.tp-card--inline {
  /* In inline mode the card becomes a non-interactive header row */
  cursor: default;
  pointer-events: none; /* quick buttons inside popup handle interaction */
}

/* The popup sits in normal flow, no fixed geometry */
.tp-popup--inline {
  position: static !important;
  display: flex !important;
  width: 100% !important;
  height: auto !important;
  box-shadow: none !important;
  border-radius: var(--radius-card, 18px) !important;
  /* Suppress the morph transition entirely */
  transition: none !important;
}

/* Hide the Done button on desktop — there's nothing to dismiss */
.tp-popup--inline .tp-popup__done {
  display: none;
}

/* Compact sizing for the inline variant */
.tp-popup--inline .tp-popup__inner {
  padding: 1rem 1.25rem;
}

.tp-popup--inline .tp-popup__time-input {
  font-size: 2.75rem;
}

/* Card is hidden behind the popup while morphing */
.tp-card--morphing {
  visibility: hidden;
}

.tp-card__icon-wrap {
  width: 2.4rem;
  height: 2.4rem;
  border-radius: 50%;
  background: color-mix(in srgb, var(--text-color-accent) 15%, transparent);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--text-color-accent);
}

.tp-card__icon-wrap .material-symbols-outlined {
  font-size: 20px !important;
}

.tp-card__info {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1px;
  flex: 1;
}

.tp-card__label {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: color-mix(in srgb, var(--text-color-primary) 55%, transparent);
}

.tp-card__time {
  font-family: 'DS-Digital', 'Courier New', monospace;
  font-size: 1.35rem;
  font-weight: bold;
  color: var(--text-color-accent);
  letter-spacing: 0.04em;
  line-height: 1.1;
  display: inline-block;
}

.tp-card__chevron {
  font-size: 20px !important;
  color: color-mix(in srgb, var(--text-color-primary) 30%, transparent);
  flex-shrink: 0;
}

/* ── Popup (expanded state) ────────────────────────────────────────────────── */

.tp-popup {
  position: fixed;
  z-index: 1200;
  background: var(--background-color-secondary);
  border-radius: 18px;
  box-shadow: var(--shadow);
  overflow: hidden;
  flex-direction: column;
  /* display:flex set via JS */

  transition:
    top 0.42s cubic-bezier(0.32, 0.72, 0, 1),
    left 0.42s cubic-bezier(0.32, 0.72, 0, 1),
    width 0.42s cubic-bezier(0.32, 0.72, 0, 1),
    height 0.42s cubic-bezier(0.32, 0.72, 0, 1),
    border-radius 0.42s cubic-bezier(0.32, 0.72, 0, 1),
    box-shadow 0.42s ease;

  will-change: top, left, width, height;
}

.tp-popup__inner {
  opacity: 0;
  transition: opacity 0.18s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  padding: 1.5rem 1.75rem;
  height: 100%;
}

.tp-popup--open .tp-popup__inner {
  opacity: 1;
  transition-delay: 0.28s;
}

.tp-popup__title {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: color-mix(in srgb, var(--text-color-primary) 50%, transparent);
  margin: 0;
  align-self: flex-start;
}

.tp-popup__input-wrap {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
}

.tp-popup__clock {
  font-size: 22px !important;
  color: var(--text-color-accent);
  flex-shrink: 0;
}

@font-face {
  font-family: 'DS-Digital';
  src: url('/fonts/DS-DIGIB.TTF') format('truetype');
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

/* Native time input — styled to match the old display span */
.tp-popup__time-input {
  flex: 0 0 auto;
  font-family: 'DS-Digital', 'Courier New', monospace;
  font-size: 4rem;
  font-weight: normal;
  /* DS-Digital has its own weight baked in */
  color: var(--text-color-accent);
  letter-spacing: 0.06em;
  line-height: 1;
  font-variant-numeric: tabular-nums;

  /* Width is set by JS based on locale (24h vs 12h AM/PM) */

  background: transparent;
  border: none;
  outline: none;
  text-align: center;

  /* Kill browser chrome */
  -webkit-appearance: none;
  appearance: none;
}

/* Webkit: hide the spinner arrows and calendar icon */
.tp-popup__time-input::-webkit-calendar-picker-indicator {
  display: none;
}

.tp-popup__time-input::-webkit-inner-spin-button {
  display: none;
}

.tp-popup__time-input::-webkit-datetime-edit-fields-wrapper {
  padding: 0;
}

/* Highlight the active segment with the accent color instead of blue */
.tp-popup__time-input::-webkit-datetime-edit-hour-field:focus,
.tp-popup__time-input::-webkit-datetime-edit-minute-field:focus {
  background: color-mix(in srgb, var(--text-color-accent) 25%, transparent);
  border-radius: 4px;
  color: var(--text-color-accent);
  outline: none;
}

/* Done button sits below — reuses .button-primary from style.css */
.tp-popup__done {
  min-width: 8rem;
}

.tp-popup__quick-btns {
  width: 100%;
  display: flex;
  justify-content: center;
  gap: 0.5rem;
}

.tp-popup__step {
  width: 2.75rem;
  height: 2.75rem;
  min-width: unset;
  border-radius: 50%;
  padding: 0;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.tp-popup__step .material-symbols-outlined {
  font-size: 20px !important;
}

.tp-popup__step-btns {
  display: flex;
  flex-direction: row;
  gap: 1rem;
}