@import url('../variables.css');

/* Gallery Page Styles - Mobile First Approach */

:root {
    --primary-color: #333;
    --secondary-color: #c39b55;
    --text-color: #333;
    --light-text: #fff;
    --dark-bg: #1a1a1a;
    --light-bg: #f8f9fa;
    --border-color: #e1e1e1;
    --shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    --transition: all 0.3s ease;
    --accent-blue: #3498db;
}

body {
    margin: 0;
    padding: 0;
    scrollbar-width: none;
    -ms-overflow-style: none;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    font-family: 'Roboto', sans-serif;
    color: var(--text-color);
    background-color: #f8f9fa;
    overflow-x: hidden;
    width: 100%;
    max-width: 100%;
}

*::-webkit-scrollbar {
    display: none;
}

html {
    scroll-behavior: smooth;
}

html, body {
    height: 100%;
    margin: 0;
}

/* Apply box-sizing globally */
*, *::before, *::after {
    box-sizing: border-box;
}

/* Main content wrapper */
main {
    flex: 1 0 auto; /* Allow this to grow and push footer down */
}

/* Container */
.container-fluid {
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 15px;
}

/* Gallery Header Section */
.gallery-header {
    padding: 30px 0;
    text-align: center;
    background-color: var(--light-bg);
    border-bottom: 1px solid var(--border-color);
}

.gallery-header h1 {
    font-size: 28px;
    font-weight: 500;
    margin-bottom: 10px;
    color: var(--primary-color);
}

.gallery-header p {
    font-size: 16px;
    color: #666;
    margin-bottom: 25px;
}

/* Gallery Controls */
.gallery-controls {
    display: flex;
    flex-direction: column;
    gap: 20px;
    align-items: center;
}

.filter-controls {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    margin-bottom: 15px;
}

.filter-btn {
    padding: 8px 15px;
    background-color: #fff;
    border: 1px solid var(--border-color);
    border-radius: 20px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-color);
    cursor: pointer;
    transition: var(--transition);
}

.filter-btn:hover,
.filter-btn.active {
    background-color: var(--secondary-color);
    border-color: var(--secondary-color);
    color: var(--light-text);
}

.view-controls {
    display: flex;
    gap: 10px;
}

.view-btn {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #fff;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    color: var(--text-color);
    cursor: pointer;
    transition: var(--transition);
}

.view-btn:hover,
.view-btn.active {
    background-color: var(--secondary-color);
    border-color: var(--secondary-color);
    color: var(--light-text);
}

/* Gallery Main Section */
.gallery-main {
    padding: 30px 0;
}

.gallery-container {
    position: relative;
}

/* Grid View (Default) */
.gallery-container.grid-view {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
}

/* List View */
.gallery-container.list-view {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.gallery-container.list-view .gallery-item {
    display: flex;
    flex-direction: column;
}

.gallery-container.list-view .gallery-image {
    height: 200px;
}

.gallery-container.list-view .gallery-info {
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* Gallery Item */
.gallery-item {
    background-color: #fff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: var(--transition);
    border: 1px solid var(--border-color);
}

.gallery-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
}

.gallery-image {
    position: relative;
    height: 0;
    padding-bottom: 75%; /* 4:3 aspect ratio */
    overflow: hidden;
    background-color: #f0f0f0;
}

.gallery-image img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

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

.gallery-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: var(--transition);
}

.gallery-item:hover .gallery-overlay {
    opacity: 1;
}

.gallery-actions {
    display: flex;
    gap: 15px;
}

.action-btn {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--secondary-color);
    border: none;
    border-radius: 50%;
    color: var(--light-text);
    font-size: 16px;
    cursor: pointer;
    transition: var(--transition);
    transform: translateY(20px);
    opacity: 0;
}

.gallery-item:hover .action-btn {
    transform: translateY(0);
    opacity: 1;
}

.action-btn:hover {
    background-color: var(--light-text);
    color: var(--secondary-color);
}

.action-btn.view-btn {
    transition-delay: 0.1s;
}

.action-btn.download-btn {
    transition-delay: 0.2s;
}

.gallery-info {
    padding: 15px;
}

.gallery-info h3 {
    font-size: 16px;
    font-weight: 500;
    margin: 0 0 5px;
    color: var(--primary-color);
}

.gallery-info p {
    font-size: 14px;
    color: #666;
    margin: 0 0 10px;
}

.gallery-meta {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: #888;
}

/* Pagination */
.gallery-pagination-section {
    margin-top: 30px;
    padding-bottom: 10px;
}

.gallery-pagination-info {
    text-align: center;
    font-size: 14px;
    color: #666;
    margin-bottom: 14px;
}

.gallery-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 5px;
}

.gallery-pagination-item {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    padding: 0 10px;
    border-radius: 50%;
    background-color: #fff;
    color: var(--text-color);
    font-weight: 500;
    text-decoration: none;
    transition: var(--transition);
    border: 1px solid var(--border-color);
    box-sizing: border-box;
}

.gallery-pagination-item:hover {
    background-color: var(--light-bg);
}

.gallery-pagination-item.active {
    background-color: var(--secondary-color);
    color: var(--light-text);
    border-color: var(--secondary-color);
}

/* Lightbox */
.lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.lightbox.active {
    opacity: 1;
    visibility: visible;
}

.lightbox-content {
    position: relative;
    max-width: 90%;
    max-height: 90%;
    margin: auto;
}

.lightbox-image {
    display: block;
    max-width: 100%;
    max-height: 80vh;
    border: 5px solid #fff;
    border-radius: 4px;
}

.lightbox-close {
    position: absolute;
    top: -40px;
    right: 0;
    font-size: 30px;
    color: #fff;
    cursor: pointer;
    z-index: 1001;
}

.lightbox-caption {
    position: absolute;
    bottom: -80px;
    left: 0;
    right: 0;
    background-color: rgba(0, 0, 0, 0.7);
    color: #fff;
    padding: 10px 15px;
    border-radius: 4px;
}

.lightbox-title {
    font-size: 18px;
    margin: 0 0 5px;
}

.lightbox-description {
    font-size: 14px;
    margin: 0;
    opacity: 0.8;
}

.lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    background-color: rgba(255, 255, 255, 0.2);
    border: none;
    border-radius: 50%;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.lightbox-nav:hover {
    background-color: rgba(255, 255, 255, 0.4);
}

.lightbox-nav.prev {
    left: -60px;
}

.lightbox-nav.next {
    right: -60px;
}

/* Tablet styles */
@media (min-width: 576px) {
    .gallery-container.grid-view {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .gallery-header h1 {
        font-size: 32px;
    }
    
    .gallery-container.list-view .gallery-item {
        flex-direction: row;
        align-items: stretch;
    }
    
    .gallery-container.list-view .gallery-image {
        width: 40%;
        height: auto;
    }
    
    .gallery-container.list-view .gallery-info {
        width: 60%;
        padding: 20px;
    }
    
    .lightbox-image {
        max-height: 85vh;
    }
}

/* Medium tablets */
@media (min-width: 768px) {
    .gallery-controls {
        flex-direction: row;
        justify-content: space-between;
    }
    
    .filter-controls {
        margin-bottom: 0;
    }
    
    .gallery-container.grid-view {
        grid-template-columns: repeat(3, 1fr);
        gap: 25px;
    }
    
    .gallery-info h3 {
        font-size: 18px;
    }
    
    .gallery-container.list-view .gallery-image {
        width: 30%;
    }
    
    .gallery-container.list-view .gallery-info {
        width: 70%;
    }
    
    .lightbox-content {
        max-width: 80%;
    }
    
    .lightbox-nav.prev {
        left: -80px;
    }
    
    .lightbox-nav.next {
        right: -80px;
    }
}

/* Desktop styles */
@media (min-width: 992px) {
    .gallery-header {
        padding: 40px 0;
    }
    
    .gallery-header h1 {
        font-size: 36px;
    }
    
    .gallery-header p {
        font-size: 18px;
        max-width: 700px;
        margin-left: auto;
        margin-right: auto;
    }
    
    .gallery-container.grid-view {
        grid-template-columns: repeat(4, 1fr);
        gap: 30px;
    }
    
    .gallery-container.list-view .gallery-item {
        margin-bottom: 30px;
    }
    
    .gallery-container.list-view .gallery-info {
        padding: 25px 30px;
    }
    
    .gallery-container.list-view .gallery-info h3 {
        font-size: 20px;
        margin-bottom: 10px;
    }
    
    .gallery-container.list-view .gallery-info p {
        font-size: 16px;
        margin-bottom: 15px;
    }
    
    .lightbox-content {
        max-width: 70%;
    }
    
    .lightbox-caption {
        bottom: -70px;
    }
}

/* Large desktop styles */
@media (min-width: 1200px) {
    .gallery-container.grid-view {
        grid-template-columns: repeat(4, 1fr);
    }
    
    .gallery-container.list-view .gallery-image {
        width: 25%;
    }
    
    .gallery-container.list-view .gallery-info {
        width: 75%;
    }
    
    .gallery-info {
        padding: 20px;
    }
    
    .filter-btn {
        padding: 10px 20px;
        font-size: 15px;
    }
    
    .lightbox-content {
        max-width: 60%;
    }
    
    .lightbox-nav {
        width: 50px;
        height: 50px;
        font-size: 18px;
    }
    
    .lightbox-nav.prev {
        left: -100px;
    }
    
    .lightbox-nav.next {
        right: -100px;
    }
}

/* Add these styles to your CSS file */

/* Ensure proper reset of transforms when lightbox is closed */
.lightbox:not(.active) ~ main .gallery-item .gallery-image img {
    transform: none !important;
    transition: transform 0.3s ease;
}

/* Prevent hover effects while lightbox is active */
.lightbox.active ~ main .gallery-item:hover .gallery-image img {
    transform: none !important;
}

/* Force grid layout on desktop after lightbox closes */
@media (min-width: 992px) {
    .gallery-container.grid-view {
        display: grid !important;
        grid-template-columns: repeat(4, 1fr) !important;
    }
}