/* ============================================================
   Apartments Veronika — Custom Date Range Picker
   ============================================================ */

/* ── OVERLAY — backdrop only (mobile) ────────────────────── */
.avdp-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 399;
}
.avdp-overlay.avdp-open {
  display: block;
}

/* ── CALENDAR CARD ───────────────────────────────────────── */
.avdp-calendar {
  display: none;
  position: fixed;
  z-index: 400;
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-xl, 20px);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  font-family: 'DM Sans', sans-serif;
  user-select: none;
  -webkit-user-select: none;
}
.avdp-calendar.avdp-open {
  display: block;
}

/* ── HEADER ──────────────────────────────────────────────── */
.avdp-header {
  display: flex;
  align-items: center;
  padding: 14px 16px 10px;
  border-bottom: 1px solid var(--divider);
  gap: 8px;
}

.avdp-month-titles {
  flex: 1;
  display: flex;
  justify-content: space-around;
}

.avdp-month-title {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text);
  text-align: center;
}

.avdp-nav {
  background: none;
  border: 1px solid var(--border-soft);
  border-radius: 50%;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text2);
  font-size: 1.25rem;
  line-height: 1;
  transition: background 0.15s, color 0.15s;
  flex-shrink: 0;
}
.avdp-nav:hover {
  background: var(--surface2);
  color: var(--accent);
}

.avdp-instruction {
  display: none; /* shown on mobile below */
}

/* ── MONTHS GRID ─────────────────────────────────────────── */
.avdp-months {
  display: grid;
  padding: 12px 16px 8px;
  gap: 24px;
}
.avdp-months[data-count="2"] { grid-template-columns: 1fr 1fr; }
.avdp-months[data-count="1"] { grid-template-columns: 1fr; }

/* ── WEEKDAY HEADERS ─────────────────────────────────────── */
.avdp-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  margin-bottom: 4px;
}

.avdp-weekday {
  text-align: center;
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text3);
  padding: 4px 0;
}

/* ── DAYS GRID ───────────────────────────────────────────── */
.avdp-days {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
}

.avdp-day {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 1;
  border-radius: 50%;
  font-size: 0.875rem;
  color: var(--text);
  transition: background 0.12s, color 0.12s;
}

.avdp-day.avdp-available {
  cursor: pointer;
}
.avdp-day.avdp-available:hover {
  background: var(--accent-light);
  color: var(--accent);
}

.avdp-day.avdp-disabled {
  color: var(--text3);
  opacity: 0.4;
  cursor: default;
  pointer-events: none;
}

.avdp-day.avdp-today .avdp-day-num::after {
  content: '';
  position: absolute;
  bottom: 3px;
  left: 50%;
  transform: translateX(-50%);
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--accent);
}

.avdp-day-num {
  position: relative;
  z-index: 1;
}

/* ── RANGE STATES ────────────────────────────────────────── */
/* In-range background: extend full-width through cells */
.avdp-day.avdp-in-range,
.avdp-day.avdp-in-hover {
  border-radius: 0;
  background: var(--accent-light);
  color: var(--accent);
}

/* Start day */
.avdp-day.avdp-start {
  background: var(--accent);
  color: #fff;
  border-radius: 50% 0 0 50%;
}
.avdp-day.avdp-start:hover { background: var(--accent-hover); color: #fff; }

/* End day */
.avdp-day.avdp-end {
  background: var(--accent);
  color: #fff;
  border-radius: 0 50% 50% 0;
}
.avdp-day.avdp-end:hover { background: var(--accent-hover); color: #fff; }

/* Same start + end */
.avdp-day.avdp-same {
  border-radius: 50%;
}

/* Clean up range: first col start and last col end need full radius */
.avdp-day.avdp-start.avdp-in-range-start-only,
.avdp-days .avdp-day:nth-child(7n+1).avdp-in-range,
.avdp-days .avdp-day:nth-child(7n+1).avdp-in-hover {
  border-radius: 50% 0 0 50%;
}
.avdp-days .avdp-day:nth-child(7n).avdp-in-range,
.avdp-days .avdp-day:nth-child(7n).avdp-in-hover {
  border-radius: 0 50% 50% 0;
}

/* Hover end dot */
.avdp-day.avdp-in-hover:last-of-type,
.avdp-days .avdp-day.avdp-in-hover:nth-child(7n) {
  border-radius: 0 50% 50% 0;
}

/* Hover preview end day */
.avdp-day.avdp-hover-end {
  background: var(--accent);
  color: #fff;
  border-radius: 0 50% 50% 0;
  opacity: 0.7;
}

/* ── FOOTER ──────────────────────────────────────────────── */
.avdp-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding: 10px 16px 14px;
  border-top: 1px solid var(--divider);
}

.avdp-clear {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 0.8125rem;
  color: var(--text3);
  font-family: 'DM Sans', sans-serif;
  padding: 6px 10px;
  border-radius: var(--radius-md);
  transition: color 0.15s, background 0.15s;
  margin-right: auto;
}
.avdp-clear:hover { color: var(--error); background: var(--error-bg); }

.avdp-close-btn {
  background: var(--accent);
  color: #fff;
  border: none;
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 600;
  font-family: 'DM Sans', sans-serif;
  padding: 8px 20px;
  border-radius: var(--radius-pill);
  transition: background 0.15s;
}
.avdp-close-btn:hover { background: var(--accent-hover); }

/* ── TRIGGER BUTTONS ─────────────────────────────────────── */
.avdp-trigger {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border: 1.5px solid var(--border-soft);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: border-color 0.2s, box-shadow 0.2s;
  background: var(--surface);
}

.avdp-trigger:focus-within,
.avdp-trigger.avdp-focused {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
}

.avdp-trigger-half {
  padding: 13px 16px;
  cursor: pointer;
  transition: background 0.15s;
  min-width: 0;
}
.avdp-trigger-half:first-child {
  border-right: 1px solid var(--border-soft);
}
.avdp-trigger-half:hover {
  background: var(--surface2);
}
.avdp-trigger-half.avdp-active {
  background: var(--accent-light);
}

.avdp-trigger-label {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: var(--text3);
  margin-bottom: 4px;
  display: block;
}

.avdp-trigger-value {
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--text3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
  transition: color 0.15s;
}
.avdp-trigger-half.avdp-has-value .avdp-trigger-value {
  color: var(--text);
}

/* ── MOBILE (≤ 540px) ────────────────────────────────────── */
@media (max-width: 540px) {
  .avdp-overlay.avdp-open {
    background: var(--overlay);
  }
  .avdp-calendar.avdp-open {
    top: auto !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    max-height: 90vh;
    overflow-y: auto;
  }
  .avdp-instruction {
    display: block;
    font-size: 0.75rem;
    color: var(--text3);
    text-align: center;
    padding: 0 0 6px;
    flex-basis: 100%;
  }
  .avdp-header { flex-wrap: wrap; }
  .avdp-months { padding: 12px 12px 6px; }
  .avdp-day { font-size: 0.8125rem; }
  .avdp-trigger { grid-template-columns: 1fr; }
  .avdp-trigger-half:first-child {
    border-right: none;
    border-bottom: 1px solid var(--border-soft);
  }
}

@media (max-width: 400px) {
  .avdp-day { font-size: 0.75rem; }
  .avdp-weekday { font-size: 0.625rem; }
}
