/* Room Structure - Web View Styles (Laptop/Desktop) */
@media (min-width: 769px) {
  .room-structure-container {
    max-height: 85vh !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
  }

  .floor-card {
    height: auto !important;
    min-height: auto !important;
    width: 100% !important;
    max-width: 1200px !important;
    display: flex !important;
    flex-direction: column !important;
    overflow: visible !important;
    /* Let the floor wrap naturally around its content */
    box-sizing: border-box !important;
    padding: 0 !important;
    margin: 0 !important;
  }

  .floor-header {
    min-height: auto !important;
    height: auto !important;
    padding: 20px 24px !important;
    margin-bottom: 20px !important;
  }

  .floor-title {
    font-size: 1.4rem !important;
  }

  .floor-chip {
    font-size: 0.9rem !important;
  }

  .rooms-grid {
    display: flex !important;
    flex-wrap: wrap !important;
    align-items: stretch !important;
    gap: 16px !important;
    flex: 1 !important;
    padding: 0 20px 30px 20px !important;
    overflow: visible !important;
    min-height: auto !important;
    /* Let the grid expand naturally with its content */
    height: auto !important;
    box-sizing: border-box !important;
  }

  .room-card {
    min-height: 350px !important;
    height: auto !important;
    padding: 16px !important;
    display: flex !important;
    flex-direction: column !important;
    flex: 1 1 calc(33.33% - 11px) !important; /* 3 rooms per row */
    max-width: calc(33.33% - 11px) !important;
    min-width: 200px !important;
    align-self: stretch !important;
    /* Allow dynamic height based on content */
    box-sizing: border-box !important;
  }

  .room-header {
    flex-shrink: 0 !important;
    margin-bottom: 16px !important;
    padding-bottom: 12px !important;
  }

  .room-number {
    font-size: 1rem !important;
  }

  .beds-layout {
    flex: 1 !important;
    min-height: 80px !important;
    gap: 8px !important;
    justify-content: center !important;
    align-items: center !important;
    display: flex !important;
    flex-wrap: wrap !important;
    padding: 8px !important;
  }

  .bed-block {
    min-height: 36px !important;
    height: auto !important;
    font-size: 0.75rem !important;
    flex: 1 1 calc(33.33% - 4px) !important; /* 3 beds per row for better 6-bed layout */
    max-width: calc(33.33% - 4px) !important;
    min-width: 60px !important;
    padding: 6px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
  }

  /* Special handling for rooms with 6+ beds */
  .room-card:has(.bed-block:nth-child(6)) {
    min-height: 450px !important;
  }

  .bed-text-occupied {
    font-size: 0.8rem !important;
  }

  .bed-text-vacant {
    font-size: 0.75rem !important;
  }

  .room-info {
    flex-shrink: 0 !important;
    margin-top: 16px !important;
  }

  .rent-text {
    font-size: 0.85rem !important;
  }

  .bathroom-text {
    font-size: 0.75rem !important;
  }

  /* Responsive adjustments for different laptop sizes */
  @media (min-width: 1200px) {
    .floor-card {
      min-height: 450px !important;
    }
    .rooms-grid {
      min-height: 350px !important;
    }
    .room-card {
      flex: 1 1 calc(25% - 12px) !important; /* 4 rooms per row */
      max-width: calc(25% - 12px) !important;
      min-height: 280px !important;
    }
    .bed-block {
      flex: 1 1 calc(33.33% - 6px) !important; /* 3 beds per row */
      max-width: calc(33.33% - 6px) !important;
    }
  }

  @media (min-width: 1400px) {
    .floor-card {
      min-height: 500px !important;
    }
    .rooms-grid {
      min-height: 400px !important;
    }
    .room-card {
      flex: 1 1 calc(20% - 13px) !important; /* 5 rooms per row */
      max-width: calc(20% - 13px) !important;
      min-height: 300px !important;
    }
    .bed-block {
      flex: 1 1 calc(25% - 6px) !important; /* 4 beds per row */
      max-width: calc(25% - 6px) !important;
    }
  }

  @media (min-width: 1600px) {
    .floor-card {
      min-height: 550px !important;
    }
    .rooms-grid {
      min-height: 450px !important;
    }
    .room-card {
      flex: 1 1 calc(16.66% - 14px) !important; /* 6 rooms per row */
      max-width: calc(16.66% - 14px) !important;
      min-height: 320px !important;
    }
    .bed-block {
      flex: 1 1 calc(20% - 6px) !important; /* 5 beds per row */
      max-width: calc(20% - 6px) !important;
    }
  }
}

/* Room Structure - Mobile View Styles */
@media (max-width: 768px) {
  .room-structure-container {
    max-height: 70vh !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
  }

  .floor-card {
    height: auto !important;
    min-height: auto !important;
    width: 100% !important;
    max-width: 100% !important;
    display: flex !important;
    flex-direction: column !important;
    overflow: visible !important;
    /* Let the floor wrap naturally around its content on mobile */
    box-sizing: border-box !important;
    padding: 0 !important;
    margin: 0 !important;
  }

  .floor-header {
    min-height: auto !important;
    height: auto !important;
    padding: 16px 20px !important;
    margin-bottom: 16px !important;
  }

  .floor-title {
    font-size: 1.2rem !important;
  }

  .floor-chip {
    font-size: 0.8rem !important;
  }

  .rooms-grid {
    display: flex !important;
    flex-wrap: wrap !important;
    align-items: stretch !important;
    gap: 12px !important;
    flex: 1 !important;
    padding: 0 16px 24px 16px !important;
    overflow: visible !important;
    min-height: auto !important;
    /* Let the grid expand naturally with its content on mobile */
    box-sizing: border-box !important;
    height: auto !important;
  }

  .room-card {
    min-height: 320px !important;
    height: auto !important;
    padding: 12px !important;
    display: flex !important;
    flex-direction: column !important;
    flex: 1 1 calc(50% - 6px) !important; /* 2 rooms per row on mobile */
    max-width: calc(50% - 6px) !important;
    min-width: 140px !important;
    align-self: stretch !important;
    /* Ensure proper height calculation for mobile */
    box-sizing: border-box !important;
  }

  .room-header {
    flex-shrink: 0 !important;
    margin-bottom: 12px !important;
    padding-bottom: 8px !important;
  }

  .room-number {
    font-size: 0.9rem !important;
  }

  .beds-layout {
    flex: 1 !important;
    min-height: 60px !important;
    gap: 6px !important;
    justify-content: center !important;
    align-items: center !important;
    display: flex !important;
    flex-wrap: wrap !important;
    padding: 6px !important;
  }

  .bed-block {
    min-height: 28px !important;
    height: auto !important;
    font-size: 0.7rem !important;
    flex: 1 1 calc(50% - 3px) !important; /* 2 beds per row on mobile */
    max-width: calc(50% - 3px) !important;
    min-width: 50px !important;
    padding: 3px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
  }

  /* Special handling for rooms with 6+ beds on mobile */
  .room-card:has(.bed-block:nth-child(6)) {
    min-height: 400px !important;
  }

  .bed-text-occupied {
    font-size: 0.75rem !important;
  }

  .bed-text-vacant {
    font-size: 0.7rem !important;
  }

  .room-info {
    flex-shrink: 0 !important;
    margin-top: 12px !important;
  }

  .rent-text {
    font-size: 0.8rem !important;
  }

  .bathroom-text {
    font-size: 0.7rem !important;
  }

  /* Single column for very small mobile screens */
  @media (max-width: 480px) {
    .floor-card {
      min-height: 400px !important;
    }
    .rooms-grid {
      min-height: 300px !important;
    }
    .room-card {
      flex: 1 1 100% !important; /* 1 room per row */
      max-width: 100% !important;
      min-height: 250px !important;
    }
    .bed-block {
      flex: 1 1 calc(33.33% - 4px) !important; /* 3 beds per row on small mobile */
      max-width: calc(33.33% - 4px) !important;
    }
  }
}
