/* ===========================================
   shadcn-datetime.css – Custom datetime picker
   Allineato al design system shadcn/ui dell'app
   =========================================== */

/* === Wrapper === */
.shad-dt-wrapper {
  position: relative;
  width: 100%;
}

/* === Trigger (il "campo" che si vede nel form) === */
.shad-dt-trigger {
  width: 100%;
  height: 2.75rem;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0 0.875rem;
  background: hsl(var(--background)) !important;
  border: 1px solid hsl(var(--input)) !important;
  border-radius: var(--radius-md) !important;
  color: hsl(var(--foreground));
  font-size: 0.9rem;
  font-family: var(--font-sans) !important;
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  text-align: left;
  box-shadow: none !important;
  overflow: hidden;
}

.shad-dt-trigger:hover {
  border-color: hsl(var(--border)) !important;
}

.shad-dt-trigger[aria-expanded="true"] {
  border-color: hsl(var(--ring)) !important;
  box-shadow: 0 0 0 3px hsl(var(--ring) / 0.15) !important;
}

.shad-dt-trigger[data-placeholder="true"] {
  color: hsl(var(--muted-foreground));
}

.shad-dt-trigger-icon {
  color: hsl(var(--muted-foreground));
  flex-shrink: 0;
  display: flex;
  align-items: center;
}

.shad-dt-trigger-text {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  min-width: 0;
}

.shad-dt-date-part {
  font-weight: 500;
  color: hsl(var(--foreground));
  white-space: nowrap;
}

.shad-dt-time-part {
  font-size: 0.8rem;
  font-weight: 600;
  color: hsl(var(--primary));
  background: hsl(var(--primary) / 0.1);
  padding: 0.1rem 0.45rem;
  border-radius: calc(var(--radius-md) - 2px);
  white-space: nowrap;
  letter-spacing: 0.02em;
}

.shad-dt-placeholder {
  color: hsl(var(--muted-foreground));
  font-style: normal;
}

.shad-dt-trigger-chevron {
  color: hsl(var(--muted-foreground));
  flex-shrink: 0;
  display: flex;
  align-items: center;
  transition: transform 0.2s ease;
}

.shad-dt-trigger[aria-expanded="true"] .shad-dt-trigger-chevron {
  transform: rotate(180deg);
}


/* === Panel (il dropdown aperto) === */
.shad-dt-panel {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 1100;
  width: 300px;
  background: hsl(var(--card));
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius-xl);
  box-shadow: 0 20px 25px -5px rgb(0 0 0 / 0.35), 0 8px 10px -6px rgb(0 0 0 / 0.2);
  padding: 0.875rem;
  display: none;
  flex-direction: column;
  gap: 0;
  animation: shadDtOpen 0.15s cubic-bezier(0.16, 1, 0.3, 1);
}

.shad-dt-panel[data-state="open"] {
  display: flex;
}

/* Posizione sopra se c'è poco spazio sotto */
.shad-dt-panel[data-pos="top"] {
  top: auto;
  bottom: calc(100% + 6px);
}

@keyframes shadDtOpen {
  from { opacity: 0; transform: translateY(-4px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0)   scale(1); }
}


/* === Header calendario (navigazione mese) === */
.shad-dt-cal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
  padding: 0 0.1rem;
}

.shad-dt-month-label {
  font-size: 0.9rem;
  font-weight: 600;
  color: hsl(var(--foreground));
  letter-spacing: -0.01em;
}

.shad-dt-nav-btn {
  width: 2rem;
  height: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent !important;
  border: 1px solid transparent !important;
  border-radius: var(--radius-md) !important;
  color: hsl(var(--muted-foreground));
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
  padding: 0 !important;
  flex-shrink: 0;
  box-shadow: none !important;
}

.shad-dt-nav-btn:hover {
  background: hsl(var(--accent)) !important;
  color: hsl(var(--foreground));
  border-color: hsl(var(--border)) !important;
}


/* === Griglia calendario === */
.shad-dt-cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
  margin-bottom: 0.75rem;
}

/* Intestazione giorni settimana */
.shad-dt-weekday {
  text-align: center;
  font-size: 0.7rem;
  font-weight: 600;
  color: hsl(var(--muted-foreground));
  padding: 0.25rem 0 0.4rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

/* Celle giorno */
.shad-dt-day {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.82rem;
  font-weight: 400;
  color: hsl(var(--foreground));
  background: transparent !important;
  border: 1px solid transparent !important;
  border-radius: var(--radius-sm) !important;
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease;
  padding: 0 !important;
  box-shadow: none !important;
  font-family: var(--font-sans) !important;
}

.shad-dt-day:hover {
  background: hsl(var(--accent)) !important;
  color: hsl(var(--accent-foreground));
}

/* Giorni fuori dal mese corrente */
.shad-dt-day.other-month {
  color: hsl(var(--muted-foreground) / 0.4);
}

.shad-dt-day.other-month:hover {
  color: hsl(var(--muted-foreground));
}

/* Oggi */
.shad-dt-day.today {
  background: hsl(var(--accent)) !important;
  color: hsl(var(--accent-foreground));
  font-weight: 600;
}

/* Giorno selezionato */
.shad-dt-day.selected {
  background: hsl(var(--primary)) !important;
  color: hsl(var(--primary-foreground)) !important;
  font-weight: 700;
  border-color: hsl(var(--primary)) !important;
}

.shad-dt-day.selected:hover {
  background: hsl(var(--primary) / 0.85) !important;
}


/* === Sezione orario === */
.shad-dt-time {
  border-top: 1px solid hsl(var(--border));
  padding-top: 0.75rem;
  margin-top: 0.125rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6rem;
}

.shad-dt-time-label {
  font-size: 0.72rem;
  font-weight: 600;
  color: hsl(var(--muted-foreground));
  letter-spacing: 0.06em;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.shad-dt-time-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.shad-dt-time-sep {
  font-size: 1.2rem;
  font-weight: 700;
  color: hsl(var(--muted-foreground));
  line-height: 1;
  margin-top: -2px;
}

/* Colonnina spinner (su/input/giù) */
.shad-dt-spin-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
}

.shad-dt-spin-btn {
  width: 2rem;
  height: 1.6rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent !important;
  border: 1px solid hsl(var(--border)) !important;
  border-radius: var(--radius-sm) !important;
  color: hsl(var(--muted-foreground));
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease;
  padding: 0 !important;
  box-shadow: none !important;
}

.shad-dt-spin-btn:hover {
  background: hsl(var(--accent)) !important;
  color: hsl(var(--foreground));
}

.shad-dt-spin-input {
  width: 3rem;
  height: 2.4rem;
  text-align: center;
  font-size: 1.25rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  font-family: var(--font-sans) !important;
  color: hsl(var(--foreground)) !important;
  background: hsl(var(--background)) !important;
  border: 1px solid hsl(var(--border)) !important;
  border-radius: var(--radius-md) !important;
  outline: none;
  padding: 0 !important;
  box-shadow: none !important;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.shad-dt-spin-input:focus {
  border-color: hsl(var(--ring)) !important;
  box-shadow: 0 0 0 3px hsl(var(--ring) / 0.15) !important;
}


/* === Footer === */
.shad-dt-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding-top: 0.75rem;
  margin-top: 0.125rem;
  border-top: 1px solid hsl(var(--border));
}

.shad-dt-btn-clear {
  flex: 1;
  height: 2rem;
  font-size: 0.8rem;
  font-weight: 500;
  font-family: var(--font-sans) !important;
  cursor: pointer;

  padding: 0 !important;

  border: none !important;

  border-radius: var(--radius-md) !important;
}

.shad-dt-btn-confirm {
  flex: 2;
  height: 2rem;
  font-size: 0.82rem;
  font-weight: 600;
  font-family: var(--font-sans) !important;
  cursor: pointer;

  padding: 0 !important;

  border: none !important;

  border-radius: var(--radius-md) !important;
}
