/* static/reservation/css/room_booking.css */
/* RehaRent room booking page tweaks */

.detail-section {
  margin-bottom: 0.9rem;
}

@media (min-width: 992px) {
  .detail-section {
    margin-bottom: 1.1rem;
  }
}

/* Header labels */
#room-booking-form label {
  font-size: 0.78rem;
}

/* Form controls */
#room-booking-form .form-control,
#room-booking-form .form-control-sm {
  font-size: 0.82rem;
}

#room-booking-form .form-label {
  margin-bottom: 0.15rem;
}

/* Price preview */
#booking-price-preview {
  min-height: 1.2em;
}

/* Submit button */
#btn-room-book {
  font-size: 0.82rem;
  padding: 0.35rem 0.9rem;
}

/* Feedback */
#booking-feedback {
  min-height: 1.2em;
}
#booking-feedback.text-success {
  color: #16a34a !important;
}
#booking-feedback.text-danger {
  color: #dc2626 !important;
}

#room-booking-section {
  scroll-margin-top: 84px;
}

.room-mobile-cta {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1040;
  padding: 0.55rem 0.75rem calc(0.55rem + env(safe-area-inset-bottom));
  background: linear-gradient(
    to top,
    rgba(255, 255, 255, 0.98) 70%,
    rgba(255, 255, 255, 0)
  );
  transition: opacity 160ms ease, transform 160ms ease;
}

.room-mobile-cta .btn {
  min-height: 46px;
  font-weight: 700;
}

.room-mobile-cta.is-hidden {
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
}

.room-mobile-cta-spacer {
  height: 84px;
}

/* Mobile padding */
@media (max-width: 575.98px) {
  .detail-section {
    padding: 0.75rem 0.8rem;
  }
}

@media (min-width: 992px) {
  .room-mobile-cta,
  .room-mobile-cta-spacer {
    display: none;
  }
}

/* Room spec panel */
.room-spec {
  border-radius: 0.9rem;
  border: 1px solid rgba(148, 163, 184, 0.18);
  background: rgba(248, 250, 252, 0.7);
  padding: 0.9rem 1rem;
}

.room-spec-header {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-weight: 700;
  font-size: 0.9rem;
  margin-bottom: 0.75rem;
  color: #0f172a;
}

.room-spec-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem 0.9rem;
}

.spec-item {
  background: #fff;
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 0.75rem;
  padding: 0.55rem 0.65rem;
}

.spec-label {
  font-size: 0.72rem;
  color: #64748b;
  font-weight: 600;
  margin-bottom: 0.15rem;
}

.spec-value {
  font-size: 0.86rem;
  font-weight: 700;
  color: #0f172a;
}

.spec-sub {
  display: inline-block;
  margin-left: 0.35rem;
  font-size: 0.74rem;
  font-weight: 600;
  color: #64748b;
}

.spec-tags {
  margin-top: 0.75rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.tag-chip {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0.18rem 0.5rem;
  font-size: 0.72rem;
  font-weight: 700;
  border: 1px solid rgba(148, 163, 184, 0.25);
  background: rgba(255, 255, 255, 0.95);
  color: #334155;
}

@media (max-width: 575.98px) {
  .room-spec-grid {
    grid-template-columns: 1fr;
  }
}

/* In booking page, room names are not clickable (select mode uses <span>, but keep safe) */
.ts-room-link,
.ts-room-link:hover,
.ts-room-link:focus,
.ts-room-link:active {
  cursor: default;
  text-decoration: none;
  background: transparent;
  border: none;
  box-shadow: none;
  color: #0f172a;
}

/* If any pseudo elements exist, remove */
.ts-room-link::after {
  content: "";
  display: none;
}

.ts-room-link:focus-visible {
  outline: none;
}

/* Timepicker */
.timepicker-trigger {
  cursor: pointer;
  background: #fff;
}

.timepicker-popover {
  margin-top: 0.35rem;
  border: 1px solid rgba(148, 163, 184, 0.25);
  border-radius: 0.9rem;
  background: #fff;
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.12);
  padding: 0.8rem;

  position: absolute;
  z-index: 50;
}

/* Ensure the popover positions relative to the column */
#room-booking-form .col-6 {
  position: relative;
}

.tp-cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.tp-col-label {
  font-size: 0.75rem;
  color: #64748b;
  margin-bottom: 0.25rem;
  font-weight: 700;
}

/* Keep timeslot grid behind popovers */
.timeslot-view,
.ts-table-wrapper {
  position: relative;
  z-index: 1;
}

/* End-time list */
.tp-scroll {
  max-height: 220px;
  overflow-y: auto;
  background: #ffffff;
  border-radius: 0.65rem;
}

.tp-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.tp-list-item {
  padding: 0.55rem 0.75rem;
  font-size: 0.85rem;
  font-weight: 500;
  line-height: 1.4;
  cursor: pointer;
  white-space: nowrap;
  border-bottom: 1px solid rgba(0, 0, 0, 0.04);
}

.tp-list-item:last-child {
  border-bottom: none;
}

/* Brand-aligned hover/active/focus */
.tp-list-item:hover {
  background: var(--ts-hover);
}
.tp-list-item:active {
  background: rgba(31, 58, 95, 0.18);
}
.tp-list-item:focus-visible {
  outline: none;
  background: rgba(31, 58, 95, 0.15);
}

.tp-list-placeholder {
  padding: 0.6rem 0.75rem;
  font-size: 0.8rem;
  color: #64748b;
  cursor: default;
}

/* Scrollbar */
.tp-scroll::-webkit-scrollbar {
  width: 6px;
}
.tp-scroll::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.2);
  border-radius: 999px;
}
.tp-scroll::-webkit-scrollbar-track {
  background: transparent;
}

/* Space name link (subtle) */
.room-space-link:hover {
  text-decoration: underline;
}

/* ===============================
   Date picker: < [date] > unified
   =============================== */

.rr-date-group{
  display: grid;
  grid-template-columns: 44px 1fr 44px;
  align-items: center;
  border: 1px solid rgba(148, 163, 184, 0.25);
  border-radius: 0.85rem;
  background: #fff;
  overflow: hidden;
  box-shadow: 0 10px 25px rgba(15,23,42,0.06);
}

.rr-date-group--sm {
  grid-template-columns: 36px 1fr 36px;
}

.booking-date-group {
  width: min(100%, 240px);
}

.booking-date-group .rr-date-btn {
  height: 36px;
}

.booking-date-group .rr-date-input {
  height: 36px;
  padding: 0 0.6rem;
}

.rr-date-btn{
  height: 40px;
  border: 0;
  background: rgba(248,250,252,0.9);
  color: #0f172a;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 120ms ease, opacity 120ms ease;
}

.rr-date-btn:hover{
  background: rgba(13,110,253,0.08);
}

.rr-date-btn:active{
  background: rgba(13,110,253,0.14);
}

.rr-date-btn:disabled{
  opacity: 0.45;
  cursor: not-allowed;
  background: rgba(248,250,252,0.7);
}

/* 中央の date input を “素のinput” っぽく見せる */
.rr-date-input{
  height: 40px;
  border: 0;
  padding: 0 0.75rem;
  font-size: 0.82rem;
  background: transparent;
  color: #0f172a;
}

.rr-date-input:focus{
  outline: none;
}

/* focus-within で外枠をモダンに強調 */
.rr-date-group:focus-within{
  border-color: rgba(13,110,253,0.55);
  box-shadow: 0 0 0 4px rgba(13,110,253,0.14);
}

/* iOSで日付入力が窮屈に見えるのを少し緩和 */
@media (max-width: 575.98px){
  .rr-date-btn{ height: 42px; }
  .rr-date-input{ height: 42px; }
  .booking-date-group {
    width: min(100%, 240px);
  }
  .booking-date-group .rr-date-btn {
    height: 38px;
  }
  .booking-date-group .rr-date-input {
    height: 38px;
  }
}

/* ===============================
   Timepicker popover: slightly more modern
   =============================== */
.timepicker-popover{
  border-radius: 0.9rem;
  border: 1px solid rgba(148, 163, 184, 0.22);
  box-shadow:
    0 18px 40px rgba(15, 23, 42, 0.12),
    0 6px 16px rgba(15, 23, 42, 0.08);
}

/* 終了候補リストの“5件見え”を安定させる（1件=44px想定） */
.tp-scroll{
  max-height: 220px; /* 44px * 5 */
}

.tp-list-item{
  padding: 0.6rem 0.75rem;
  line-height: 1.3;
}

/* ===============================
   Time pickers: modern input-like
   =============================== */

/* 開始/終了ボタンを input っぽく */
.timepicker-trigger{
  height: 40px;
  border: 1px solid rgba(148, 163, 184, 0.25) !important;
  border-radius: 0.85rem !important;
  background: #fff !important;
  padding: 0 0.75rem !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 0.6rem;
  color: #0f172a;
  box-shadow: 0 10px 25px rgba(15,23,42,0.06);
  transition: box-shadow 120ms ease, border-color 120ms ease, background 120ms ease;
  position: relative;
}

/* 右端の「▼」を常に表示（クリックできるのが分かる） */
.timepicker-trigger::after{
  content: "▾";
  font-size: 1rem;
  line-height: 1;
  opacity: 0.6;
  margin-left: auto;
}

/* hover */
.timepicker-trigger:hover{
  border-color: rgba(13,110,253,0.35) !important;
  background: rgba(248,250,252,0.9) !important;
}

/* focus風（クリック時にフォーカスが付かないので :focus-visible は効きにくい）
   → JSで open したときに .is-open を付けるならここが一番綺麗。
   ひとまず :active でも軽く効かせる */
.timepicker-trigger:active{
  border-color: rgba(13,110,253,0.55) !important;
  box-shadow: 0 0 0 4px rgba(13,110,253,0.14);
}

/* disabled の見た目を自然に */
.timepicker-trigger:disabled{
  cursor: not-allowed;
  opacity: 0.55;
  background: rgba(248,250,252,0.7) !important;
  box-shadow: none;
}

/* 表示テキストの見やすさ */
#start-display, #end-display{
  font-size: 0.82rem;
  font-weight: 700;
}

/* placeholder（text-muted）のときは少し弱め */
#start-display.text-muted,
#end-display.text-muted{
  font-weight: 600;
  opacity: 0.85;
}

/* 2カラムの高さを揃える */
@media (max-width: 575.98px){
  .timepicker-trigger{ height: 42px; }
  .timepicker-popover{
    width: min(320px, calc(100vw - 24px));
    max-width: calc(100vw - 24px);
    box-sizing: border-box;
  }
}
