/* =========================================
   1. استایل‌های سمت مدیریت (Admin)
   ========================================= */
.ypv-row { 
    display: flex; 
    align-items: flex-end; 
    gap: 10px;
    border-bottom: 1px solid #eee; 
    padding: 15px 0; 
    background: #fafafa; 
}
.ypv-col { 
    display: flex; 
    flex-direction: column; 
}
.ypv-col label { 
    font-weight: bold; 
    margin-bottom: 5px; 
    font-size: 12px; 
}
.ypv-input { 
    width: 100%;
    min-width: 250px;
}
.ypv-preview-img { 
    width: 60px; 
    height: 60px; 
    object-fit: cover; 
    border-radius: 4px; 
    border: 1px solid #ddd; 
    background: #fff; 
    margin-top: 5px; 
    display: none; 
}
.ypv-preview-img[src^="http"] { display: block; }
.button.remove-row { 
    color: #a00; 
    border-color: #a00; 
}

/* =========================================
   2. استایل‌های گالری (Grid)
   ========================================= */
.ypv-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 15px;
    margin-top: 20px;
}

.ypv-item {
    position: relative;
    cursor: pointer;
    border-radius: 12px;
    overflow: hidden;
    background: #222; /* رنگ پس زمینه اگر عکس نبود */
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
    border: 1px solid #eee;
}

.ypv-item:hover { transform: translateY(-3px); box-shadow: 0 8px 15px rgba(0,0,0,0.15); }

/* ابعاد استاندارد */
.ypv-item.horizontal { grid-column: span 2; aspect-ratio: 16 / 9; }
.ypv-item.vertical { aspect-ratio: 9 / 16; }

.ypv-placeholder { width: 100%; height: 100%; position: relative; }

/* اصلاح نمایش عکس (پر کردن قاب) */
.ypv-placeholder img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    opacity: 0.9;
    transition: 0.3s;
}

/* اگر عکس خراب بود (مثل اسکرین شات تو) مخفی شود تا رنگ پس زمینه دیده شود */
.ypv-placeholder img[src=""], .ypv-placeholder img:not([src]) { opacity: 0; }

.ypv-placeholder:hover img { opacity: 0.6; transform: scale(1.05); }

/* دکمه Play */
.ypv-play {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    font-size: 24px; color: white;
    background: rgba(0, 0, 0, 0.6);
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 50%;
    width: 45px; height: 45px;
    display: flex; align-items: center; justify-content: center;
    z-index: 2; pointer-events: none;
    backdrop-filter: blur(4px);
    transition: 0.3s;
}
.ypv-item:hover .ypv-play { background: #e00; border-color: #e00; transform: translate(-50%, -50%) scale(1.1); }

/* =========================================
   3. استایل‌های لایت‌باکس (Modal) - جدید
   ========================================= */
.ypv-modal {
    display: none; /* پیش فرض مخفی */
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background-color: rgba(0, 0, 0, 0.9); /* پس زمینه تاریک */
    z-index: 99999; /* روی همه چیز */
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.ypv-modal.active { display: flex; opacity: 1; }

.ypv-modal-content {
    position: relative;
    width: 90%;
    max-width: 1000px; /* حداکثر عرض */
    aspect-ratio: 16 / 9; /* پیش فرض افقی */
    background: #000;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 0 20px rgba(0,0,0,0.5);
}

/* حالت عمودی برای لایت باکس */
.ypv-modal-content.vertical-mode {
    max-width: 450px; /* عرض کمتر برای موبایلی */
    aspect-ratio: 9 / 16;
}

.ypv-close {
    position: absolute;
    top: 20px; right: 30px;
    color: #fff;
    font-size: 40px;
    font-weight: bold;
    cursor: pointer;
    z-index: 100000;
    transition: 0.3s;
}
.ypv-close:hover { color: #f00; transform: rotate(90deg); }

/* ریسپانسیو */
@media (max-width: 768px) {
    .ypv-modal-content { width: 95%; }
    .ypv-close { top: 10px; right: 15px; font-size: 30px; }
}