:root{
  --rentable-color-available: #90EE90;
  --rentable-color-unavailable: #FFB6C1;
  --rentable-color-unavailable-edge: #e28fa1; /* darker edge for triangles */
  --rentable-color-selection: #B2DFEE;
  --rentable-color-selection-edge: #74b4cc; /* darker edge for selection triangles */
  --rentable-color-disabled: #c2c2c2;
  --rentable-color-hover: #9FB6CD;
}

.rentable-picker-placeholder{
  padding: 8px 12px;
  border: 1px dashed #999;
  color: #333;
  background: #fafafa;
}

/* Static month calendar (Step 4) */
.rdp-calendar{
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  border: 1px solid #ddd;
  border-radius: 6px;
  background: #fff;
  overflow: hidden;
  display: inline-block; /* don't stretch full width */
  width: auto; /* shrink to fit */
}

.rdp-header{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  font-weight: 600;
  padding: 6px 8px; /* compact */
  background: #f6f6f6;
  border-bottom: 1px solid #e6e6e6;
}
.rdp-title{ font-size: 13px; }
.rdp-nav{
  appearance: none;
  border: none;
  background: transparent;
  cursor: pointer;
  line-height: 1;
  font-size: 14px;
  padding: 2px 6px;
  border-radius: 4px;
}
.rdp-nav:focus-visible{ outline: 2px solid #4aa3df; outline-offset: 1px; }
.rdp-nav:not(.rdp-prev-side):not(.rdp-next-side):hover{ background: #ececec; }
.rdp-nav[disabled]{
  opacity: 0.5;
  cursor: not-allowed;
}

/* Touch-friendly side navigation arrows */
[data-rdp-wrapper] .rdp-months-wrap{
  display: flex !important;
  gap: 8px !important;
  flex-wrap: wrap;
}
[data-rdp-wrapper] .rdp-prev-side,
[data-rdp-wrapper] .rdp-next-side{
  width: 56px;
  height: 56px;
  min-width: 56px;
  min-height: 56px;
  border-radius: 999px;
  background: #e0e0e0 !important;
  box-shadow: inset 0 0 0 1px #cfcfcf;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 28px; /* fallback if glyph not present */
  color: #000;
  padding: 0;
  position: relative;
  z-index: 2; /* render above months */
  transition: background-color 120ms ease, color 120ms ease;
}
[data-rdp-wrapper] .rdp-arrow-glyph{
  font-size: 28px;
  line-height: 1;
  display: inline-block;
  color: inherit;
}
[data-rdp-wrapper] .rdp-prev-side:hover,
[data-rdp-wrapper] .rdp-next-side:hover,
[data-rdp-wrapper] .rdp-prev-side:focus-visible,
[data-rdp-wrapper] .rdp-next-side:focus-visible{
  background: #000 !important;
  color: #fff !important;
}
/* Remove halo pseudo-element (not used) */
[data-rdp-wrapper] .rdp-prev-side::after,
[data-rdp-wrapper] .rdp-next-side::after{ content: none !important; }
[data-rdp-wrapper] .rdp-prev-side:focus-visible,
[data-rdp-wrapper] .rdp-next-side:focus-visible{
  outline: 3px solid #4aa3df;
  outline-offset: 2px;
}
[data-rdp-wrapper] .rdp-prev-side[disabled],
[data-rdp-wrapper] .rdp-next-side[disabled]{
  opacity: 0.4;
}

/* Ensure mount aligns arrows vertically to months */
[data-rdp-wrapper] .rdp-mount,
[data-rdp-wrapper] .rentable-daterange-picker .rdp-mount{
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Larger arrows on wider screens */
@media (min-width: 768px){
  [data-rdp-wrapper] .rdp-prev-side,
  [data-rdp-wrapper] .rdp-next-side{
    width: 64px;
    height: 64px;
    min-width: 64px;
    min-height: 64px;
    font-size: 32px;
  }
}

/* Responsive gaps for tight/loose layouts */
@media (min-width: 480px){
  [data-rdp-wrapper] .rdp-months-wrap{ gap: 10px; }
  [data-rdp-wrapper] .rdp-mount{ gap: 10px; }
}
@media (min-width: 768px){
  [data-rdp-wrapper] .rdp-months-wrap{ gap: 12px; }
  [data-rdp-wrapper] .rdp-mount{ gap: 12px; }
}

.rdp-grid{
  display: grid;
  grid-template-columns: repeat(7, 36px); /* fixed cell width for compact layout */
}

.rdp-grid--dow{
  background: #fbfbfb;
  border-bottom: 1px solid #eee;
}

.rdp-dow{
  text-align: center;
  font-size: 11px; /* compact */
  color: #666;
  padding: 4px 0; /* compact */
}

.rdp-grid--days{
  gap: 0;
}

.rdp-day{
  position: relative;
  min-height: 28px; /* compact */
  padding: 4px; /* compact */
  text-align: right;
  border-right: 1px solid #f2f2f2;
  border-bottom: 1px solid #f2f2f2;
  background: #fff;
}
.rdp-day:nth-child(7n){ border-right: none; }

/* Tastatur-Fokus sichtbar machen (roving tabindex setzt tabindex=0 auf Fokus-Tag) */
.rdp-day[tabindex="0"]:focus-visible{
  outline: 2px solid #005fcc;
  outline-offset: -2px;
}

.rdp-day--empty{
  background: #fafafa;
}

/* Disabled Tage (z. B. vor Mindestdatum) */
.rdp-day--disabled{
  color: #aaa;
  background: #f7f7f7;
  cursor: not-allowed;
}
.rdp-day--disabled .rdp-day__num{ color: #aaa; }

/* Edge-selectable booked days (allowed for arrival/departure) should be interactive */
.rdp-day--edge-selectable{
  cursor: pointer;
}

/* Gebuchte Tage (aus Backend geliefertes Intervall) */
.rdp-day--booked{
  background-color: var(--rentable-color-unavailable) !important;
  color: #5a5a5a;
  background-repeat: no-repeat;
  background-size: 100% 100%;
}
.rdp-day--booked .rdp-day__num{
  color: #5a5a5a;
}

.rdp-day__num{
  font-size: 11px; /* compact */
  color: #333;
}

/* Arrival/Departure corners for booked ranges via linear-gradient */
/* Arrival only (start): keep top-left transparent, color bottom-right */
.rdp-day--booked.rdp-day--booked-start:not(.rdp-day--booked-end){
  background-color: transparent !important;
  background-image: linear-gradient(to bottom right,
    transparent 0%, transparent 50%,
    var(--rentable-color-unavailable) 50.5%, var(--rentable-color-unavailable) 100%);
}
/* Departure only (end): keep bottom-right transparent, color top-left */
.rdp-day--booked.rdp-day--booked-end:not(.rdp-day--booked-start){
  background-color: transparent !important;
  background-image: linear-gradient(to bottom right,
    var(--rentable-color-unavailable) 0%, var(--rentable-color-unavailable) 49.5%,
    transparent 50%, transparent 100%);
}
/* Booked-end + selection start on the same day: left-top = unavailable, right-bottom = selection */
.rdp-day--booked.rdp-day--booked-end.rdp-day--start:not(.rdp-day--end){
  background-color: transparent !important;
  background-image: linear-gradient(to bottom right,
    var(--rentable-color-unavailable) 0%, var(--rentable-color-unavailable) 49.5%,
    var(--rentable-color-selection) 50.5%, var(--rentable-color-selection) 100%);
}
/* Booked-start + selection end on the same day: left-top = selection, right-bottom = unavailable */
.rdp-day--booked.rdp-day--booked-start.rdp-day--end:not(.rdp-day--start){
  background-color: transparent !important;
  background-image: linear-gradient(to bottom right,
    var(--rentable-color-selection) 0%, var(--rentable-color-selection) 49.5%,
    var(--rentable-color-unavailable) 50.5%, var(--rentable-color-unavailable) 100%);
}
/* Arrival + Departure same day: color both halves (equivalent to full background) */
.rdp-day--booked.rdp-day--booked-start.rdp-day--booked-end{
  background-color: var(--rentable-color-unavailable) !important;
  background-image: none;
}

/* Selection states */
.rdp-day--start,
.rdp-day--end{
  outline: 2px solid #4aa3df;
  outline-offset: -2px;
  background-repeat: no-repeat;
  background-size: 100% 100%;
}
.rdp-day--inrange{
  background: rgba(178, 223, 238, 0.6);
}
/* Selection start/end corners via linear-gradient */
/* Arrival-only (start): keep top-left transparent, color bottom-right */
.rdp-day--start:not(.rdp-day--end){
  background-color: transparent !important;
  background-image: linear-gradient(to bottom right,
    transparent 0%, transparent 50%,
    var(--rentable-color-selection) 50.5%, var(--rentable-color-selection) 100%);
}
/* Departure-only (end): keep bottom-right transparent, color top-left */
.rdp-day--end:not(.rdp-day--start){
  background-color: transparent !important;
  background-image: linear-gradient(to bottom right,
    var(--rentable-color-selection) 0%, var(--rentable-color-selection) 49.5%,
    transparent 50%, transparent 100%);
}
/* Arrival + Departure same day: full color */
.rdp-day--start.rdp-day--end{
  background-color: var(--rentable-color-selection) !important;
  background-image: none;
}

/* Inline Fehleranzeige und Invalid-State */
.rdp-error{
  color: #b00020;
  font-size: 12px;
}
.rdp-calendar.rdp-invalid{
  border-color: #b00020;
  box-shadow: 0 0 0 2px rgba(176, 0, 32, 0.15);
}

/* Native Inputs: sichtbare Fehlerdarstellung */
[data-rdp-wrapper] input[type="date"][aria-invalid="true"],
[data-rdp-wrapper] input[aria-invalid="true"]{
  border-color: #b00020 !important;
  box-shadow: 0 0 0 2px rgba(176, 0, 32, 0.12);
}
[data-rdp-wrapper] input[type="date"][aria-invalid="true"]:focus,
[data-rdp-wrapper] input[aria-invalid="true"]:focus{
  outline: 2px solid rgba(176, 0, 32, 0.4);
  outline-offset: 1px;
}
