/* Reusable styles for room details layouts (tables, sections) */
/* Implementing Negative Space Design Principles - See DESIGN-PRINCIPLES-NEGATIVE-SPACE.md */

/* Container that holds the pricing/details table */
.roomPrice {
  width: 100%;
  max-width: 760px;
}

/* roomBedandPrice container - improved layout with negative space */
.roomBedandPrice {
  display: flex;
  flex-direction: column;
  gap: var(--card-gap-mobile);
  margin-top: var(--space-xl);
  width: 100%;
}

@media (min-width: 992px) {
  .roomBedandPrice {
    gap: var(--card-gap-desktop);
    margin-top: var(--space-2xl);
  }
}

/* roomBed section - bed configuration list */
/* Handle both class and id selectors for compatibility */
.roomBed,
#roomBed {
  width: 100%;
  background: rgba(255, 255, 255, 0.9);
  /* border-radius: clamp(10px, 1.5vw, 12px); */
  border: 1px solid rgba(229, 231, 235, 0.8);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  overflow: hidden;
}

.roomBed ul[data-role="listview"],
#roomBed ul[data-role="listview"] {
  margin: 0;
  padding: 0;
  list-style: none;
}

.roomBed li[data-role="list-divider"],
#roomBed li[data-role="list-divider"] {
  background-color: rgba(1, 75, 66, 0.08);
  color: rgb(1, 75, 66);
  font-weight: 700;
  font-size: clamp(13px, 1.8vw, 15px);
  padding: var(--space-base) var(--space-lg);
  margin: 0;
  border-bottom: 2px solid rgba(1, 75, 66, 0.15);
  letter-spacing: var(--letter-spacing-wide);
}

.roomBed li:not([data-role="list-divider"]),
#roomBed li:not([data-role="list-divider"]) {
  padding: var(--space-md) var(--space-lg);
  margin: 0;
  color: #374151;
  font-size: clamp(14px, 2vw, 16px);
  line-height: var(--line-height-normal);
  border-bottom: 1px solid rgba(229, 231, 235, 0.5);
}

.roomBed li:not([data-role="list-divider"]):last-child,
#roomBed li:not([data-role="list-divider"]):last-child {
  border-bottom: none;
}

@media (min-width: 992px) {
  .roomBed li[data-role="list-divider"],
  #roomBed li[data-role="list-divider"] {
    padding: var(--space-lg) var(--space-xl);
    font-size: 15px;
  }

  .roomBed li:not([data-role="list-divider"]),
  #roomBed li:not([data-role="list-divider"]) {
    padding: var(--space-base) var(--space-xl);
    font-size: 16px;
  }
}

/* roomPrice section - pricing card */
.roomPrice {
  width: 100%;
  max-width: 760px;
  background: rgba(255, 255, 255, 0.95);
  border-radius: clamp(10px, 1.5vw, 12px);
  border: 1px solid rgba(229, 231, 235, 0.8);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  overflow: hidden;
}

/* Base table styling */
.roomDetailsTbl {
  width: 100%;
  border-collapse: collapse;
  background-color: #ffffff;
}

/* Generic flex-based rates layout (preferred) */
.rates {
  width: 100%;
  max-width: 760px;
}

.rates .rateItem {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--space-base);
  padding: var(--space-base) var(--space-lg);
  border-bottom: 1px solid rgba(229, 231, 235, 0.8);
  transition: background-color 0.2s ease;
}

.rates .rateItem:hover {
  background-color: rgba(1, 75, 66, 0.02);
}

@media (min-width: 992px) {
  .rates .rateItem {
    padding: var(--space-lg) var(--space-xl);
    gap: var(--space-lg);
  }
}
.rates .rateItem:nth-child(1) {
  background-color: #fffbeb;
} /* amber-50 */
.rates .rateItem:nth-child(2) {
  background-color: #f0f9ff;
} /* sky-50 */
.rates .rateItem:nth-child(3) {
  background-color: #f7fee7;
} /* lime-50 */
.rates .rateItem:nth-child(4) {
  background-color: #fdf2f8;
} /* pink-50 */
.rates .rateItem:nth-child(5) {
  background-color: #f5f3ff;
} /* violet-50 */
.rates .rateItem:last-child {
  border-bottom: none;
}
.rates .rateLabel {
  flex: 1 1 auto;
  color: #374151;
  font-weight: 600;
  font-size: clamp(14px, 2vw, 16px);
  line-height: var(--line-height-normal);
}

.rates .ratePrice {
  flex: 0 0 auto;
  min-width: max-content;
  text-align: right;
  font-weight: 700;
  color: rgb(1, 75, 66);
  font-size: clamp(16px, 2.2vw, 20px);
  letter-spacing: var(--letter-spacing-tight);
}

.rates .rateNote {
  margin-top: var(--space-sm);
  color: #4b5563;
  font-weight: 400;
  font-size: clamp(13px, 1.8vw, 15px);
  line-height: var(--line-height-normal);
}

.rates .rateItem .rateNote {
  flex-basis: 100%;
}

/* Neutralize legacy borders from older stylesheets */
.roomDetailsTbl,
.roomDetailsTbl td {
  border: 0 !important;
}

.roomDetailsTbl tr {
  border-bottom: 1px solid #e5e7eb; /* gray-200 */
}

.roomDetailsTbl tr:last-child {
  border-bottom: none;
}

.roomDetailsTbl td {
  padding: 12px 16px;
  vertical-align: top;
}

/* Two-column layout on larger screens */
.roomDetailsTbl td:first-child {
  color: #374151; /* gray-700 */
  font-weight: 600;
  width: 65%;
}

.roomDetailsTbl td:last-child {
  text-align: right;
  width: 35%;
  font-weight: 700;
  color: #111827; /* gray-900 */
}

/* Remove legacy max-width from older stylesheet that constrains value column */
.roomDetailsTbl td:nth-child(2),
.roomDetailsTbl td:last-child {
  max-width: none !important;
}

/* Paragraph inside value cell */
.roomDetailsTbl td p {
  margin: 8px 0 0 0;
  font-weight: 400;
  color: #4b5563; /* gray-600 */
  text-align: left;
}

/* Responsive behavior: stack rows into cards on small screens */
@media (max-width: 640px) {
  .roomDetailsTbl {
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    overflow: hidden;
  }

  /* (Borders already neutralized globally) */

  .roomDetailsTbl tr {
    display: block;
    padding: 12px 14px;
  }

  .roomDetailsTbl td {
    display: block;
    width: 100% !important;
    padding: 6px 0;
    text-align: left !important;
  }

  .roomDetailsTbl td:first-child {
    margin-bottom: 2px;
    font-weight: 600;
    color: #1f2937; /* gray-800 */
  }

  .roomDetailsTbl td:last-child {
    font-size: 1.1rem;
    font-weight: 700;
    color: #111827;
  }
}

/* roomAction - booking button section */
.roomAction {
  text-align: center;
  margin-top: var(--space-xl);
  margin-bottom: var(--space-lg);
  padding: var(--space-base);
  background: rgba(255, 255, 255, 0.85);
  border-radius: clamp(10px, 1.5vw, 12px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

@media (min-width: 992px) {
  .roomAction {
    margin-top: var(--space-2xl);
    margin-bottom: var(--space-xl);
    padding: var(--space-lg);
  }
}

/* Responsive layout for roomBedandPrice on larger screens */
@media (min-width: 1024px) {
  /* Override parent max-width constraint from rooms.css to allow proper flex layout */
  .room {
    flex-direction: column !important; /* Stack roomDesc and roomBedandPrice vertically */
    align-items: stretch !important; /* Allow children to take full width */
  }

  .room > .roomDesc {
    max-width: none !important;
    flex: 0 0 auto; /* Don't grow or shrink, take natural width */
    width: 100% !important; /* Use 100% of container width */
    min-width: 0;
  }

  .room > .roomBedandPrice {
    max-width: none !important;
    flex: 0 0 auto; /* Don't grow or shrink, take natural width */
    width: 100% !important; /* Use 100% of container width */
    min-width: 0 !important; /* Remove min-width constraint to allow container to size naturally */
  }

  /* Internal flex layout for roomBedandPrice */
  .roomBedandPrice {
    flex-direction: row;
    flex-wrap: wrap; /* Allow roomAction to wrap to new line */
    align-items: flex-start;
    gap: var(--space-2xl);
    width: 100%;
    min-width: 0; /* Remove min-width constraint, let flex items determine width */
  }

  .roomBedandPrice > .roomBed,
  .roomBedandPrice > #roomBed {
    flex: 1 1 calc(55% - 16px) !important; /* Account for half the gap */
    min-width: 0; /* Allow flex item to shrink below content width */
    max-width: none !important; /* Remove max-width constraint */
    width: auto !important; /* Override base width: 100% to let flex handle width */
  }

  .roomBedandPrice > .roomPrice {
    flex: 1 1 calc(45% - 16px) !important; /* Account for half the gap */
    min-width: 0; /* Allow flex item to shrink below content width */
    max-width: none !important; /* Remove max-width constraint */
    width: auto !important; /* Override base width: 100% to let flex handle width */
  }

  .roomAction {
    flex: 1 1 100%; /* Take full width and wrap to new line */
    width: 100%;
    min-width: 100%; /* Force to new line */
  }
}

/* Ensure roomBedandPrice has proper width at 1200px+ */
@media (min-width: 1200px) {
  .room > .roomBedandPrice {
    flex-basis: 650px !important;
    min-width: 650px !important;
  }

  .roomBedandPrice {
    min-width: 650px !important;
  }
}
