
/* --- Optimized demo-gallery styles --- */
.demo-gallery {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    padding-bottom: 60px;
    max-width: 1200px;
    margin: 0 auto; 
}


.demo-gallery > ul {
    margin: 0;
    padding: 0;
    list-style: none;
    max-width: 90vw;
    margin: 0 auto;
    direction: ltr;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 15px;
}
.image-container {
    max-width: 90vw;
}
.demo-gallery > ul > li {
    max-width: 200px;  
    flex: 0 0 180px;  
}

.demo-gallery ul li {
    position: relative;
    width: 160px;
    aspect-ratio: 16/9;
    overflow: hidden;
    border-radius: 16px;
    flex: 0 0 auto;
}

.demo-gallery > ul > li a {
    display: block;
    width: 100%;
    height: 100%;
    overflow: hidden;
    border-radius: 16px !important;
    position: relative;
    z-index: 1;
    border: none;
}

.demo-gallery > ul > li a > img,
.demo-gallery .justified-gallery > a > img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 16px !important;
    transition: transform 0.15s ease;
    transform: scale3d(1, 1, 1);
}

.demo-gallery > ul > li a:hover > img,
.demo-gallery .justified-gallery > a:hover > img {
    transform: scale3d(1.1, 1.1, 1.1);
    filter: blur(2px);
}

.demo-gallery .image-title {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 18px;
    font-weight: bold;
    color: black;
    white-space: nowrap;
    text-shadow:
        -0.5px -0.5px 0 white,
         0.5px -0.5px 0 white,
        -0.5px  0.5px 0 white,
         0.5px  0.5px 0 white;
    opacity: 0;
    z-index: 5;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.demo-gallery > ul > li a:hover .image-title {
    opacity: 1;
}

/* Poster overlay */
.demo-gallery .demo-gallery-poster,
.demo-gallery > ul > li a .demo-gallery-poster,
.demo-gallery .justified-gallery > a .demo-gallery-poster {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: rgba(0, 0, 0, 0.1);
    transition: background-color 0.15s ease;
    pointer-events: none !important;
    user-select: none !important;
    z-index: 2;
}

.demo-gallery > ul > li a:hover .demo-gallery-poster,
.demo-gallery .justified-gallery > a:hover .demo-gallery-poster {
    background-color: rgba(0, 0, 0, 0.5);
}

.demo-gallery > ul > li a .demo-gallery-poster > img,
.demo-gallery .justified-gallery > a .demo-gallery-poster > img {
    position: absolute;
    top: 50%;
    left: 50%;
    opacity: 0;
    transition: opacity 0.3s ease;
    transform: translate(-50%, -50%);
}

.demo-gallery > ul > li a:hover .demo-gallery-poster > img,
.demo-gallery .justified-gallery > a:hover .demo-gallery-poster > img {
    opacity: 1;
}
@media (max-width: 992px) {
    .demo-gallery > ul > li {
        flex: 1 1 calc(33.33% - 15px);
    }
}

@media (max-width: 768px) {
    .demo-gallery > ul > li {
        flex: 1 1 calc(50% - 15px);
        border-radius: 15px;
    }
}

@media (max-width: 480px) {
    .demo-gallery > ul > li {
        flex: 1 1 100%;
        border-radius: 12px;
    }
}
@media (min-width: 1600px) {
    .demo-gallery > ul {
        max-width: 1400px;
    }
}

@media (min-width: 992px) {
    .menu-toggle {
      display: none !important;
      pointer-events: none !important;
      visibility: hidden !important;
      height: 0 !important;
      overflow: hidden !important;
    }
}
  
  
  

/* --- Video Icon Style --- */
.demo-gallery .video .demo-gallery-poster img {
    width: 48px;
    height: 48px;
    margin-left: -24px;
    margin-top: -24px;
    opacity: 0.8;
}

/* --- Dark Theme Border --- */
.demo-gallery.dark > ul > li a {
    border: 3px solid #04070a;
}

/* --- Category Menu --- */
.category-menu {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    list-style-type: none;
    direction: rtl;
    padding: 0;
    margin: 0 auto 10px;
    width: fit-content;
    border-bottom: 3px solid rgb(48, 48, 48);
    transition: all 0.5s ease;
}

.category-menu a {
    display: block;
    width: 100%;
    padding: 7px 10px;
    transition: all 0.3s ease;
}

.category-menu a:hover,
.category-menu a.active {
    color: #dcdcdc;
    background-color: rgb(10, 10, 10);
}

/* Toggle for small screens */
.menu-toggle {
    display: block;
    text-align: center;
    background-color: rgba(20, 20, 20, 0.7);
    padding: 10px 16px;
    border-radius: 8px;
    color: white;
    font-weight: bold;
    cursor: pointer;
    margin: 10px auto;
  }
  

/* --- Responsive Category Menu --- */
@media (max-width: 768px) {
    .category-dropdown-wrapper {
        position: relative;
        text-align: right;
        margin: 10px 15px;
    }

    .menu-toggle {
        display: inline-block;
        background-color: rgba(20, 20, 20, 0.7);
        padding: 10px 16px;
        border-radius: 8px;
        color: white;
        font-weight: bold;
        cursor: pointer;
    }

    .category-menu {
        flex-direction: column;
        position: absolute;
        top: 100%;
        right: 0;
        width: max-content;
        min-width: 180px;
        background: rgba(0, 0, 0, 0.65);
        backdrop-filter: blur(6px);
        padding: 10px 0;
        border-radius: 0 0 10px 10px;
        list-style: none;
        margin: 0;
        z-index: 999;
        visibility: hidden;
        opacity: 0;
        max-height: 0;
        overflow: hidden;
        transition: opacity 0.3s ease, max-height 0.3s ease;
    }

    .category-menu.show {
        visibility: visible;
        opacity: 1;
        max-height: 500px;
    }

    .category-menu li {
        padding: 6px 16px;
        text-align: right;
    }

    .category-menu li a {
        color: #fff;
        text-decoration: none;
        display: block;
    }

    .category-menu li a:hover {
        background-color: rgba(255, 255, 255, 0.1);
    }
}


/* --- Single Image View --- */
.image-wrapper.single-gallery {
    text-align: center;
    padding-top: 50px;
}

.image-container {
    display: inline-block;
    position: relative;
    max-width: 90vw;
}

.gallery-image {
    display: block;
    max-width: 100%;
    max-height: 80vh;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 16px;
}

/* هدر سفید بالای عکس با عرض خود عکس */
.gallery-header {
    position: absolute;
    top: -30px;
    right: 0;
    left: 0;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(6px);
    border-radius: 12px;
    padding: 10px 16px;
    box-sizing: border-box;
    z-index: 10;
    width: 100%;
    flex-wrap: wrap;
}

.header-title {
    display: flex;
    flex-direction: column;
    text-align: right;
    direction: rtl;
}

.header-title h1 {
    font-size: 16px;
    margin: 0;
    font-weight: bold;
    white-space: nowrap;
}

.header-title small {
    font-size: 12px;
    color: #555;
    white-space: nowrap;
}

.header-like-btn {
    background: none;
    border: none;
    font-size: 20px;
    color: #d11a2a;
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    flex-shrink: 0;
}

.header-like-btn:hover {
    opacity: 0.8;
}

/* موبایل */
@media (max-width: 600px) {
    .gallery-header {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        padding: 8px 12px;
    }

    .header-title h1 {
        font-size: 14px;
    }

    .header-title small {
        font-size: 11px;
    }

    .header-like-btn {
        font-size: 18px;
    }
}

/* دکمه‌های چپ و راست */
.arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255,255,255,0.3);
    backdrop-filter: blur(8px);
    border: none;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: #fff;
    opacity: 0.6;
    cursor: pointer;
    transition: opacity 0.2s, transform 0.2s;
    z-index: 10;
}

.arrow:hover {
    opacity: 1;
    transform: translateY(-50%) scale(1.1);
}

.arrow-prev { left: 8px; }
.arrow-next { right: 8px; }

/* --- Gallery Thumbnails (in list view) --- */

/* --- Gallery Item Layout --- */
.gallery-item {
    width: 100%;
    max-width: 160px;
    aspect-ratio: 16 / 9 !important;
    border-radius: 16px;
    overflow: hidden;
    position: relative;
    flex: 0 0 auto;
}
.gallery-thumb {
    width: 100%;
    height: 100%;
    object-fit: contain !important;
    position: relative;
    z-index: 2;
    border-radius: 16px;
}
.gallery-item a {
    display: block;
    width: 100%;
    height: 100%;
    position: relative;
}

.gallery-item .blur-background {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background-size: cover;
    background-position: center;
    filter: blur(12px);
    transform: scale(1.2);
    z-index: 1;
}

.gallery-item .gallery-thumb {
    position: relative;
    z-index: 2;
    object-fit: contain;
    border-radius: 16px;
    width: 100%;
    height: 100%;
}

.gallery-item .image-title {
    position: absolute;
    bottom: 12px;
    left: 50%;
    transform: translateX(-50%);
    color: black;
    text-shadow: 0 0 3px white;
    font-weight: bold;
    opacity: 0;
    z-index: 3;
    white-space: nowrap;
    transition: 0.3s ease;
}

.gallery-item:hover .image-title {
    opacity: 1;
}

.gallery-item:hover .gallery-thumb {
    filter: blur(1.5px);
}

.gallery-thumb.contain-thumb {
    object-fit: contain !important;
    background-color: transparent;
    z-index: 2;
}

/* --- Aspect Ratio Helpers --- */
.aspect-2-1,
.gallery-item.aspect-2-1 { aspect-ratio: 16 / 9 !important; }
.aspect-1-2,
.gallery-item.aspect-1-2 { aspect-ratio: 9 / 16 !important; }
.aspect-1-1,
.gallery-item.aspect-1-1 { aspect-ratio: 1 / 1 !important; }

.gallery-item:not([class*="aspect-"]) {
    aspect-ratio: 3 / 5;
}
.page-banner .banner-title {
    font-family: inherit !important;
    font-size: 32px;
    font-weight: bold;
    text-shadow: 0 0 6px rgba(0, 0, 0, 0.6);
    margin: 0;
    color: #fff;
}
/* کاهش فاصله زیر بنر */
.wptb-page-heading {
    margin-bottom: 0 !important;
    padding-bottom: 0 !important;
}

/* حذف فاصله بالای سکشن */
.wptb-page-heading + section {
    margin-top: 0 !important;
    padding-top: 0 !important;
}

/* حذف فاصله احتمالی از کانتینر */
section .container:first-child {
    margin-top: 0 !important;
    padding-top: 0 !important;
}
