:root {
    --primary-color: #BBC988;
    --secondary-color: #454839;
    --dark-bg: #1a1a1a;
    --light-text: #ffffff;
    --gray-bg: #f5f5f5;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Vazirmatn', sans-serif;
    background-color: var(--gray-bg);
    color: var(--dark-bg);
}

.gallery-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 40px 20px;
}

.gallery-header {
    text-align: center;
    margin-bottom: 50px;
}

.gallery-title {
    font-size: 2.5em;
    color: var(--secondary-color);
    margin-bottom: 15px;
    position: relative;
    display: inline-block;
}

.gallery-title::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 80px;
    height: 3px;
    background-color: var(--primary-color);
}

.gallery-description {
    color: #666;
    max-width: 600px;
    margin: 0 auto;
    line-height: 1.6;
}

.gallery-filters {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-bottom: 40px;
    flex-wrap: wrap;
}

.filter-btn {
    padding: 12px 30px;
    border: 2px solid var(--primary-color);
    border-radius: 30px;
    background-color: transparent;
    color: var(--primary-color);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 1rem;
    position: relative;
    overflow: hidden;
}

.filter-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--primary-color);
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    z-index: -1;
}

.filter-btn:hover::before,
.filter-btn.active::before {
    transform: translateX(0);
}

.filter-btn:hover,
.filter-btn.active {
    color: var(--secondary-color);
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 30px;
    padding: 20px 0;
}

.gallery-item {
    position: relative;
    overflow: hidden;
    border-radius: 15px;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
    transition: all 0.4s ease;
    background-color: var(--light-text);
    aspect-ratio: 16/9;
    background: linear-gradient(45deg, #f3f3f3, #e6e6e6);
}

.gallery-item.loading::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
    z-index: 1;
}

@keyframes loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.5s ease;
    position: relative;
    z-index: 2;
    opacity: 0;
}

.gallery-item img.loaded {
    opacity: 1;
}

.gallery-item img.error {
    display: none;
}

.gallery-item .error-message {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #666;
    font-size: 1.1em;
    text-align: center;
    z-index: 1;
    display: none;
    width: 100%;
    padding: 20px;
}

.gallery-item img.error + .error-message {
    display: block;
}

.gallery-item video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.5s ease;
    position: relative;
    z-index: 2;
}

.gallery-item .overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to top, 
        rgba(69, 72, 57, 0.95) 0%,
        rgba(69, 72, 57, 0.8) 40%,
        rgba(69, 72, 57, 0.4) 70%,
        transparent 100%);
    padding: 30px;
    color: var(--light-text);
    transform: translateY(100%);
    transition: transform 0.4s ease;
    z-index: 3;
}

.gallery-item:hover .overlay {
    transform: translateY(0);
}

.gallery-item:hover::before {
    background: linear-gradient(45deg, 
        rgba(187, 201, 136, 0.2),
        rgba(69, 72, 57, 0.2));
}

.gallery-item .title {
    font-size: 1.4em;
    margin-bottom: 10px;
    color: var(--light-text);
    font-weight: 700;
}

.gallery-item .description {
    font-size: 1em;
    color: rgba(255, 255, 255, 0.9);
    line-height: 1.6;
}

.gallery-item .category {
    position: absolute;
    top: 20px;
    right: 20px;
    background: linear-gradient(45deg, var(--primary-color), #a8b97a);
    color: var(--secondary-color);
    padding: 8px 15px;
    border-radius: 20px;
    font-size: 0.9em;
    font-weight: 500;
    opacity: 0;
    transform: translateY(-20px);
    transition: all 0.3s ease;
    z-index: 3;
    box-shadow: 0 4px 15px rgba(187, 201, 136, 0.3);
}

.gallery-item:hover .category {
    opacity: 1;
    transform: translateY(0);
}

.gallery-item .play-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 80px;
    height: 80px;
    background-color: rgba(187, 201, 136, 0.9);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: all 0.4s ease;
    border: 3px solid var(--secondary-color);
    z-index: 4;
}

.gallery-item:hover .play-icon {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.1);
}

.play-icon::after {
    content: '';
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 12px 0 12px 24px;
    border-color: transparent transparent transparent var(--light-text);
    margin-left: 5px;
    position: relative;
    left: 2px;
}

.lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.lightbox.active {
    opacity: 1;
}

.lightbox-content {
    position: relative;
    max-width: 90%;
    max-height: 90vh;
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.lightbox.active .lightbox-content {
    transform: scale(1);
}

.lightbox-content img,
.lightbox-content video {
    max-width: 100%;
    max-height: 80vh;
    object-fit: contain;
    border-radius: 10px;
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.3);
}

.close-lightbox {
    position: absolute;
    top: -50px;
    right: 0;
    color: var(--light-text);
    font-size: 40px;
    cursor: pointer;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s ease;
}

.close-lightbox:hover {
    transform: rotate(90deg);
}

.lightbox-caption {
    color: var(--light-text);
    text-align: center;
    margin-top: 30px;
    padding: 20px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    backdrop-filter: blur(10px);
}

.lightbox-caption h3 {
    margin: 0;
    color: var(--secondary-color);
    font-size: 1.8em;
    margin-bottom: 10px;
}

.lightbox-caption p {
    margin: 0;
    color: rgba(255, 255, 255, 0.9);
    font-size: 1.1em;
    line-height: 1.6;
}

@media (max-width: 1200px) {
    .gallery-container {
        max-width: 95%;
    }
    
    .gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
        gap: 25px;
    }
}

@media (max-width: 768px) {
    .gallery-container {
        padding: 20px 15px;
    }

    .gallery-header {
        margin-bottom: 30px;
    }

    .gallery-title {
        font-size: 1.8em;
    }

    .gallery-description {
        font-size: 0.9em;
        padding: 0 15px;
    }

    .gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
        gap: 20px;
    }

    .gallery-filters {
        gap: 10px;
    }

    .filter-btn {
        padding: 8px 15px;
        font-size: 0.85em;
    }

    .gallery-item .overlay {
        padding: 20px;
    }

    .gallery-item .title {
        font-size: 1.1em;
    }

    .gallery-item .description {
        font-size: 0.9em;
    }

    .gallery-item .category {
        font-size: 0.8em;
        padding: 6px 12px;
    }
}

@media (max-width: 480px) {
    .gallery-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .gallery-title {
        font-size: 1.5em;
    }

    .gallery-filters {
        flex-direction: column;
        align-items: stretch;
    }

    .filter-btn {
        width: 100%;
        margin: 5px 0;
    }

    .gallery-item {
        aspect-ratio: 4/3;
    }
}

.gallery-item.video {
    position: relative;
    overflow: hidden;
    border-radius: 15px;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
    transition: all 0.4s ease;
    background-color: var(--light-text);
    aspect-ratio: 16/9;
}

.gallery-item.video video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.5s ease;
    position: relative;
    z-index: 1;
}

.gallery-item.video::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.3);
    z-index: 2;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.gallery-item.video:hover::before {
    opacity: 1;
}

.gallery-item.video .play-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 80px;
    height: 80px;
    background-color: rgba(187, 201, 136, 0.9);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.8;
    transition: all 0.4s ease;
    border: 3px solid var(--secondary-color);
    z-index: 3;
}

.gallery-item.video:hover .play-icon {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.1);
    background-color: var(--primary-color);
}

.gallery-item.video .play-icon::after {
    content: '';
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 12px 0 12px 24px;
    border-color: transparent transparent transparent var(--light-text);
    margin-left: 5px;
    position: relative;
    left: 2px;
}

.gallery-item.video .duration {
    position: absolute;
    bottom: 15px;
    right: 15px;
    background: rgba(69, 72, 57, 0.7);
    color: white;
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 0.9em;
    z-index: 3;
    opacity: 0.8;
    transition: opacity 0.3s ease;
}

.gallery-item.video:hover .duration {
    opacity: 1;
    background: rgba(69, 72, 57, 0.9);
}

.gallery-item.video .overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to top, 
        rgba(69, 72, 57, 0.95) 0%,
        rgba(69, 72, 57, 0.8) 40%,
        rgba(69, 72, 57, 0.4) 70%,
        transparent 100%);
    padding: 30px;
    color: var(--light-text);
    transform: translateY(100%);
    transition: transform 0.4s ease;
    z-index: 3;
}

.gallery-item.video:hover .overlay {
    transform: translateY(0);
}

@keyframes pulse {
    0% {
        transform: translate(-50%, -50%) scale(0.95);
        box-shadow: 0 0 0 0 rgba(187, 201, 136, 0.5);
    }
    
    70% {
        transform: translate(-50%, -50%) scale(1);
        box-shadow: 0 0 0 10px rgba(187, 201, 136, 0);
    }
    
    100% {
        transform: translate(-50%, -50%) scale(0.95);
        box-shadow: 0 0 0 0 rgba(187, 201, 136, 0);
    }
}

.gallery-item.video::after {
    content: none !important;
} 