/* PG Detail Page Styles */
:root {
    --primary-color: #FF6D00; /* Vibrant Orange */
    --primary-dark: #E65100; /* Darker Orange */
    --primary-light: #FF9E80; /* Lighter Orange */
    --bg-dark: #000000; /* Pure Black */
    --bg-card: #121212; /* Dark Gray for cards */
    --bg-page: #000000; /* Page Background */
    --text-white: #FFFFFF;
    --text-gray: #B0B0B0; /* Light Gray text */
    --text-muted: #666666;
    --border-color: #333333;
    --success-color: #4CAF50;
    --radius-lg: 16px;
    --radius-md: 12px;
    --radius-sm: 8px;
    --shadow-card: 0 4px 20px rgba(0, 0, 0, 0.5);
}

/* Prevent overflow globally */
* {
    box-sizing: border-box;
}

html, body {
    overflow-x: hidden;
    width: 100%;
    max-width: 100vw;
    position: relative;
}

body {
    background-color: var(--bg-page);
    color: var(--text-gray);
    font-family: 'Inter', sans-serif;
}

/* Layout */
.detail-container {
    max-width: 1280px;
    width: 100%;
    margin: 100px auto 2rem; /* Top margin for fixed header */
    padding: 0 1.5rem;
    display: grid;
    grid-template-columns: 1.5fr 1fr;
    gap: 2rem;
    box-sizing: border-box;
}

/* Left Column: Gallery & Details */
.detail-left {
    display: flex;
    flex-direction: column;
    gap: 2rem;
    min-width: 0; /* Allow grid item to shrink below content size */
    max-width: 100%;
    overflow: hidden;
}

/* Gallery */
.gallery-container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    width: 100%;
    max-width: 100%;
    min-width: 0;
}

.main-image {
    width: 100%;
    max-width: 100%;
    height: 400px;
    border-radius: var(--radius-lg);
    overflow: hidden;
    border: 1px solid var(--border-color);
}

.main-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.thumbnail-grid {
    display: flex;
    gap: 1rem;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: var(--primary-color) var(--bg-card);
    padding-bottom: 0.5rem;
    max-width: 100%;
    width: 100%;
}

/* Hide scrollbar for Chrome, Safari and Opera */
.thumbnail-grid::-webkit-scrollbar {
    height: 6px;
}

.thumbnail-grid::-webkit-scrollbar-track {
    background: var(--bg-card);
    border-radius: 10px;
}

.thumbnail-grid::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 10px;
}

.thumbnail-grid::-webkit-scrollbar-thumb:hover {
    background: var(--primary-dark);
}

.thumbnail {
    min-width: 150px;
    height: 100px;
    border-radius: var(--radius-md);
    overflow: hidden;
    cursor: pointer;
    border: 2px solid transparent;
    transition: border-color 0.3s ease;
    scroll-snap-align: start;
    flex-shrink: 0;
}

.thumbnail.active, .thumbnail:hover {
    border-color: var(--primary-color);
}

.thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}


/* Content Sections */
.content-section {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 2rem;
    border: 1px solid var(--border-color);
    width: 100%;
    box-sizing: border-box;
}

.section-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-white);
    margin-bottom: 1.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--primary-color);
    display: inline-block;
    max-width: 100%;
}

/* Amenities */
.amenities-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(200px, 100%), 1fr));
    gap: 1.5rem;
    width: 100%;
}

.amenity-category {
    margin-bottom: 2rem;
}

.amenity-category h3 {
    color: var(--primary-light);
    margin-bottom: 1rem;
    font-size: 1.1rem;
}

.amenity-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--text-white);
    font-size: 0.95rem;
}

.amenity-icon {
    color: var(--primary-color);
    font-size: 1.2rem;
}

/* Food Menu */
.food-menu-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
    table-layout: fixed;
}

.food-menu-table th, .food-menu-table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.food-menu-table th {
    color: var(--primary-color);
    font-weight: 600;
}

.food-menu-table td {
    color: var(--text-gray);
}

/* Right Column: Schedule & Pricing */
.detail-right {
    position: sticky;
    top: 100px;
    height: fit-content;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    min-width: 0; /* Allow grid item to shrink */
    max-width: 100%;
}

.booking-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 2rem;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-card);
}

.price-header {
    margin-bottom: 1.5rem;
}

.price-label {
    font-size: 0.9rem;
    color: var(--text-muted);
}

.price-amount {
    font-size: 2rem;
    font-weight: 800;
    color: var(--primary-color);
}

.price-period {
    font-size: 1rem;
    color: var(--text-gray);
}

.booking-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.form-group input, .form-group select {
    width: 100%;
    padding: 1rem;
    background: var(--bg-page);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-white);
    font-family: inherit;
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.btn-block {
    width: 100%;
    padding: 1rem;
    font-size: 1rem;
    font-weight: 700;
    text-transform: uppercase;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-primary {
    background: var(--primary-color);
    color: var(--text-white);
}

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-secondary {
    background: transparent;
    border: 1px solid var(--primary-color);
    color: var(--primary-color);
}

.btn-secondary:hover {
    background: rgba(255, 109, 0, 0.1);
}

/* Similar Properties */
.similar-properties {
    margin-top: 4rem;
    display: block; /* Override grid from detail-container */
    grid-template-columns: none; /* Reset grid columns */
    width: 100%;
    max-width: 1280px;
    box-sizing: border-box;
}

.properties-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr));
    gap: 2rem;
    margin-top: 2rem;
    width: 100%;
    box-sizing: border-box;
}

/* Responsive */
@media (max-width: 968px) {
    .detail-container {
        grid-template-columns: 1fr;
        padding: 0 1rem;
        margin: 80px auto 0 auto;
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
        overflow-x: hidden;
    }
    
    .detail-left, .detail-right {
        padding: 0;
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }
    
    .content-section {
        width: 100%;
        max-width: 100%;
        margin: 0 0 1rem 0;
        padding: 1.5rem;
        box-sizing: border-box;
        overflow-x: hidden;
    }
    
    .section-title {
        width: 100%;
        max-width: none;
        white-space: normal;
        word-wrap: break-word;
    }
    
    /* Ensure text content is not cropped */
    p, h1, h2, h3, h4, h5, h6, li, td, th {
        width: auto;
        max-width: 100%;
        word-wrap: break-word;
        overflow-wrap: break-word;
    }
    
    /* Constrain only images and media */
    img, video, iframe {
        max-width: 100%;
        height: auto;
    }
    
    /* Food menu table wrapper for horizontal scroll */
    .content-section:has(.food-menu-table) {
        overflow-x: auto;
    }
    
    .food-menu-table {
        display: table;
        min-width: 100%;
        width: max-content;
        table-layout: auto;
    }
    
    .food-menu-table th,
    .food-menu-table td {
        white-space: nowrap;
        padding: 0.75rem;
    }
    
    /* Ensure form elements fit */
    input, select, textarea, button {
        max-width: 100%;
        box-sizing: border-box;
    }
    
    /* Amenities grid */
    .amenities-grid {
        grid-template-columns: 1fr;
        width: 100%;
    }
    
    .amenity-item {
        width: 100%;
        word-wrap: break-word;
    }
    
    .page-title {
        width: 100%;
        word-wrap: break-word;
        overflow-wrap: break-word;
    }
    
    .pg-location {
        width: 100%;
        word-wrap: break-word;
        overflow-wrap: break-word;
    }
    
    .detail-right {
        position: static;
    }
    
    .booking-card {
        width: 100%;
        max-width: 100%;
        margin: 0 0 1rem 0;
        box-sizing: border-box;
    }
    
    .gallery-container {
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }
    
    .breadcrumbs {
        width: 100%;
        box-sizing: border-box;
        overflow-wrap: break-word;
    }
    
    .main-image {
        height: 300px;
        width: 100%;
    }
    
    /* Similar Properties section fix */
    .similar-properties {
        padding: 0 1rem;
        margin-left: 0;
        margin-right: 0;
        max-width: 100%;
        overflow-x: hidden;
    }

    /* Mobile Horizontal Scroll for Similar Properties */
    .similar-properties .properties-grid {
        display: flex;
        overflow-x: auto;
        scroll-snap-type: x mandatory;
        gap: 1rem;
        padding-bottom: 1rem; /* Space for scrollbar if visible */
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none; /* Hide scrollbar Firefox */
        width: 100%;
    }

    .similar-properties .properties-grid::-webkit-scrollbar {
        display: none; /* Hide scrollbar Chrome/Safari */
    }

    .similar-properties .pg-card {
        min-width: 280px; /* Fixed width for carousel items */
        max-width: 280px;
        flex-shrink: 0;
        scroll-snap-align: start;
    }
}
