/**
 * HRM Room Listing Styles
 * 
 * Professional, responsive, and accessible styles for room listings
 * Supports both grid and list layouts with lazy loading
 *
 * @package HRM_Room_Listing
 * @version 1.0.0
 */

/* ==========================================================================
   CSS Variables (Theme Customization)
   ========================================================================== */
:root {
    --hrm-primary-color: #2563eb;
    --hrm-primary-hover: #1d4ed8;
    --hrm-text-color: #1f2937;
    --hrm-text-light: #6b7280;
    --hrm-border-color: #e5e7eb;
    --hrm-background: #ffffff;
    --hrm-background-alt: #f9fafb;
    --hrm-shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --hrm-shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --hrm-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --hrm-transition: all 0.3s ease;
    --hrm-border-radius: 8px;
}

/* ==========================================================================
   Container Styles
   ========================================================================== */
.hrm-room-listing {
    width: 100%;
    margin: 0 auto;
    padding: 0;
}

.hrm-rooms-container {
    display: grid;
    gap: 24px;
    margin-bottom: 32px;
}

/* ==========================================================================
   Grid Layout
   ========================================================================== */
.hrm-room-grid .hrm-rooms-container {
    grid-template-columns: 1fr;
}

/* Grid: 2 Columns */
.hrm-room-grid.hrm-grid-columns-2 .hrm-rooms-container {
    grid-template-columns: 1fr;
}

@media (min-width: 640px) {
    .hrm-room-grid.hrm-grid-columns-2 .hrm-rooms-container {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Grid: 3 Columns */
.hrm-room-grid.hrm-grid-columns-3 .hrm-rooms-container {
    grid-template-columns: 1fr;
}

@media (min-width: 640px) {
    .hrm-room-grid.hrm-grid-columns-3 .hrm-rooms-container {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 1024px) {
    .hrm-room-grid.hrm-grid-columns-3 .hrm-rooms-container {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Grid: 4 Columns */
.hrm-room-grid.hrm-grid-columns-4 .hrm-rooms-container {
    grid-template-columns: 1fr;
}

@media (min-width: 640px) {
    .hrm-room-grid.hrm-grid-columns-4 .hrm-rooms-container {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 1024px) {
    .hrm-room-grid.hrm-grid-columns-4 .hrm-rooms-container {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (min-width: 1280px) {
    .hrm-room-grid.hrm-grid-columns-4 .hrm-rooms-container {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* ==========================================================================
   List Layout
   ========================================================================== */
.hrm-room-list .hrm-rooms-container {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.hrm-room-list .hrm-room-card {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0;
}

@media (min-width: 768px) {
    .hrm-room-list .hrm-room-card {
        grid-template-columns: 320px 1fr;
    }
}

@media (min-width: 1024px) {
    .hrm-room-list .hrm-room-card {
        grid-template-columns: 400px 1fr;
    }
}

/* ==========================================================================
   Room Card
   ========================================================================== */
.hrm-room-card {
    background: var(--hrm-background);
    border: 1px solid var(--hrm-border-color);
    border-radius: var(--hrm-border-radius);
    overflow: hidden;
    transition: var(--hrm-transition);
    display: flex;
    flex-direction: column;
}

.hrm-room-card:hover {
    box-shadow: var(--hrm-shadow-lg);
    transform: translateY(-2px);
}

.hrm-room-card:focus-within {
    outline: 2px solid var(--hrm-primary-color);
    outline-offset: 2px;
}

/* List layout specific styles */
.hrm-room-list .hrm-room-card {
    flex-direction: row;
}

/* ==========================================================================
   Room Image
   ========================================================================== */
.hrm-room-image-wrapper {
    position: relative;
    width: 100%;
    overflow: hidden;
    background: var(--hrm-background-alt);
}

.hrm-room-grid .hrm-room-image-wrapper {
    padding-bottom: 66.67%; /* 3:2 aspect ratio */
}

.hrm-room-list .hrm-room-image-wrapper {
    height: 100%;
    min-height: 250px;
}

.hrm-room-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: var(--hrm-transition);
}

.hrm-room-card:hover .hrm-room-image {
    transform: scale(1.05);
}

/* Mobile list view */
@media (max-width: 767px) {
    .hrm-room-list .hrm-room-image-wrapper {
        padding-bottom: 56.25%; /* 16:9 aspect ratio */
        min-height: 0;
    }
}

/* ==========================================================================
   Price Badge
   ========================================================================== */
.hrm-room-price-badge {
    position: absolute;
    top: 16px;
    right: 16px;
    background: var(--hrm-primary-color);
    color: #ffffff;
    padding: 8px 16px;
    border-radius: 6px;
    font-weight: 600;
    font-size: 16px;
    line-height: 1.2;
    box-shadow: var(--hrm-shadow-md);
    z-index: 10;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
}

.hrm-price-amount {
    font-size: 20px;
    font-weight: 700;
}

.hrm-price-period {
    font-size: 12px;
    font-weight: 400;
    opacity: 0.9;
}

/* ==========================================================================
   Room Content
   ========================================================================== */
.hrm-room-content {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    flex: 1;
}

@media (min-width: 768px) {
    .hrm-room-content {
        padding: 24px;
        gap: 16px;
    }
}

/* ==========================================================================
   Room Title
   ========================================================================== */
.hrm-room-title {
    margin: 0;
    font-size: 20px;
    font-weight: 700;
    line-height: 1.3;
    color: var(--hrm-text-color);
}

@media (min-width: 768px) {
    .hrm-room-title {
        font-size: 24px;
    }
}

.hrm-room-title a {
    color: inherit;
    text-decoration: none;
    transition: color 0.2s ease;
}

.hrm-room-title a:hover {
    color: var(--hrm-primary-color);
}

.hrm-room-title a:focus {
    outline: 2px solid var(--hrm-primary-color);
    outline-offset: 2px;
    border-radius: 2px;
}

/* ==========================================================================
   Room Capacity
   ========================================================================== */
.hrm-room-capacity {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--hrm-text-light);
    font-size: 14px;
}

.hrm-icon {
    flex-shrink: 0;
}

.hrm-icon.hrm-unavailable {
    color: var(--hrm-danger-color, #d32f2f);
}

.hrm-unavailable-text {
    color: var(--hrm-danger-color, #d32f2f);
    font-weight: 500;
}

/* ==========================================================================
   Room Excerpt
   ========================================================================== */
.hrm-room-excerpt {
    color: var(--hrm-text-light);
    font-size: 15px;
    line-height: 1.6;
    margin: 0;
}

/* ==========================================================================
   Room Gallery
   ========================================================================== */
.hrm-room-gallery {
    margin: 12px 0;
    padding: 12px 0;
    border-top: 1px solid var(--hrm-border-color);
}

.hrm-gallery-thumbnails {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.hrm-gallery-item {
    display: block;
    width: 60px;
    height: 60px;
    border-radius: 6px;
    overflow: hidden;
    position: relative;
    flex-shrink: 0;
    transition: var(--hrm-transition);
    border: 2px solid transparent;
}

.hrm-gallery-item:hover {
    border-color: var(--hrm-primary-color);
    transform: scale(1.05);
}

.hrm-gallery-item:focus {
    outline: 2px solid var(--hrm-primary-color);
    outline-offset: 2px;
}

.hrm-gallery-thumb {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: var(--hrm-transition);
}

.hrm-gallery-item:hover .hrm-gallery-thumb {
    opacity: 0.9;
}

/* Responsive gallery */
@media (min-width: 768px) {
    .hrm-gallery-item {
        width: 70px;
        height: 70px;
    }
}

/* List layout gallery - inline style */
.hrm-room-list .hrm-room-gallery {
    margin-top: auto;
    border-top: none;
    padding-top: 8px;
}

.hrm-room-list .hrm-gallery-thumbnails {
    justify-content: flex-start;
}

/* ==========================================================================
   Room Amenities
   ========================================================================== */
.hrm-room-amenities {
    margin: 8px 0;
}

.hrm-amenity-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    list-style: none;
    margin: 0;
    padding: 0;
}

.hrm-amenity-item {
    background: var(--hrm-background-alt);
    color: var(--hrm-text-light);
    padding: 4px 12px;
    border-radius: 16px;
    font-size: 13px;
    border: 1px solid var(--hrm-border-color);
}

/* ==========================================================================
   Room Footer
   ========================================================================== */
.hrm-room-footer {
    margin-top: auto;
    padding-top: 8px;
}

.hrm-room-button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--hrm-primary-color);
    color: #ffffff;
    padding: 12px 24px;
    border: none;
    border-radius: 6px;
    font-size: 15px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: var(--hrm-transition);
    white-space: nowrap;
}

.hrm-room-button:hover {
    background: var(--hrm-primary-hover);
    transform: translateX(2px);
}

.hrm-room-button:focus {
    outline: 2px solid var(--hrm-primary-color);
    outline-offset: 2px;
}

.hrm-arrow-icon {
    transition: transform 0.2s ease;
}

.hrm-room-button:hover .hrm-arrow-icon {
    transform: translateX(4px);
}

/* ==========================================================================
   Load More Button
   ========================================================================== */
.hrm-room-load-more {
    text-align: center;
    margin-top: 32px;
}

.hrm-load-more-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--hrm-background);
    color: var(--hrm-primary-color);
    border: 2px solid var(--hrm-primary-color);
    padding: 14px 32px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--hrm-transition);
    min-width: 200px;
}

.hrm-load-more-button:hover {
    background: var(--hrm-primary-color);
    color: #ffffff;
}

.hrm-load-more-button:focus {
    outline: 2px solid var(--hrm-primary-color);
    outline-offset: 2px;
}

.hrm-load-more-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ==========================================================================
   Loading State
   ========================================================================== */
.hrm-room-loading {
    text-align: center;
    padding: 32px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

.hrm-loading-spinner {
    display: inline-block;
    width: 40px;
    height: 40px;
    border: 4px solid var(--hrm-border-color);
    border-top-color: var(--hrm-primary-color);
    border-radius: 50%;
    animation: hrm-spin 0.8s linear infinite;
}

@keyframes hrm-spin {
    to {
        transform: rotate(360deg);
    }
}

.hrm-loading-text {
    color: var(--hrm-text-light);
    font-size: 15px;
}

/* ==========================================================================
   No Rooms Message
   ========================================================================== */
.hrm-no-rooms {
    text-align: center;
    padding: 64px 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    color: var(--hrm-text-light);
}

.hrm-no-rooms-icon {
    opacity: 0.5;
}

.hrm-no-rooms-text {
    margin: 0;
    font-size: 16px;
}

/* ==========================================================================
   Accessibility
   ========================================================================== */
.hrm-room-listing *:focus-visible {
    outline: 2px solid var(--hrm-primary-color);
    outline-offset: 2px;
    border-radius: 2px;
}

/* Screen reader only content */
.hrm-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* ==========================================================================
   Print Styles
   ========================================================================== */
@media print {
    .hrm-room-load-more,
    .hrm-room-loading {
        display: none;
    }
    
    .hrm-room-card {
        page-break-inside: avoid;
    }
}

/* ==========================================================================
   High Contrast Mode
   ========================================================================== */
@media (prefers-contrast: high) {
    .hrm-room-card {
        border-width: 2px;
    }
    
    .hrm-room-button {
        border: 2px solid currentColor;
    }
}

/* ==========================================================================
   Reduced Motion
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ==========================================================================
   Lightbox Styles
   ========================================================================== */
.hrm-lightbox-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.hrm-lightbox-content {
    max-width: 90%;
    max-height: 90%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.hrm-lightbox-image {
    max-width: 100%;
    max-height: 85vh;
    object-fit: contain;
    border-radius: 4px;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.5);
}

.hrm-lightbox-close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 44px;
    height: 44px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 50%;
    color: #fff;
    font-size: 28px;
    cursor: pointer;
    transition: background 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.hrm-lightbox-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

.hrm-lightbox-prev,
.hrm-lightbox-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 50px;
    height: 50px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 50%;
    color: #fff;
    font-size: 24px;
    cursor: pointer;
    transition: background 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.hrm-lightbox-prev {
    left: 20px;
}

.hrm-lightbox-next {
    right: 20px;
}

.hrm-lightbox-prev:hover,
.hrm-lightbox-next:hover {
    background: rgba(255, 255, 255, 0.2);
}

.hrm-lightbox-counter {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    color: #fff;
    font-size: 14px;
    background: rgba(0, 0, 0, 0.5);
    padding: 8px 16px;
    border-radius: 20px;
}

/* Responsive lightbox */
@media (max-width: 768px) {
    .hrm-lightbox-prev,
    .hrm-lightbox-next {
        width: 40px;
        height: 40px;
        font-size: 20px;
    }
    
    .hrm-lightbox-prev {
        left: 10px;
    }
    
    .hrm-lightbox-next {
        right: 10px;
    }
    
    .hrm-lightbox-close {
        top: 10px;
        right: 10px;
    }
}
