/* ریست کلی برای جلوگیری از تاثیر قالب */
.tabnak-lb-overlay * {
    box-sizing: border-box;
}

/* لایه اصلی */
.tabnak-lb-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #ffffff;
    z-index: 9999999; /* افزایش z-index برای اطمینان */
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.tabnak-lb-overlay.active {
    opacity: 1;
}

/* دکمه بستن */
.tabnak-close {
    position: absolute;
    top: 20px;
    left: 20px;
    background: none;
    border: none;
    cursor: pointer;
    width: 40px;
    height: 40px;
    z-index: 30;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}
.tabnak-close:hover {
    transform: rotate(90deg);
    transition: 0.3s;
}

/* بدنه عکس */
.tabnak-lb-body {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding-bottom: 70px;
}

.tabnak-lb-image {
    max-width: 90%;
    max-height: 80vh;
    object-fit: contain;
    box-shadow: 0 5px 25px rgba(0,0,0,0.15); 
}

/* --- فلش‌های ناوبری --- */
.tabnak-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 50px;
    height: 50px;
    background: #999 !important; /* رنگ طوسی اجباری */
    border-radius: 50%;
    border: none;
    cursor: pointer;
    z-index: 25;
    display: flex !important; /* فلکس اجباری */
    align-items: center !important;
    justify-content: center !important;
    transition: 0.2s;
    opacity: 0.8;
    padding: 0;
    margin: 0;
}
.tabnak-nav:hover {
    background: #777 !important;
    opacity: 1;
}

/* تضمین نمایش SVG داخل دکمه‌ها */
.tabnak-nav svg {
    display: block !important;
    margin: auto !important;
}

.tabnak-prev { right: 20px; }
.tabnak-next { left: 20px; }


/* --- فوتر --- */
.tabnak-lb-footer {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 70px;
    background: #ffffff;
    display: flex;
    align-items: center;
    padding: 0 30px; 
    border-top: 1px solid #f0f0f0;
    z-index: 20;
    direction: ltr; 
}

.tabnak-tools-left {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* دکمه‌های فوتر */
.tabnak-btn-sq {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    transition: opacity 0.2s;
    padding: 0;
    background-size: cover;
}
.tabnak-btn-sq:hover { opacity: 0.85; }

/* رنگ دکمه‌ها */
.btn-dl { background-color: #5cb85c !important; }
.btn-in { background-color: #0077b5 !important; }
.btn-fb { background-color: #3b5998 !important; }
.btn-tw { background-color: #1da1f2 !important; }
.btn-grid { background-color: #eeeeee !important; }

/* شمارنده */
.tabnak-counter {
    color: #333;
    font-size: 13px;
    font-weight: bold;
    direction: rtl;
    margin-left: 10px;
}

/* عنوان */
a.tabnak-credit {
    color: #888;
    text-decoration: none;
    font-size: 12px;
    margin-left: 15px;
    direction: rtl;
    white-space: nowrap;
    overflow: hidden;
    max-width: 300px;
    text-overflow: ellipsis;
}
a.tabnak-credit:hover { color: #333; }

/* گرید */
.tabnak-grid-view {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: calc(100% - 70px);
    background: #fff;
    z-index: 22;
    padding: 60px 20px 20px;
    display: none;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 15px;
    overflow-y: auto;
}
.tabnak-grid-view.active { display: grid; }

.tabnak-thumb {
    width: 100%;
    height: 120px;
    object-fit: cover;
    cursor: pointer;
    border-radius: 4px;
    transition: 0.2s;
}
.tabnak-thumb:hover { filter: brightness(0.8); }

@media (max-width: 768px) {
    .tabnak-lb-footer { padding: 0 10px; overflow-x: auto; }
    .tabnak-nav { width: 40px; height: 40px; }
    a.tabnak-credit { display: none; }
}