/* متغیرهای رنگی و پایه‌ای */
:root {
    --vira-primary: #ff6600;
    --vira-primary-glow: #ff8533;
    --vira-paper-color: #f4eedc;
    --vira-text-dark: #1a1a1a;
    /* زمان انیمیشن برای کندتر و نرم‌تر شدن جابجایی اسلایدها افزایش یافت */
    --animation-duration: 1200ms; 
}

.vira-mystery-slider-wrapper {
    position: relative;
    width: 100%;
    height: auto; 
    padding: 600px 0 90px 0; 
    overflow: hidden;
    background: radial-gradient(
        circle 400px at var(--mouse-x, 50%) var(--mouse-y, 50%),
        rgba(255, 255, 255, 0.05),
        transparent 80%
    );
    font-family: 'IRANSans', 'Vazirmatn', Tahoma, Arial, sans-serif; 
    direction: ltr; 
}

@media (min-width: 993px) {
    .vira-mystery-slider-wrapper {
        padding-top: 120px; 
    }
}

.vira-slider-inner {
    position: relative;
    width: 100%;
    max-width: 1100px;
    margin: 0 auto;
    display: grid; 
}

.vira-slide-item {
    grid-area: 1 / 1; 
    position: relative; 
    width: 100%;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--animation-duration) ease;
    will-change: transform, opacity;
}

.vira-slide-item.active {
    opacity: 1;
    pointer-events: auto;
    z-index: 2;
}

@keyframes toss-out-left {
    from { transform: translateX(0) rotate(0deg); opacity: 1; }
    to { transform: translateX(-150%) rotate(-30deg); opacity: 0; }
}
@keyframes toss-out-right {
    from { transform: translateX(0) rotate(0deg); opacity: 1; }
    to { transform: translateX(150%) rotate(30deg); opacity: 0; }
}
@keyframes drop-in-from-right {
    from { transform: translateX(100%) rotate(15deg); opacity: 0; }
    to { transform: translateX(0) rotate(0deg); opacity: 1; }
}
@keyframes drop-in-from-left {
    from { transform: translateX(-100%) rotate(-15deg); opacity: 0; }
    to { transform: translateX(0) rotate(0deg); opacity: 1; }
}

.vira-slide-item.is-leaving-prev { animation: toss-out-right var(--animation-duration) forwards; }
.vira-slide-item.is-leaving-next { animation: toss-out-left var(--animation-duration) forwards; }
.vira-slide-item.is-entering-prev { animation: drop-in-from-left var(--animation-duration) forwards; }
.vira-slide-item.is-entering-next { animation: drop-in-from-right var(--animation-duration) forwards; }

.vira-slide-perspective-area {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    perspective: 1500px;
    padding: 20px 0;
}

.case-folder {
    background-color: var(--vira-paper-color);
    padding: 30px 40px;
    width: 40%;
    max-width: 450px;
    box-shadow: 5px 10px 25px rgba(0,0,0,0.6);
    position: relative;
    border-radius: 20px; 
    transform: rotate(-2deg) rotateX(var(--rotate-x, 0)) rotateY(var(--rotate-y, 0));
    transition: transform 0.3s ease-out, box-shadow 0.3s ease, z-index 0.3s ease;
    z-index: 3;
    direction: rtl; 
    display: flex;
    flex-direction: column;
    justify-content: center;
    will-change: transform;
}

/* افکت Hover پرونده بدون وسط‌چین شدن متون */
.case-folder:hover {
    box-shadow: 8px 15px 35px rgba(0,0,0,0.8);
    transform: translateY(-8px) scale(1.02) rotate(-2deg) rotateX(var(--rotate-x, 0)) rotateY(var(--rotate-y, 0));
    z-index: 10;
}

.case-folder-content-wrapper {
    text-align: center; /* وسط‌چین شدن متون */
    margin-bottom: 25px;
}

@keyframes stamp-in {
    from { transform: scale(3) rotate(-15deg); opacity: 0; }
    to { transform: scale(1) rotate(-15deg); opacity: 0.8; }
}
.case-stamp {
    position: absolute;
    top: -15px;
    left: 15px; /* تنظیم به سمت چپ */
    margin: 0; /* لغو وسط‌چین */
    width: max-content; /* اضافه شد برای جلوگیری از تمام‌عرض شدن */
    color: var(--vira-primary);
    border: 3px solid var(--vira-primary);
    padding: 5px 15px;
    font-size: 20px;
    font-weight: 900;
    transform: rotate(-15deg);
    opacity: 0.8;
    user-select: none;
    border-radius: 12px;
}
.active .case-stamp {
    animation: stamp-in 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) 0.3s forwards;
    animation-fill-mode: both;
}

.vira-slide-title-text {
    font-size: 26px;
    font-weight: 900;
    color: var(--vira-text-dark);
    margin-bottom: 10px;
    line-height: 1.3;
}

.vira-slide-desc-text {
    font-size: 15px;
    color: #222; 
    line-height: 1.7;
    font-weight: 500;
}

/* استایل و افکت ورود عکس پولاروید */
.polaroid {
    background: #fff;
    /* فضای خالی زیر عنوان کم شد (از 40px به 20px) */
    padding: 12px 12px 20px 12px;
    box-shadow: 3px 5px 20px rgba(0,0,0,0.7);
    width: 33%;
    max-width: 350px;
    margin-left: -5%;
    z-index: 4;
    position: relative;
    border-radius: 15px; 
    direction: rtl; 
    will-change: transform, opacity;
    opacity: 0; 
    transition: box-shadow 0.3s ease; 
}

/* تعریف انیمیشن اختصاصی و جذاب برای ورود عکس پولاروید */
@keyframes polaroid-in {
    0% { 
        opacity: 0; 
        transform: translateY(-100px) scale(1.2) rotate(-20deg); 
    }
    100% { 
        opacity: 1; 
        transform: translateY(0) scale(1) rotate(var(--initial-rotation, 5deg)) rotateX(var(--rotate-x, 0)) rotateY(var(--rotate-y, 0)); 
    }
}

/* وقتی اسلاید فعال می‌شود، انیمیشن با تاخیر و سرعت مناسب اجرا می‌شود */
.active .polaroid {
    animation: polaroid-in 1.2s cubic-bezier(0.175, 0.885, 0.32, 1.275) 0.4s both;
}

.active .polaroid:hover {
    box-shadow: 5px 15px 30px rgba(0,0,0,0.9);
    transform: translateY(-5px) scale(1.02) rotate(var(--initial-rotation, 5deg)) rotateX(var(--rotate-x, 0)) rotateY(var(--rotate-y, 0));
    z-index: 10;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.polaroid img {
    width: 100%;
    height: auto;
    display: block;
    filter: sepia(20%) contrast(1.05);
}
.polaroid-caption {
    text-align: center;
    margin-top: 10px;
    color: #333;
}
.polaroid-title {
    /* نوشته بولدتر و ایتالیک شد */
    font-weight: 900;
    font-style: italic;
    font-size: 16px;
    margin-bottom: 0;
}

.tape {
    background-color: rgba(255, 255, 224, 0.4);
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
    position: absolute;
    width: 90px;
    height: 25px;
    top: -12px;
    left: 50%;
    transform: translateX(-50%) rotate(-3deg);
    border-left: 1px dashed rgba(0,0,0,0.1);
    border-right: 1px dashed rgba(0,0,0,0.1);
}

.vira-btn-wrapper {
    text-align: center; /* وسط‌چین شدن دکمه */
    width: 100%;
}

.vira-action-btn {
    display: inline-flex !important; 
    align-items: center;
    justify-content: center;
    gap: 8px;
    background-color: var(--vira-primary);
    color: #fff !important;
    padding: 10px 24px;
    text-decoration: none !important;
    border-radius: 50px;
    font-weight: bold;
    font-size: 15px;
    transition: all 0.3s ease;
    border: 2px solid var(--vira-primary);
    box-shadow: 0 0 15px rgba(255, 102, 0, 0.4);
    position: relative;
    overflow: hidden;
    z-index: 10;
}

@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(255, 102, 0, 0.6); }
    70% { box-shadow: 0 0 0 15px rgba(255, 102, 0, 0); }
    100% { box-shadow: 0 0 0 0 rgba(255, 102, 0, 0); }
}
.vira-action-btn:hover {
    background-color: #fff !important;
    color: var(--vira-primary) !important;
    transform: translateY(-3px);
    box-shadow: 0 5px 20px rgba(0,0,0,0.4);
}
.active .vira-action-btn {
    animation: pulse 2s infinite;
}

.vira-slider-controls {
    position: absolute;
    bottom: 25px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    background: rgba(0,0,0,0.5);
    padding: 8px 15px;
    border-radius: 50px;
    backdrop-filter: blur(5px);
}

.vira-nav-btn {
    background: transparent !important;
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
    color: rgba(255,255,255,0.8) !important;
    font-size: 24px;
    cursor: pointer;
    transition: all 0.3s;
    padding: 0 10px;
}
.vira-nav-btn:hover, .vira-nav-btn:focus {
    background: transparent !important;
    color: var(--vira-primary) !important;
    transform: scale(1.2);
}

.vira-slider-dots { display: flex; gap: 8px; }
.vira-dot {
    width: 10px; height: 10px;
    background-color: rgba(255,255,255,0.4);
    border-radius: 50%;
    cursor: pointer;
    transition: 0.3s;
}
.vira-dot.active {
    background-color: var(--vira-primary);
    transform: scale(1.3);
    box-shadow: 0 0 8px var(--vira-primary);
}

/* 
==================================================
  اصلاحات جراحی‌شده برای تبلت و موبایل 
==================================================
*/

@media (max-width: 992px) {
    /* اصلاح مشکل فضای خالی (پدینگ) عظیم در تبلت */
    .vira-mystery-slider-wrapper { padding: 80px 0 80px 0; }
    
    .case-folder { width: 50%; padding: 25px 30px; }
    .polaroid { width: 45%; }
    .vira-slide-title-text { font-size: 22px; }
}

@media (max-width: 768px) {
    .vira-mystery-slider-wrapper { padding: 20px 0 70px 0; }
    .vira-slide-perspective-area {
        flex-direction: column; 
        justify-content: center;
        gap: 15px; 
        padding: 10px 0;
    }
    .polaroid {
        width: 60%; 
        margin: 0 auto;
        z-index: 5;
        padding: 8px 8px 25px 8px; 
        box-shadow: 2px 4px 15px rgba(0,0,0,0.3);
    }
    .polaroid-title { font-size: 13px; }
    
    .case-folder {
        width: 85%; 
        box-sizing: border-box; 
        margin: 0 auto;
        padding: 15px; 
        border-radius: 15px;
        align-items: center; 
        transform: rotate(2deg); 
    }
    .case-folder-content-wrapper { 
        margin-bottom: 10px; 
        text-align: center; 
        width: 100%; 
        overflow: hidden;
    }
    .vira-slide-title-text {
        font-size: 18px; 
        margin-bottom: 5px;
    }
    .vira-slide-desc-text {
        /* *** تغییر جراحی‌شده: تنظیم متن به صورت 2 خطی با سه‌نقطه در انتها *** */
        font-size: 12px; 
        line-height: 1.6;
        display: -webkit-box;
        -webkit-line-clamp: 2; /* تعداد خطوط */
        -webkit-box-orient: vertical;
        overflow: hidden;
        white-space: normal;
        width: 100%;
        margin-bottom: 10px; /* اضافه کردن کمی فاصله تا دکمه */
    }
    .case-stamp { 
        top: -10px; 
        left: 10px; 
        right: auto; 
        margin: 0; 
        font-size: 14px; 
        padding: 3px 10px;
    }
    .vira-btn-wrapper { text-align: center; }
    .vira-action-btn { 
        padding: 8px 18px; 
        font-size: 13px; 
    }
    
    .vira-slider-controls { 
        bottom: 10px; 
        padding: 5px 12px;
        gap: 10px;
    }
    .vira-nav-btn { font-size: 20px; }
}
