7*,
*::before,
*::after {
    box-sizing: border-box;
}

:root {
    --bg: #f5f7fa;
    --text: #2c3e50;
    --box-bg: #ffffff;
    --box-border: #e4e4e4;
}

body.dark {
    --bg: #1f1f22;
    --text: #f1f1f1;
    --box-bg: #26272a;
    --box-border: #3a3a3c;
}

body {
    margin: 0;
    padding: 0 15px;
    background: var(--bg);
    color: var(--text);
    font-family: Arial;
    transition: background-color 0.3s, color 0.3s;
}

/* HEADER */
header {
    background: var(--box-bg);
    border: 1px solid var(--box-border);
    padding: 15px;
    margin-top: 15px;
    border-radius: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background-color 0.3s, border-color 0.3s;
}

.title {
    font-size: 20px;
    font-weight: bold;
}

/* HEADER RIGHT */
.header-right {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 12px;
}

/* THEME BUTTONS CONTAINER */
.theme-buttons {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 8px;
}

/* THEME BUTTONS */
.theme-buttons button {
    display: inline-flex;
    padding: 6px 10px;
    border-radius: 6px;
    border: 1px solid var(--box-border);
    background: var(--box-bg);
    color: var(--text);
    cursor: pointer;
    font-size: 12px;
    white-space: nowrap; /* جلوگیری از شکستن خط */
}

/* SEARCH */
.search-box {
    padding: 7px 10px;
    border-radius: 6px;
    border: 1px solid var(--box-border);
    font-size: 13px;
    width:70%;
    background: var(--bg);
    color: var(--text);
    transition: background-color 0.3s, border-color 0.3s;
}

/* THEME BUTTONS */
.theme-buttons button {
    padding: 6px 10px;
    border-radius: 6px;
    border: 1px solid var(--box-border);
    background: var(--box-bg);
    color: var(--text);
    cursor: pointer;
    font-size: 12px;
    transition: background-color 0.3s, border-color 0.3s;
}
.theme-buttons {
    display: flex;
    gap: 8px; /* فاصله بین دکمه‌ها */
}

/* CONTROL BAR */
.control-bar {
    margin-top: 12px;
    background: var(--box-bg) !important;
    border: 1px solid var(--box-border) !important;
    color: var(--text) !important;
    transition: background-color 0.3s, border-color 0.3s;
    padding: 12px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    gap: 15px;
    transition: background-color 0.3s, border-color 0.3s;
}

.nav-btn {
    width: 38px;
    height: 38px;
    border-radius: 8px;
    background: var(--box-bg);
    border: 1px solid var(--box-border);
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: background-color 0.3s, border-color 0.3s;
}

.nav-btn.disabled {
    opacity: 0.3;
    cursor: default;
    pointer-events: none;
}

.nav-btn img {
    width: 18px;
    opacity: 0.8;
}

.count-badge,
#filterSelect {
    padding: 6px 14px;
    border-radius: 6px;
    background: var(--box-bg);
    border: 1px solid var(--box-border);
    font-size: 13px;
    transition: background-color 0.3s, border-color 0.3s;
    flex: 0 0 auto; /* اجازه نمیده بشکنه */
    white-space: nowrap; /* جلوگیری از افتادن به خط بعد */
}

#filterSelect {
    cursor: pointer;
    appearance: none;
    background-repeat: no-repeat;
    background-position: right 10px top 50%;
    padding-right: 30px;
}

/* GRID */
.icon-grid {
    display: grid;
    grid-template-columns: repeat(16, 1fr);
    margin-top: 22px;
    gap: 10px;
}


@media (max-width: 1250px) {

.icon-grid {
    grid-template-columns: repeat(10, 1fr);
    gap: 10px;
}

}
@media (max-width: 870px) {

.icon-grid {
    grid-template-columns: repeat(12, 1fr);
    gap: 10px;
}

}
@media (max-width: 600px) {

.icon-grid {
    grid-template-columns: repeat(6, 1fr);
    gap: 10px;
    max-width:600px;
}
.item-card.folder {
    background:#fff;
    max-width: 100%;
    height: 130px;
    padding: 16px;
    border-radius: 14px;
    background: var(--box-bg);
    display: flex;
    flex-wrap: wrap;
    flex-direction: column;
    flex: 1 1 45%;  
    align-items: center;
    justify-content: center;
}


}

/* هر آیتم 2 ستون بگیرد */
.item-card {
    grid-column: span 2;
    max-height:100%;

    background: var(--box-bg);
    border: 1px solid var(--box-border);
    border-radius: 12px;
    padding: 10px 10px;
    text-align: center;
    text-decoration: none;
    color: var(--text);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
     justify-content: flex-start;
    overflow: hidden;
    transition: background-color 0.3s, border-color 0.3s;
}



/* Removing hover effect */
.item-card:hover {
    transform: none !important;
    box-shadow: none !important;
}




.item-name {
    width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 14px;
}

/* Footer */
footer {
    margin-top: 40px;
    padding: 20px;
    text-align: center;
    border-top: 1px solid var(--box-border);
}

/* Status messages */
.icon-grid .loading,
.icon-grid .no-results,
.icon-grid .error {
    grid-column: 1 / -1;
    text-align: center;
    font-size: 13px;
    opacity: 0.7;
}

/* =========================================================
   MOBILE RESPONSIVE STYLES
   ========================================================= */

/* Tablets & medium devices under 768px */
@media (max-width: 768px) {

    body {
        padding: 0 10px;
    }

    /* HEADER */
    header {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }

    .title {
        font-size: 18px;
        text-align: center;
    }
    .sidebar{
        width:5%;
        margin-top:0px;
    }

    .header-right {
        width: 100%;
        justify-content: space-between;
    }

    .search-box {
        min-width: inherit;
        width: 100%;
        font-size: 12px;
    }

    .theme-buttons button {
        font-size: 11px;
        padding: 5px 8px;
    }

    /* CONTROL BAR */
.control-bar {
        flex-direction: row; /* به جای column */
        flex-wrap: wrap;     /* در صورت نیاز به رفتن دکمه‌ها به خط بعد */
        justify-content: center; /* برای چینش وسط، اختیاری */
        gap: 10px;
        align-items: center;
        justify-content: flex-start;
    }

    .count-badge,
    #filterSelect {
        width: 100%;
        text-align: center;
    }



    .item-card {
        padding: 16px 5px;
    }

    .item-name {
        font-size: 13px;
    }

    footer {
        padding: 15px 10px;
        font-size: 12px;
    }
}

/* Small mobile devices under 480px */
@media (max-width: 480px) {

    .title {
        font-size: 16px;
    }

    .header-right {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }

    .theme-buttons {
        display: flex;
        justify-content: center;
        flex-wrap: wrap;
        gap: 6px;
    }

    .nav-btn {
        width: 34px;
        height: 34px;
    }

    .nav-btn img {
        width: 16px;
        flex: 0 0 auto; /* دکمه‌ها فشرده نمی‌شن */
    }


    .item-card img {
        width: 55px;
        height: 55px;
    }

    .item-emoji {
        font-size: 45px;
    }

    .item-name {
        font-size: 12px;
    }
    /* تبلت و موبایل */
@media (max-width: 768px) {

    /* کل چیدمان از افقی به عمودی */
    .layout-wrapper {
        display: flex;
        flex-direction: row;
        align-items: stretch;
    }

    /* نوار کنترل تمام عرض صفحه */
    .control-bar {
        width: 100% !important;
        margin-bottom: 10px;
        flex-wrap: wrap;
        justify-content: center;
    }

    /* مخفی کردن سایدبار در موبایل (فعلاً ساده‌ترین راه) */
    .sidebar {
        width: 10%; /* برای زمانی که خواستی به‌جای مخفی کردن، بیاریش پایین */
    }

    /* هدر جمع و جورتر وسط چین */
    header {
        flex-direction: column;
        align-items: center;
        text-align: center;
        gap: 8px;
    }

    header .logo {
        margin-bottom: 4px;
    }

    header nav {
        margin-top: 4px;
    }

    /* اگر دکمه‌های خاصی در control-bar داری */
    .control-bar button,
    .control-bar .btn {
        flex: 1 1 45%;
        max-width: 48%;
        margin: 4px 1%;
    }
}

/* موبایل کوچک‌تر */
@media (max-width: 480px) {
    .control-bar button,
    .control-bar .btn {
        flex: 1 1 100%;
        max-width: 100%;
    }
}

}








.menu-section ul,
.social-section ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.menu-list li,
.social-list li {
    margin-bottom: 10px;
}

.menu-list a,
.social-list a {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: #333;
    padding: 10px 8px;
    border-radius: 8px;
    transition: 0.3s;
    flex-direction: row-reverse; /* آیکون راست - متن چپ */
}
.icon {
    font-size: 20px;
    width: 24px;
    text-align: center;
}

.menu_title {
    font-size: 14px;
    margin-top:2px;
    text-align: center;
}

/* چینش افقی + وسط‌چین عمودی */
li a {
    display: flex;
    align-items: center;    /* آیکون و متن دقیقاً وسط */
    flex-direction: row-reverse; /* آیکون سمت راست - متن سمت چپ */
    gap: 5px;               /* فاصله 5px بین متن و آیکون */
}

/* آیکون دقیقاً 20×20 */
.menu_icon img {
    width: 30px;
    height: 30px;
    display: block;
}








/* حالت موبایل */
@media (max-width: 768px) {


    .menu_title {
        display: none; /* مخفی کردن متن منو */
    }

    .social-list a span:last-child {
        display: none; /* مخفی کردن متن شبکه‌های اجتماعی */
    }
    /* آیکون دقیقاً 20×20 */
    .menu_icon img {
        width: 20px;
        height: 20px;
        display: block;
}
    .header-right{
        display:flex;
        align-items: center;
        gap:0px;
        flex-direction: row;
    }
    .search-box{
        width:60%;
    }
    .title{
        margin-bottom: 10px;
    }
}

.divider {
    height: 1px;
    background: #ddd;
    margin: 20px 0;
}


.info-bot{
    text-align: center;
    width:100%;
}





/* SIDEBAR (اصلاح‌شده برای پشتیبانی از دارک/لایت) */
.sidebar {
    /* SIDEBAR – سازگار کامل با دارک و لایت */
    background: var(--box-bg) !important;
    border: 1px solid var(--box-border) !important;
    color: var(--text) !important;
    transition: background-color 0.3s, border-color 0.3s;
}


/* MENU + SOCIAL LINKS (اصلاح‌شده) */
.menu-list a,
.social-list a {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: var(--text); /* اصلاح */
    background: var(--box-bg); /* اصلاح */
    border: 1px solid var(--box-border); /* اصلاح */
    padding: 10px 8px;
    border-radius: 8px;
    transition: background-color 0.3s, border-color 0.3s, color 0.3s;
    flex-direction: row-reverse;
}

/* Hover برای تم‌ها */
.menu-list a:hover,
.social-list a:hover {
    background: var(--bg);
}

/* Divider با رنگ تم */
.divider {
    height: 1px;
    background: var(--box-border); /* اصلاح */
    margin: 20px 0;
}

/* آیکون‌ها هم باید رنگ متغیر بگیرند */
.icon {
    font-size: 20px;
    width: 24px;
    text-align: center;
    color: var(--text); /* اصلاح */
}

@font-face {
    font-family: 'IranYekan'; /* نام دلخواه برای فونت */
    src: url('/assets/font/iranyekanwebregular.woff2') format('woff2'),
         url('/assets/font/iranyekanwebregular.woff') format('woff');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}
.info-box{
    font-size:12px;
    text-align: right;
    font-family:IranYekan;
}








.item-card.folder {
    background:#fff;
    width: 130px;
    height: 130px;
    padding: 16px;
    border-radius: 14px;
    background: var(--box-bg);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.item-card.folder img {
    width: 45px;
    height: 45px;
    object-fit: contain;
}

.item-card.folder .item-name {
    font-size: 16px;
    font-weight: 600;
    text-align: center;
}


























.header-filter-area {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 0px;
}

.mini-filter-btn {
    margin-left:10px;
    background: #fff;
    border: 1px solid #d6d6d6;
    color: #333;
    padding: 6px 12px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
}

.mini-filter-btn:hover {
    background: #fafafa;
    border-color: #bdbdbd;
}

.ext-filter-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 150px;
    background: #fff;
    border: 1px solid #d6d6d6;
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.08);
    padding: 6px;
    display: none;
    z-index: 9999;
}

.ext-filter-menu.open {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 100px;
    margin-right: 35px;
    
}

.ext-filter-menu button {
    width: 100%;
    text-align: center;
    border: 0;
    background: transparent;
    padding: 9px 10px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
    color: #333;
}

.ext-filter-menu button:hover {
    background: #f4f4f4;
}






/* فقط موبایل */
@media (max-width: 768px) {
  #foldersGrid {
    grid-template-columns: repeat(4, 1fr); /* دو ستونه */
  }
  .item-card.folder {
    width: 120px;
    height: 120px;
    gap:0px;
}
.item-card.file{
   gap:0px;
}
.info-box{
    display:none;
}
}






.item-emoji {
    width: 72px;
    height: 72px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    margin-bottom: 10px;
    flex-shrink: 0;
}


.item-emoji img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.file-thumb {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
    max-width: 72px;
    max-height: 72px;
    border-radius:8px;
}

.item-name {
    width: 100%;
    text-align: center;
    word-break: break-word;
    overflow: hidden;
    text-overflow: ellipsis;
}

.item-ext {
    font-size: 13px;
    color: #888;
    margin-top: 2px;
}











/* ===== Overlay ===== */
#popupOverlay{
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.35);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;

    opacity: 0;
    visibility: hidden;
    transition: all .35s ease;
    font-family: IRANYekan, sans-serif;
}

/* وقتی فعال شد */
#popupOverlay.active{
    opacity: 1;
    visibility: visible;
}

/* ===== Popup Box ===== */
.popupBox{
    background: #fff;
    width: 420px;
    max-width: 92%;
    padding: 35px 30px;
    border-radius: 18px;
    text-align: center;
    box-shadow: 0 25px 60px rgba(0,0,0,0.18);
    position: relative;

    transform: translateY(40px);
    transition: all .35s ease;
}

#popupOverlay.active .popupBox{
    transform: translateY(0);
}

/* ===== Typography ===== */
.popupBox h2{
    margin-bottom: 12px;
    font-size: 20px;
}

.popupBox p{
    font-size: 14px;
    color: #666;
    line-height: 1.8;
    margin-bottom: 25px;
}

/* ===== Buttons ===== */
.popupButtons{
    display: flex;
    gap: 12px;
    justify-content: center;
}

.btn{
    padding: 10px 18px;
    border-radius: 12px;
    text-decoration: none;
    font-size: 14px;
    transition: 0.25s ease;
    display: inline-block;
}

.follow{
    background: #0088ff;
    color: white;
}

.follow:hover{
    background: #006fd6;
}

.donate{
    background: #f2f2f2;
    color: #333;
}

.donate:hover{
    background: #e4e4e4;
}

/* ===== Close Button ===== */
.closePopup{
    position: absolute;
    top: 12px;
    right: 15px;
    border: none;
    background: none;
    font-size: 22px;
    cursor: pointer;
}

/* ===== Mobile Responsive ===== */
@media (max-width: 480px){

    .popupBox{
        padding: 25px 20px;
        border-radius: 16px;
    }

    .popupButtons{
        flex-direction: column;
    }

    .btn{
        width: 100%;
    }

    .popupBox h2{
        font-size: 18px;
    }

    .popupBox p{
        font-size: 13px;
    }
}



















.loading {
    position: relative;
}

/* محتوای داخل فقط نامرئی شود ولی layout حفظ شود */
.loading > * {
    opacity: 0;
}

/* لایه اسکلت */
.loading::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: 8px;
    background: linear-gradient(
        90deg,
        #e5e7eb 25%,
        #f3f4f6 50%,
        #e5e7eb 75%
    );
    background-size: 200% 100%;
    animation: skeleton 1.2s infinite linear;
    z-index: 5;
}

/* وقتی لود تمام شد */
.loaded > * {
    opacity: 1;
}

.loaded::after {
    display: none;
}

@keyframes skeleton {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}










.item-card.folder.vip-folder img {
    width:100%;
    height:100px;
    border-radius:10px;
    object-fit: cover;
}
.item-card.folder.vip-folder {
    width: 140px;
    height: 150px;
}
