/* ============================================================
   SHIMAX TEMPLATES EXPLORER SECTION (FORCED VERTICAL STACK)
   ============================================================ */

/* ۱. شکستن چیدمان افقی والد و اجبار به ستونی شدن */
.main-viewport,
.content-wrapper,
main {
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    justify-content: flex-start !important;
    width: 100% !important;
    padding: 0 !important;
}

/* ۲. بدنه سکشن تمپلیت‌ها */
.shimax-templates-section {
    display: block !important;
    width: 100% !important;
    clear: both !important;
    position: relative;
    padding: 2rem 0 6rem 0 !important;
    margin-top: -1rem !important;
    background: transparent;
    z-index: 10;
}

.templates-container {
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 2rem;
    box-sizing: border-box;
}

/* ۳. هدر و عناوین */
.templates-header {
    text-align: center;
    max-width: 750px;
    margin: 0 auto 3rem auto;
}

.templates-badge {
    display: inline-block;
    padding: 0.35rem 1rem;
    border-radius: 30px;
    background: rgba(16, 185, 129, 0.1);
    color: var(--emerald-500);
    border: 1px solid rgba(16, 185, 129, 0.25);
    font-size: 0.85rem;
    font-weight: 800;
    margin-bottom: 1rem;
}

.templates-title {
    font-size: 2.3rem;
    font-weight: 900;
    color: var(--text-primary);
    letter-spacing: -0.5px;
    margin-bottom: 0.75rem;
    line-height: 1.3;
}

.templates-subtitle {
    font-size: 1.05rem;
    color: var(--text-secondary);
    font-weight: 500;
    line-height: 1.8;
}

/* ۴. دکمه‌های فیلتر دسته‌بندی */
.templates-filter-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-bottom: 3.5rem;
}

.filter-tab {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.65rem 1.35rem;
    border-radius: 40px;
    border: 1px solid var(--border-color);
    background: var(--surface-card);
    color: var(--text-secondary);
    font-family: inherit;
    font-size: 0.92rem;
    font-weight: 700;
    cursor: pointer;
    box-shadow: var(--shadow-subtle);
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.filter-tab i {
    font-size: 0.95rem;
    transition: transform 0.25s ease;
}

.filter-tab:hover {
    border-color: var(--border-hover);
    color: var(--emerald-500);
    transform: translateY(-2px);
}

.filter-tab.active {
    background: var(--emerald-500);
    border-color: var(--emerald-500);
    color: #ffffff;
    box-shadow: 0 6px 20px var(--emerald-glow);
}

.filter-tab.active i {
    transform: scale(1.1);
}

/* ۵. گرید کارت‌ها */
.templates-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.5rem;
    width: 100%;
}

.template-card {
    background: var(--surface-card);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-subtle);
    transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1),
                opacity 0.35s cubic-bezier(0.16, 1, 0.3, 1),
                border-color 0.35s ease,
                box-shadow 0.35s ease;
    will-change: transform, opacity;
}

.template-card.is-hidden {
    display: none !important;
}

.template-card.fade-out {
    opacity: 0;
    transform: scale(0.94) translateY(12px);
    pointer-events: none;
}

.template-card.fade-in {
    opacity: 1;
    transform: scale(1) translateY(0);
}

.template-card:hover {
    transform: translateY(-8px);
    border-color: var(--emerald-500);
    box-shadow: var(--shadow-card), 0 0 25px var(--emerald-glow);
}

/* ۶. بخش مدیا و بج‌ها */
.template-media {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 11;
    overflow: hidden;
    background: #000;
}

.template-media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.template-card:hover .template-media img {
    transform: scale(1.06);
}

.media-hover-overlay {
    position: absolute;
    inset: 0;
    background: rgba(9, 13, 22, 0.65);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.template-card:hover .media-hover-overlay {
    opacity: 1;
}

.play-demo-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.55rem 1.1rem;
    border-radius: 30px;
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.4);
    color: #ffffff;
    font-size: 0.85rem;
    font-weight: 800;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.card-badge {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 3;
    font-size: 0.72rem;
    font-weight: 800;
    padding: 0.25rem 0.75rem;
    border-radius: 8px;
    line-height: 1.2;
}

.card-badge.premium {
    background: #fbbf24;
    color: #000000;
    box-shadow: 0 2px 10px rgba(251, 191, 36, 0.4);
}

.card-badge.free {
    background: var(--emerald-500);
    color: #ffffff;
    box-shadow: 0 2px 10px var(--emerald-glow);
}

/* ۷. اطلاعات متنی کارت */
.template-info {
    padding: 1.4rem;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.template-name {
    font-size: 1.15rem;
    font-weight: 900;
    color: var(--text-primary);
    margin-bottom: 0.6rem;
    line-height: 1.4;
    transition: color 0.2s ease;
}

.template-card:hover .template-name {
    color: var(--emerald-500);
}

.template-desc {
    font-size: 0.88rem;
    color: var(--text-muted);
    line-height: 1.7;
    margin-bottom: 1.5rem;
    flex: 1;
}

/* ۸. فوتر کارت */
.template-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.use-count {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-muted);
}

.btn-use-template {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    color: var(--emerald-500);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 800;
    transition: gap 0.2s ease, color 0.2s ease;
}

.btn-use-template:hover {
    gap: 0.7rem;
    color: var(--emerald-400);
}

/* حالت خالی (Empty State) */
.templates-empty-state {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4.5rem 1.5rem;
    text-align: center;
    background: var(--surface-card);
    border: 1px dashed var(--border-color);
    border-radius: 20px;
}

.templates-empty-state i {
    font-size: 2.5rem;
    color: var(--emerald-500);
    margin-bottom: 1rem;
}

.templates-empty-state p {
    color: var(--text-secondary);
    font-size: 0.95rem;
    font-weight: 600;
    margin: 0;
}

/* ۹. ریسپانسیو */
@media (max-width: 1280px) {
    .templates-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.5rem;
    }
}

@media (max-width: 768px) {
    .templates-grid {
        grid-template-columns: 1fr;
        gap: 1.25rem;
    }

    .templates-container {
        padding: 0 1rem;
    }

    .templates-title {
        font-size: 1.75rem;
    }

    .templates-filter-bar {
        gap: 0.5rem;
    }

    .filter-tab {
        padding: 0.55rem 1rem;
        font-size: 0.85rem;
    }
}
.shimax-popup-overlay {
    position: fixed;
    inset: 0;
    z-index: 100000;
    background: rgba(3, 7, 18, 0.78);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.25rem;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.35s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.35s ease;
}

.shimax-popup-overlay.is-visible {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.shimax-popup-card {
    position: relative;
    width: 100%;
    max-width: 500px;
    background: linear-gradient(180deg, rgba(17, 24, 39, 0.96) 0%, rgba(9, 14, 26, 0.98) 100%);
    border: 1px solid rgba(16, 185, 129, 0.25);
    border-radius: 24px;
    box-shadow: 0 30px 70px -10px rgba(0, 0, 0, 0.8), 0 0 50px -10px rgba(16, 185, 129, 0.15);
    padding: 2.25rem 2rem 2rem;
    overflow: hidden;
    transform: scale(0.92) translateY(24px);
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.shimax-popup-overlay.is-visible .shimax-popup-card {
    transform: scale(1) translateY(0);
}

.shimax-popup-glow-top {
    position: absolute;
    top: -90px;
    left: 50%;
    transform: translateX(-50%);
    width: 260px;
    height: 180px;
    background: radial-gradient(ellipse at center, rgba(16, 185, 129, 0.28) 0%, rgba(16, 185, 129, 0) 70%);
    filter: blur(35px);
    pointer-events: none;
}

.shimax-popup-glow-bottom {
    position: absolute;
    bottom: -80px;
    right: -40px;
    width: 180px;
    height: 180px;
    background: radial-gradient(circle, rgba(5, 150, 105, 0.18) 0%, rgba(5, 150, 105, 0) 70%);
    filter: blur(30px);
    pointer-events: none;
}

.shimax-popup-close-btn {
    position: absolute;
    top: 1.25rem;
    left: 1.25rem;
    width: 38px;
    height: 38px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: #94a3b8;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.05rem;
    transition: all 0.2s ease;
    z-index: 10;
}

.shimax-popup-close-btn:hover {
    background: rgba(239, 68, 68, 0.12);
    border-color: rgba(239, 68, 68, 0.35);
    color: #f87171;
    transform: rotate(90deg);
}

.shimax-popup-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    margin-bottom: 1.5rem;
}

.shimax-popup-icon-box {
    position: relative;
    width: 68px;
    height: 68px;
    border-radius: 20px;
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.2) 0%, rgba(5, 150, 105, 0.05) 100%);
    border: 1px solid rgba(16, 185, 129, 0.35);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #34d399;
    font-size: 1.85rem;
    margin-bottom: 1.25rem;
    box-shadow: 0 12px 24px -6px rgba(16, 185, 129, 0.25);
}

.shimax-popup-icon-ring {
    position: absolute;
    inset: -6px;
    border-radius: 24px;
    border: 1px dashed rgba(16, 185, 129, 0.4);
    animation: popupRingRotate 18s linear infinite;
}

@keyframes popupRingRotate {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.shimax-popup-status-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.35rem 0.9rem;
    background: rgba(16, 185, 129, 0.08);
    border: 1px solid rgba(16, 185, 129, 0.25);
    border-radius: 50px;
    color: #10b981;
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: -0.2px;
}

.shimax-popup-pulse-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #10b981;
    box-shadow: 0 0 10px #10b981;
    animation: popupPulse 1.8s infinite ease-in-out;
}

@keyframes popupPulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.4; transform: scale(0.75); }
}

.shimax-popup-body {
    text-align: center;
    margin-bottom: 1.75rem;
}

.shimax-popup-heading {
    color: #ffffff;
    font-size: 1.35rem;
    font-weight: 800;
    line-height: 1.45;
    margin: 0 0 0.85rem;
}

.shimax-popup-lead {
    color: #94a3b8;
    font-size: 0.92rem;
    line-height: 1.8;
    margin: 0 0 1.5rem;
}

.shimax-popup-stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}

.shimax-popup-stat-item {
    background: rgba(255, 255, 255, 0.025);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 14px;
    padding: 0.75rem 0.85rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-align: right;
}

.shimax-popup-stat-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: rgba(16, 185, 129, 0.1);
    color: #10b981;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.95rem;
    flex-shrink: 0;
}

.shimax-popup-stat-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.shimax-popup-stat-text .stat-label {
    font-size: 0.72rem;
    color: #64748b;
    font-weight: 500;
}

.shimax-popup-stat-text .stat-value {
    font-size: 0.82rem;
    color: #e2e8f0;
    font-weight: 700;
}

.shimax-popup-footer {
    display: flex;
}

.shimax-popup-btn-confirm {
    width: 100%;
    padding: 0.95rem 1.5rem;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 14px;
    color: #ffffff;
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    box-shadow: 0 10px 25px -4px rgba(16, 185, 129, 0.4);
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.shimax-popup-btn-confirm:hover {
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
    box-shadow: 0 14px 30px -4px rgba(16, 185, 129, 0.55);
    transform: translateY(-2px);
}

@media (max-width: 520px) {
    .shimax-popup-card {
        padding: 2rem 1.25rem 1.5rem;
    }
    .shimax-popup-stats-grid {
        grid-template-columns: 1fr;
    }
    .shimax-popup-heading {
        font-size: 1.2rem;
    }
}
/* ============================================================
   SHIMAX HERO CINEMATIC VIDEO WRAPPER
   ============================================================ */
.shimax-hero-video-wrapper {
    position: relative;
    width: 100%;
    max-width: 1200px;
    margin: 1.5rem auto 3rem auto;
    border-radius: 28px;
    overflow: hidden;
    aspect-ratio: 16 / 9;
    background: #090d16;
    border: 1px solid rgba(16, 185, 129, 0.2);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6), 0 0 40px rgba(16, 185, 129, 0.1);
}

.hero-video-element {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
    object-position: center;
    background-color: #090d16;
}

.hero-video-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(9, 13, 22, 0.1) 0%, rgba(9, 13, 22, 0.65) 100%);
    pointer-events: none;
    z-index: 2;
}
/* --- نوار دسته‌بندی مرتب --- */
.templates-filter-wrapper {
    width: 100%;
    margin-bottom: 24px;
    display: flex;
    justify-content: center;
}

.templates-filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    max-width: 1100px;
}

.filter-tab.hidden-tab {
    display: none;
}

.filter-tab.toggle-more-tabs {
    background: rgba(255, 255, 255, 0.08);
    border: 1px dashed rgba(255, 255, 255, 0.25);
    color: #00ff9d;
}

/* --- تثبیت ساختار و ارتفاع کارت‌ها --- */
.templates-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 20px;
    align-items: stretch;
}

.template-card {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 380px;
    max-height: 420px;
    background: #0d1815;
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 20px;
    overflow: hidden;
    transition: transform 0.25s ease, border-color 0.25s ease;
}

.template-card:hover {
    transform: translateY(-4px);
    border-color: rgba(0, 255, 157, 0.35);
}

/* قفل کردن کادر تصویر روی نسبت استاندارد */
.template-media {
    position: relative;
    width: 100%;
    height: 200px;
    aspect-ratio: 16 / 10;
    background: #060d0b;
    overflow: hidden;
    flex-shrink: 0;
}

.template-media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center top;
    display: block;
}

/* اطلاعات کارت و متون */
.template-info {
    padding: 14px 16px 16px;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    justify-content: space-between;
}

.template-name {
    font-size: 15px;
    font-weight: 800;
    color: #ffffff;
    margin-bottom: 6px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* جلوگیری از دراز شدن کارت به خاطر توضیحات طولانی */
.template-desc {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.55);
    line-height: 1.6;
    margin-bottom: 12px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    min-height: 38px;
    max-height: 38px;
}

.template-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: auto;
    padding-top: 10px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}