:root {
    --sch-primary: #e91e63;
    --sch-radius: 12px;
    --sch-card-min: 180px;
    --sch-mobile-cols: 2;
    --sch-mobile-img-size: 80px;
}

.sch-search-wrapper, .sch-grid-wrapper {
    max-width: 900px;
    margin: 30px auto;
    font-family: inherit;
    direction: rtl;
    position: relative;
}

/* --- استایل لودینگ --- */
.sch-grid-container.sch-blur { filter: blur(3px); pointer-events: none; opacity: 0.7; transition: 0.2s; }
.sch-loading-overlay { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); z-index: 50; display: none; flex-direction: column; align-items: center; background: rgba(255, 255, 255, 0.9); padding: 20px 40px; border-radius: 15px; box-shadow: 0 10px 25px rgba(0,0,0,0.1); }
.sch-loading-overlay.active { display: flex; }
.sch-spinner { width: 30px; height: 30px; border: 3px solid #f3f3f3; border-top: 3px solid var(--sch-primary); border-radius: 50%; animation: spin 0.8s linear infinite; margin-bottom: 10px; }
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }
.sch-loading-text { font-size: 14px; color: #555; font-weight: bold; }

/* --- نوار ابزار و بریدکمب (Fix 5) --- */
.sch-toolbar { display: flex; justify-content: space-between; align-items: center; background: #f8fafc; padding: 10px 15px; border-radius: var(--sch-radius); margin-bottom: 20px; border: 1px solid #e2e8f0; }
.sch-toolbar-right { display: flex; align-items: center; gap: 15px; width: 100%; overflow: hidden; /* جلوگیری از بیرون زدگی */ }

.sch-back-btn { background: #fff; border: 1px solid #cbd5e1; border-radius: 8px; padding: 6px 14px; font-size: 13px; color: #475569; cursor: pointer; display: flex; align-items: center; gap: 5px; white-space: nowrap; flex-shrink: 0; }
.sch-back-btn:hover { border-color: var(--sch-primary); color: var(--sch-primary); }

.sch-breadcrumbs {
    font-size: 14px; color: #64748b; 
    white-space: nowrap; 
    overflow-x: auto; /* اسکرول افقی اگر جا نشد */
    display: flex;
    align-items: center;
    scrollbar-width: none; /* مخفی کردن اسکرول بار در فایرفاکس */
}
.sch-breadcrumbs::-webkit-scrollbar { display: none; /* مخفی کردن در کروم */ }

.sch-crumb-link { cursor: pointer; color: #334155; }
.sch-crumb-link:hover { color: var(--sch-primary); text-decoration: underline; }
.sch-sep { margin: 0 8px; color: #cbd5e1; }

/* --- استایل اصلی --- */
.sch-input-group { display: flex; background: #fff; border: 1px solid #e2e8f0; border-radius: var(--sch-radius); padding: 6px; margin-bottom: 15px; box-shadow: 0 4px 6px -1px rgba(0,0,0,0.05); }
.sch-main-input { flex-grow: 1; border: none !important; background: transparent !important; padding: 10px 15px !important; font-size: 16px; outline: none !important; }
.sch-btn-search { background: var(--sch-primary) !important; color: #fff !important; border: none !important; border-radius: calc(var(--sch-radius) - 4px); width: 45px; cursor: pointer; transition: 0.2s; }
.sch-filters { display: flex; gap: 15px; }
.sch-select { 
    flex: 1; padding: 10px; border: 1px solid #e2e8f0; border-radius: var(--sch-radius); background-color: #fff; 
    -webkit-appearance: none; -moz-appearance: none; appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e") !important;
    background-repeat: no-repeat !important; background-position: left 10px center !important; background-size: 16px !important; padding-left: 35px !important;
}
.sch-grid-container { display: grid; grid-template-columns: repeat(auto-fill, minmax(var(--sch-card-min), 1fr)); gap: 20px; }
.sch-grid-card { background: #fff; border: 1px solid #edf2f7; border-radius: var(--sch-radius); padding: 20px; text-align: center; cursor: pointer; transition: all 0.3s ease; box-shadow: 0 2px 4px rgba(0,0,0,0.02); display: flex; flex-direction: column; align-items: center; justify-content: center; }
.sch-grid-card:hover { transform: translateY(-5px); border-color: var(--sch-primary); box-shadow: 0 10px 20px rgba(0,0,0,0.08); }
.sch-card-img { max-width: 100px; height: 70px; object-fit: contain; margin-bottom: 15px; }
.sch-icon-box { font-size: 40px; color: #4a5568; margin-bottom: 15px; }
.sch-grid-card h4 { margin: 0; font-size: 15px; color: #2d3748; }

.sch-file-row { background: #fff; padding: 15px 20px; border-radius: var(--sch-radius); border: 1px solid #e2e8f0; margin-bottom: 12px; display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 15px; transition: 0.2s; }
.sch-file-row:hover { border-color: var(--sch-primary); }
.sch-file-info { flex: 1; min-width: 200px; }
.sch-fname { font-weight: bold; font-size: 15px; color: #333; display: block; margin-bottom: 5px; }
.sch-meta-badges { display: flex; gap: 8px; }
.sch-badge { font-size: 11px; padding: 2px 8px; border-radius: 4px; color: #555; background: #f1f5f9; }
.sch-bg-blue { background: #e0f2fe; color: #0284c7; }
.sch-file-actions { display: flex; gap: 10px; }
.sch-btn { padding: 8px 20px; border-radius: 50px; font-size: 13px; text-decoration: none; border: none; cursor: pointer; transition: 0.2s; font-family: inherit; display: inline-block; }
.sch-btn-dl { background: var(--sch-primary); color: #fff; }
.sch-btn-dl:hover { background: #333; color: #fff; }
.sch-btn-preview { background: #fff; color: var(--sch-primary); border: 1px solid var(--sch-primary); }
.sch-btn-preview:hover { background: var(--sch-primary); color: #fff; }
.sch-modal { display: none; position: fixed; z-index: 99999; left: 0; top: 0; width: 100%; height: 100%; background-color: rgba(0,0,0,0.7); align-items: center; justify-content: center; }
.sch-modal-content { background-color: #fefefe; width: 90%; height: 90%; border-radius: 8px; position: relative; overflow: hidden; box-shadow: 0 20px 50px rgba(0,0,0,0.5); }
.sch-close-modal { position: absolute; top: 10px; right: 20px; color: #333; font-size: 28px; font-weight: bold; cursor: pointer; z-index: 100; background: rgba(255,255,255,0.8); width: 40px; height: 40px; text-align: center; border-radius: 50%; line-height: 40px; }

/* --- موبایل (Responsive Fixes: 1, 3, 5) --- */
@media only screen and (max-width: 768px) {
    /* فیلترها تمام عرض و زیبا */
    .sch-filters { flex-direction: column; gap: 10px; width: 100%; }
    .sch-select { width: 100%; box-sizing: border-box; }
    
    /* مخفی کردن دکمه مشاهده در موبایل (Fix 3) */
    .sch-btn-preview { display: none !important; }
    
    /* چینش بهتر تولبار */
    .sch-toolbar { padding: 8px 10px; }
    .sch-toolbar-right { gap: 10px; }
    
    /* گرید موبایل */
    .sch-grid-container { display: grid !important; grid-template-columns: repeat(var(--sch-mobile-cols), 1fr) !important; gap: 10px !important; }
    .sch-grid-card { min-height: 100px !important; padding: 10px !important; }
    .sch-card-img { width: var(--sch-mobile-img-size) !important; max-height: 80px; }
    
    .sch-file-row { flex-direction: column; align-items: stretch; text-align: right; }
    .sch-file-actions { justify-content: flex-end; margin-top: 10px; }
    .sch-btn { flex: 1; text-align: center; }
}