/* Availability Timeline Widget Styles */
/* Inspired by BookingMood timeline widget */

.availability-timeline {
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  padding: 20px;
  margin: 30px auto;
  max-width: 100%;
  overflow: hidden;
}

/* Timeline Controls */
.timeline-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 15px;
  border-bottom: 2px solid #f0f0f0;
  flex-wrap: wrap;
  gap: 15px;
}

.timeline-nav {
  display: flex;
  gap: 10px;
  align-items: center;
}

.timeline-month-nav {
  display: flex;
  align-items: center;
  gap: 0;
  flex-wrap: nowrap;
}

.timeline-btn {
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 4px;
  padding: 8px 16px;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  gap: 5px;
}

.timeline-btn:hover {
  background: #f8f9fa;
  border-color: #fed136;
}

.timeline-btn i {
  font-size: 12px;
}

.timeline-btn-month {
  /* Same style as regular timeline-btn */
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 4px;
  padding: 8px 16px;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  gap: 5px;
  min-width: 44px;
  flex-shrink: 0;
}

.timeline-btn-month:hover {
  background: #f8f9fa;
  border-color: #fed136;
}

.timeline-btn-month i {
  font-size: 12px;
}

#timeline-prev-month {
  margin-right: 15px;
}

#timeline-next-month {
  margin-left: 15px;
}

.timeline-month-picker-wrapper {
  position: relative;
}

.timeline-month-year {
  font-size: 22px;
  font-weight: 700;
  color: #333;
  min-width: 200px;
  text-align: center;
  white-space: nowrap;
  flex-shrink: 0;
  padding: 8px 12px;
  background: transparent;
  border: none;
  cursor: pointer;
  border-radius: 8px;
  transition: background 0.2s ease;
}

.timeline-month-year:hover {
  background: #f5f5f5;
}

/* Month Picker Dropdown */
.timeline-month-picker {
  position: absolute;
  top: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  padding: 16px;
  z-index: 100;
  display: none;
  min-width: 280px;
}

.timeline-month-picker.active {
  display: block;
  animation: fadeInDown 0.2s ease;
}

@keyframes fadeInDown {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
}

.month-picker-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid #eee;
}

.month-picker-year {
  font-size: 18px;
  font-weight: 600;
  color: #333;
}

.month-picker-nav {
  background: transparent;
  border: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #666;
  transition: all 0.2s ease;
}

.month-picker-nav:hover {
  background: #f0f0f0;
  color: #333;
}

.month-picker-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.month-picker-item {
  padding: 10px 8px;
  text-align: center;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  color: #555;
  background: transparent;
  border: none;
  transition: all 0.2s ease;
}

.month-picker-item:hover {
  background: #f5f5f5;
  color: #333;
}

.month-picker-item.current {
  background: #fed136;
  color: #333;
  font-weight: 600;
}

.month-picker-item.selected {
  background: #1a3c5a;
  color: #fff;
}

/* Mobile today button - hidden by default */
.timeline-btn-today-mobile {
  display: none;
}

/* Timeline Grid */
.timeline-grid {
  overflow-x: hidden;
  overflow-y: visible;
  position: relative;
}

.timeline-header {
  display: flex;
  position: sticky;
  top: 0;
  background: #fff;
  z-index: 10;
  border-bottom: 1px solid #e0e0e0;
  align-items: stretch;
}

.timeline-house-label {
  min-width: 120px;
  width: 120px;
  padding: 10px 8px;
  font-weight: 600;
  color: #666;
  font-size: 13px;
  display: flex;
  align-items: center;
  border-right: 1px solid #e0e0e0;
  position: sticky;
  left: 0;
  z-index: 20;
  background: #fff;
  flex: 0 0 120px;
  box-sizing: border-box;
}

.timeline-date {
  min-width: 28px;
  width: 0;
  flex: 1 1 0;
  text-align: center;
  padding: 8px 2px;
  font-size: 11px;
  border-right: 1px solid #f0f0f0;
  box-sizing: border-box;
}

.timeline-date.today {
  background: #fff3cd;
  font-weight: 600;
}

.timeline-date.weekend {
  background: #f8f9fa;
}

.timeline-date.past {
  opacity: 0.5;
}

.timeline-date.past .date-day,
.timeline-date.past .date-num {
  color: #999;
}

.date-day {
  color: #666;
  font-size: 10px;
  text-transform: uppercase;
}

.date-num {
  color: #333;
  font-weight: 600;
  font-size: 13px;
  margin-top: 1px;
}

/* Timeline Body */
.timeline-body {
  display: flex;
  flex-direction: column;
}

.timeline-row {
  display: flex;
  border-bottom: 1px solid #f0f0f0;
  min-height: 50px;
  align-items: stretch;
}

.timeline-row:hover {
  background: #fafafa;
}

.timeline-house-name {
  min-width: 120px;
  width: 120px;
  padding: 10px 8px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  border-right: 1px solid #e0e0e0;
  background: #fff;
  position: sticky;
  left: 0;
  z-index: 15;
  flex: 0 0 120px;
  box-sizing: border-box;
}

.timeline-house-name strong {
  font-size: 13px;
  color: #333;
  margin-bottom: 3px;
}

.house-capacity {
  font-size: 12px;
  color: #666;
}

.house-capacity i {
  margin-right: 4px;
  color: #fed136;
}

.timeline-cell {
  min-width: 28px;
  width: 0;
  flex: 1 1 0;
  border-right: 1px solid #f0f0f0;
  position: relative;
  cursor: pointer;
  transition: background 0.2s ease;
  box-sizing: border-box;
}

.timeline-cell:hover:not(.booked) {
  background: #f0f7ff;
}

.timeline-cell.weekend:not(.booked) {
  background: #fafafa;
}

.timeline-cell.past {
  opacity: 0.4;
  cursor: default;
}

.timeline-cell.past:hover:not(.booked) {
  background: transparent;
}

/* Booking States */
.timeline-cell.booked {
  background: transparent;
  position: relative;
}

.timeline-cell.booked::before {
  content: '';
  position: absolute;
  top: 5px;
  bottom: 5px;
  left: 0;
  right: 0;
  background: #fed136;
  pointer-events: none;
}



.timeline-cell.booked-middle {
  /* Keep default border color */
}

.timeline-cell.booked:hover {
  cursor: help;
}

/* Light and Dark booking variants for overlapping bookings */
/* Light variant - default yellow */
.timeline-cell.booked-light::before {
  background: #fed136;
}

/* Dark variant - darker orange for contrast */
.timeline-cell.booked-dark::before {
  background: #f0a500;
}

/* Full day bookings (middle days) - solid color based on variant */
.timeline-cell.booked-middle.booked-light::before {
  background: #fed136;
}

.timeline-cell.booked-middle.booked-dark::before {
  background: #f0a500;
}

/* Check-in/Check-out Visual Indicators */
/* Check-in day: starts at 14:00 (afternoon only) - show as right half */
.timeline-cell.booked-checkin.booked-light::before {
  left: 50%;
  background: #fed136;
}

.timeline-cell.booked-checkin.booked-dark::before {
  left: 50%;
  background: #f0a500;
}

/* Check-out day: ends at 10:00 (morning only) - show as left half */
.timeline-cell.booked-checkout.booked-light::before {
  right: 50%;
  background: #fed136;
}

.timeline-cell.booked-checkout.booked-dark::before {
  right: 50%;
  background: #f0a500;
}

/* Same-day turnover: checkout + checkin on same day */
/* Light checkout (left) → Dark checkin (right) */
.timeline-cell.booked-turnover-light-dark::before {
  background: linear-gradient(to right,
    #fed136 0%,
    #fed136 calc(50% - 1px),
    rgba(0,0,0,0.15) calc(50% - 1px),
    rgba(0,0,0,0.15) calc(50% + 1px),
    #f0a500 calc(50% + 1px),
    #f0a500 100%);
}

/* Dark checkout (left) → Light checkin (right) */
.timeline-cell.booked-turnover-dark-light::before {
  background: linear-gradient(to right,
    #f0a500 0%,
    #f0a500 calc(50% - 1px),
    rgba(0,0,0,0.15) calc(50% - 1px),
    rgba(0,0,0,0.15) calc(50% + 1px),
    #fed136 calc(50% + 1px),
    #fed136 100%);
}

/* Light checkout (left) → Light checkin (right) - shouldn't happen but just in case */
.timeline-cell.booked-turnover-light-light::before {
  background: #fed136;
}

/* Dark checkout (left) → Dark checkin (right) - shouldn't happen but just in case */
.timeline-cell.booked-turnover-dark-dark::before {
  background: #f0a500;
}

/* Hover states */
.timeline-cell.booked-light:hover {
  opacity: 0.9;
}

.timeline-cell.booked-dark:hover {
  opacity: 0.9;
}

.timeline-cell.booked-checkin:hover,
.timeline-cell.booked-checkout:hover {
  opacity: 0.9;
}

/* Responsive Design */
@media (max-width: 992px) {
  .timeline-house-label,
  .timeline-house-name {
    min-width: 100px;
    width: 100px;
  }

  .timeline-house-name strong {
    font-size: 12px;
  }

  .house-capacity {
    font-size: 10px;
  }

  .timeline-date {
    min-width: 24px;
    padding: 6px 1px;
  }

  .timeline-cell {
    min-width: 24px;
  }

  .date-day {
    font-size: 9px;
  }

  .date-num {
    font-size: 11px;
  }
}

@media (max-width: 768px) {
  .availability-timeline {
    padding: 15px;
  }

  .timeline-controls {
    flex-direction: column;
    align-items: stretch;
  }

  /* Hide desktop week navigation on mobile */
  .timeline-nav-desktop {
    display: none !important;
  }

  .timeline-month-nav {
    justify-content: center;
    order: 1;
    gap: 8px;
  }

  .timeline-month-year {
    font-size: 15px;
    min-width: 180px;
  }

  .timeline-btn-month {
    padding: 7px 12px;
    min-width: 42px;
  }

  #timeline-prev-month {
    margin-right: 0;
  }

  #timeline-next-month {
    margin-left: 0;
  }

  /* Show mobile today button */
  .timeline-btn-today-mobile {
    display: flex !important;
    background: #fed136;
    border-color: #fed136;
    color: #333;
    padding: 7px 12px;
    min-width: 42px;
  }

  .timeline-btn-today-mobile:hover {
    background: #ffc107;
    border-color: #ffc107;
  }

  .timeline-btn-today-mobile i {
    font-size: 14px;
  }

  .timeline-house-label,
  .timeline-house-name {
    min-width: 100px;
    width: 100px;
    font-size: 12px;
  }

  .timeline-date {
    min-width: 35px;
  }

  .timeline-cell {
    min-width: 35px;
  }

  .date-day {
    font-size: 10px;
  }

  .date-num {
    font-size: 12px;
  }

  .timeline-btn {
    padding: 6px 12px;
    font-size: 13px;
  }
}

@media (max-width: 576px) {
  .timeline-month-year {
    font-size: 13px;
    min-width: 160px;
    line-height: 1.3;
  }

  .timeline-btn-month {
    padding: 6px 10px;
    min-width: 38px;
  }

  #timeline-prev-month {
    margin-right: 8px;
  }

  #timeline-next-month {
    margin-left: 8px;
  }

  .timeline-house-label,
  .timeline-house-name {
    min-width: 70px;
    width: 70px;
  }

  .timeline-house-name strong {
    font-size: 11px;
  }

  .house-capacity {
    font-size: 9px;
  }

  .timeline-date {
    min-width: 35px;
    flex: 1;
  }

  .timeline-cell {
    min-width: 35px;
    flex: 1;
  }
}

/* Loading State */
.timeline-loading {
  text-align: center;
  padding: 40px;
  color: #666;
}

.timeline-loading i {
  font-size: 32px;
  color: #fed136;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Admin Menu Styling */
#admin-menu {
  animation: slideInUp 0.3s ease-out;
}

@keyframes slideInUp {
  from {
    transform: translateY(20px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

/* Admin Sign-In Button Styling */
#admin-sign-in-container {
  animation: fadeIn 0.5s ease-out;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

#admin-sign-in-container button:hover {
  background: rgba(255,255,255,0.2) !important;
  border-color: rgba(255,255,255,0.5) !important;
  color: rgba(255,255,255,0.9) !important;
}

@media (max-width: 576px) {
  #admin-menu {
    bottom: 10px;
    right: 10px;
  }

  #admin-menu > div {
    min-width: 160px;
    padding: 12px;
  }

  #admin-menu a {
    font-size: 13px;
    padding: 6px 8px;
  }

  #admin-sign-in-container,
  #nav-user-menu {
    bottom: 10px !important;
    left: 10px !important;
  }
}

/* Scrollbar Styling */
.timeline-grid::-webkit-scrollbar {
  height: 8px;
}

.timeline-grid::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 4px;
}

.timeline-grid::-webkit-scrollbar-thumb {
  background: #fed136;
  border-radius: 4px;
}

.timeline-grid::-webkit-scrollbar-thumb:hover {
  background: #ffc107;
}

/* Mini Availability Calendar for Modals */
.mini-availability-calendar {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 20px;
    margin: 20px 0;
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
}

.mini-cal-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 15px;
}

.mini-cal-title {
    font-size: 18px;
    font-weight: 600;
    color: #333;
    min-width: 180px;
    text-align: center;
}

.mini-cal-btn {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 6px 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
}

.mini-cal-btn:hover {
    background: #f8f9fa;
    border-color: #fed136;
}

.mini-cal-btn i {
    font-size: 12px;
    color: #666;
}

.mini-cal-today {
    background: #fed136;
    border-color: #fed136;
}

.mini-cal-today:hover {
    background: #ffc107;
    border-color: #ffc107;
}

.mini-cal-today i {
    color: #333;
}

.mini-cal-grid {
    margin-bottom: 15px;
}

.mini-cal-days-header {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
    margin-bottom: 8px;
}

.mini-cal-day-name {
    text-align: center;
    font-size: 12px;
    font-weight: 600;
    color: #666;
    padding: 8px 4px;
}

.mini-cal-days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
}

.mini-cal-day {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    border-radius: 4px;
    background: #f8f9fa;
    color: #333;
    cursor: default;
    transition: all 0.2s ease;
}

.mini-cal-day.empty {
    background: transparent;
}

.mini-cal-day.today {
    background: #fff3cd;
    font-weight: 900;
    border: 3px solid #fed136;
    font-size: 16px;
    box-shadow: 0 2px 4px rgba(254, 209, 54, 0.3);
    outline: 2px solid #333;
    outline-offset: -1px;
}

.mini-cal-day.weekend:not(.booked-middle):not(.booked-start):not(.booked-end):not([class*="booked-turnover"]) {
    background: #e9ecef;
}

.mini-cal-day.past {
    opacity: 0.4;
    color: #999;
}

/* Booked days - full day */
.mini-cal-day.booked-middle.booked-light {
    background: #fed136;
    color: #333;
    font-weight: 600;
}

.mini-cal-day.booked-middle.booked-dark {
    background: #f0a500;
    color: #333;
    font-weight: 600;
}

/* Start day - diagonal split (bottom-left to top-right) */
/* Bottom-right half is colored (check-in at 14:00, afternoon/evening) */
.mini-cal-day.booked-start.booked-light {
    background: linear-gradient(135deg,
    transparent 0%,
    transparent 50%,
    #fed136 50%,
    #fed136 100%);
    color: #333;
    font-weight: 600;
    position: relative;
}

.mini-cal-day.booked-start.booked-dark {
    background: linear-gradient(135deg,
    transparent 0%,
    transparent 50%,
    #f0a500 50%,
    #f0a500 100%);
    color: #333;
    font-weight: 600;
    position: relative;
}

/* End day - diagonal split (bottom-left to top-right) */
/* Top-left half is colored (check-out at 10:00, morning only) */
.mini-cal-day.booked-end.booked-light {
    background: linear-gradient(135deg,
    #fed136 0%,
    #fed136 50%,
    transparent 50%,
    transparent 100%);
    color: #333;
    font-weight: 600;
    position: relative;
}

.mini-cal-day.booked-end.booked-dark {
    background: linear-gradient(135deg,
    #f0a500 0%,
    #f0a500 50%,
    transparent 50%,
    transparent 100%);
    color: #333;
    font-weight: 600;
    position: relative;
}

/* Same-day turnover: checkout in morning + checkin in afternoon */
/* Top-left is checkout color, bottom-right is checkin color */
.mini-cal-day.booked-turnover-light-dark {
    background: linear-gradient(135deg,
    #fed136 0%,
    #fed136 50%,
    #f0a500 50%,
    #f0a500 100%);
    color: #333;
    font-weight: 600;
    position: relative;
}

.mini-cal-day.booked-turnover-dark-light {
    background: linear-gradient(135deg,
    #f0a500 0%,
    #f0a500 50%,
    #fed136 50%,
    #fed136 100%);
    color: #333;
    font-weight: 600;
    position: relative;
}

/* Same color turnovers - show diagonal with same color on both sides */
.mini-cal-day.booked-turnover-light-light {
    background: linear-gradient(135deg,
    #fed136 0%,
    #fed136 50%,
    #fed136 50%,
    #fed136 100%);
    color: #333;
    font-weight: 600;
    position: relative;
}

.mini-cal-day.booked-turnover-dark-dark {
    background: linear-gradient(135deg,
    #f0a500 0%,
    #f0a500 50%,
    #f0a500 50%,
    #f0a500 100%);
    color: #333;
    font-weight: 600;
    position: relative;
}

.mini-cal-legend {
    display: flex;
    justify-content: center;
    gap: 20px;
    padding-top: 15px;
    border-top: 1px solid #e0e0e0;
}

.mini-cal-legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: #666;
}

.mini-cal-legend-color {
    width: 20px;
    height: 20px;
    border-radius: 4px;
}

.mini-cal-legend-color.available {
    background: #f8f9fa;
    border: 1px solid #ddd;
}

.mini-cal-legend-color.booked {
    background: #fed136;
}

/* Mobile adjustments for mini calendar */
@media (max-width: 576px) {
    .mini-availability-calendar {
        padding: 15px;
    }

    .mini-cal-title {
        font-size: 16px;
        min-width: 150px;
    }

    .mini-cal-btn {
        padding: 5px 8px;
        min-width: 32px;
        height: 32px;
    }

    .mini-cal-day-name {
        font-size: 11px;
        padding: 6px 2px;
    }

    .mini-cal-day {
        font-size: 12px;
    }

    .mini-cal-legend {
        flex-direction: column;
        gap: 10px;
        align-items: center;
    }

    .mini-cal-legend-item {
        font-size: 12px;
    }
}


