/* Gallery Pages Styling */

.gallery-page-container {
    max-width: 1400px;
    margin: 100px auto 60px;
    padding: 2rem;
}

.gallery-header {
    text-align: center;
    margin-bottom: 3rem;
}

.gallery-header h1 {
    color: var(--primary);
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

.gallery-header p {
    color: var(--text-color);
    font-size: 1.1rem;
    max-width: 600px;
    margin: 0 auto;
    opacity: 0.9;
}

/* Filter Bar */
.filter-bar {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
    margin-bottom: 3rem;
}

.search-sort-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
    width: 100%;
    max-width: 900px;
    margin: 0 auto;
}

.search-sort-container.flex-layout {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.filter-row-top, .filter-row-bottom {
    display: flex;
    gap: 0.5rem;
    width: 100%;
}

.search-box {
    flex: 1;
    position: relative;
}

.category-filters, .service-filters, .sort-box {
    position: relative;
    width: 100%;
    flex: 1;
}

@media (max-width: 767px) {
    .sort-box {
        width: 3.2rem;
        flex: 0 0 3.2rem;
    }
    select#gallery-sort.gallery-sort-select {
        color: transparent;
        padding: 1rem 0 !important;
    }
    select#gallery-sort.gallery-sort-select option {
        color: var(--text-color);
    }
    .sort-box::after {
        display: none !important;
    }
    .sort-icon {
        left: 50%;
        transform: translate(-50%, -50%);
    }
}

@media (min-width: 768px) {
    .search-sort-container {
        grid-template-columns: 1fr 1fr 1fr;
        gap: 1rem;
    }
    .search-sort-container.geppark-layout {
        grid-template-columns: 2fr 1fr;
    }
    .search-sort-container:not(.flex-layout) .search-box {
        grid-column: 1 / -1;
    }
    .geppark-layout .search-box {
        grid-column: span 1 !important;
    }
    
    .search-sort-container.flex-layout {
        gap: 1rem;
    }
    .filter-row-top, .filter-row-bottom {
        gap: 1rem;
    }
    .sort-box {
        flex: 0 0 250px;
    }
}

.search-box i {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--primary);
}

.search-box input {
    width: 100%;
    padding: 1rem 3rem 1rem 3rem;
    border: 1px solid var(--border-color);
    border-radius: 30px;
    background-color: var(--card-bg);
    color: var(--text-color);
    font-size: 1rem;
    font-family: 'Inter', sans-serif;
    outline: none;
    transition: all 0.3s;
    box-shadow: var(--shadow);
}

.search-box i.clear-search {
    left: auto;
    right: 1.2rem;
    cursor: pointer;
    color: var(--text-muted);
    transition: color 0.15s ease;
}

.search-box i.clear-search:hover {
    color: var(--text-color);
}

.gallery-sort-select {
    width: 100%;
    padding: 1rem 2rem 1rem 2.2rem;
    border: 1px solid var(--border-color);
    border-radius: 30px;
    background-color: var(--card-bg);
    color: var(--text-color);
    font-size: 0.85rem;
    font-family: 'Inter', sans-serif;
    font-weight: 500;
    position: relative;
    text-align: left;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    transition: all 0.3s;
}

.gallery-sort-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(234, 163, 16, 0.2);
}

.sort-icon, .filter-icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--primary);
    pointer-events: none;
    z-index: 10;
}

.sort-box::after {
    content: '\f0dc';
    font-family: 'Font Awesome 5 Free';
    font-weight: 900;
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--primary);
    pointer-events: none;
}

.search-box input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(234, 163, 16, 0.2);
}

.category-filters {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.75rem;
}

.custom-dropdown {
    position: relative;
    width: 100%;
    z-index: 100;
}

.dropdown-toggle {
    width: 100%;
    text-align: left;
    cursor: pointer;
    background-color: transparent;
}

.dropdown-toggle::after {
    content: '\f0dc';
    font-family: 'Font Awesome 5 Free';
    font-weight: 900;
    position: absolute;
    right: 1.5rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--primary);
    pointer-events: none;
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    min-width: 200px;
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    margin-top: 5px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    max-height: 300px;
    overflow-y: auto;
    display: none;
    flex-direction: column;
}

.dropdown-menu.show {
    display: flex;
}

.dropdown-item {
    padding: 0.6rem 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-color);
    border-bottom: 1px solid var(--border-color);
    font-size: 0.9rem;
}

.dropdown-item:last-child {
    border-bottom: none;
}

.dropdown-item:hover {
    background-color: rgba(234, 163, 16, 0.1);
}

.dropdown-item input[type="checkbox"] {
    cursor: pointer;
}

.dropdown-item.clear-all {
    color: #ef4444;
    font-weight: 600;
    justify-content: center;
    background-color: #fef2f2;
}

.dropdown-item.clear-all:hover {
    background-color: #fee2e2;
}

/* Masonry Grid */
.masonry-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    grid-auto-rows: 250px; /* Base height */
    grid-auto-flow: dense;
    gap: 1.5rem;
}

.masonry-item {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--shadow);
    cursor: pointer;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.3s;
    background-color: var(--card-bg);
}

.masonry-item.large {
    grid-column: span 2;
    grid-row: span 2;
}

.masonry-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0,0,0,0.2);
}

.masonry-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.masonry-item:hover img {
    transform: scale(1.05);
}

.masonry-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    background: linear-gradient(to top, rgba(0,0,0,0.9) 0%, rgba(0,0,0,0.4) 70%, transparent 100%);
    padding: 2rem 1.5rem 1.5rem;
    color: #fff;
    transform: translateY(20px);
    opacity: 0;
    transition: all 0.3s ease;
}

.masonry-item:hover .masonry-overlay {
    transform: translateY(0);
    opacity: 1;
}

.masonry-overlay h4 {
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
    font-weight: 700;
}

.masonry-overlay p {
    font-size: 0.9rem;
    color: #e5e7eb;
    margin: 0;
}

/* Hidden items for filtering */
.masonry-item.hidden {
    display: none;
}

.masonry-item.unavailable {
    filter: grayscale(80%);
    opacity: 0.7;
}

.unavailable-header {
    width: 100%;
    text-align: center;
    margin: 4rem 0 2rem 0;
    color: var(--text-color);
    border-top: 1px solid var(--border-color);
    padding-top: 2rem;
}

.unavailable-header h2 {
    font-size: 1.8rem;
    margin-bottom: 0.5rem;
}

.unavailable-header p {
    color: #6b7280;
}

/* Responsive adjustments */
@media (max-width: 992px) {
    /* Keep tablet masonry layout but adjust base height slightly if needed */
    .masonry-grid {
        grid-auto-rows: 200px;
    }
}

@media (max-width: 768px) {
    .gallery-page-container {
        padding: 0.5rem;
        margin-top: 80px;
    }
    
    .masonry-grid {
        /* Force 2 columns on mobile */
        grid-template-columns: repeat(2, 1fr);
        grid-auto-rows: 150px;
        gap: 0.5rem;
    }
    
    .masonry-item.large {
        grid-column: span 2;
        grid-row: span 2;
    }
    

    
    /* Make text slightly smaller to fit mobile screens and visible by default */
    .masonry-overlay {
        transform: translateY(0);
        opacity: 1;
        padding: 1.5rem 1rem 1rem;
    }
    .masonry-overlay h4 {
        font-size: 0.95rem;
    }

    .masonry-overlay p {
        font-size: 0.75rem;
        display: none; /* Hide subtitle on very small items to save space */
    }

    .masonry-overlay .spec-tags {
        display: none; /* Hide size and power tags to show more of the picture on mobile */
    }

}
