/* ================================================================
   استایل بلاک‌های صفحه‌ساز
   ================================================================ */

.cms-block {
    margin: 20px 0;
    animation: cmsFadeIn 0.3s ease;
}

@keyframes cmsFadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ================================================================
   تیتر
   ================================================================ */

.cms-heading { color: var(--gold); font-weight: 800; line-height: 1.3; }
body.light .cms-heading { color: var(--purple); }
.cms-heading.h1 { font-size: clamp(1.8rem, 1.4rem + 2vw, 2.6rem); }
.cms-heading.h2 { font-size: clamp(1.4rem, 1.2rem + 1.2vw, 2rem); }
.cms-heading.h3 { font-size: clamp(1.15rem, 1.05rem + 0.6vw, 1.5rem); }

/* ================================================================
   متن
   ================================================================ */

.cms-text {
    color: var(--text-secondary);
    line-height: 1.95;
    font-size: clamp(0.92rem, 0.88rem + 0.2vw, 1.05rem);
}

/* ================================================================
   بنر ساده (full-width)
   ================================================================ */

.cms-banner {
    position: relative;
    margin-top: 12px;
    margin-bottom: 0;
    width: 100vw;
    max-width: 100vw;
    margin-right: calc(50% - 50vw);
    margin-left: calc(50% - 50vw);
}

.cms-banner-link { display: block; position: relative; }

.cms-banner-img {
    width: 100%;
    height: auto;
    display: block;
    object-fit: cover;
}

.cms-banner-overlay {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    padding: clamp(24px, 4vw, 40px) clamp(20px, 4vw, 32px);
    display: flex;
    flex-direction: column;
    color: #fff;
}

.cms-banner-title {
    font-size: clamp(1.4rem, 1.1rem + 1.5vw, 2.2rem);
    font-weight: 800;
    margin-bottom: 10px;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
}

.cms-banner-subtitle {
    font-size: clamp(0.92rem, 0.85rem + 0.3vw, 1.1rem);
    opacity: 0.9;
    text-shadow: 0 2px 6px rgba(0, 0, 0, 0.5);
}

/* ================================================================
   اسلایدر بنر (full-width + ارتفاع ثابت و ریسپانسیو)
   ================================================================ */

.cms-banner-slider {
    position: relative;
    margin-top: 12px;
    margin-bottom: 0;
    width: 100vw;
    max-width: 100vw;
    margin-right: calc(50% - 50vw);
    margin-left: calc(50% - 50vw);
    border-radius: 0;
    overflow: hidden;
    background: #000;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    transition: box-shadow 0.4s ease;

    height: 420px;
    min-height: 320px;
    max-height: 480px;
}

.cms-banner-slider:hover {
    box-shadow: 0 12px 40px rgba(108, 92, 231, 0.25);
}

.cbs-track {
    position: relative;
    width: 100%;
    height: 100%;
}

.cbs-slide {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    transition: opacity 0.7s ease;
    display: block;
    text-decoration: none;
    pointer-events: none;
}

.cbs-slide.active {
    opacity: 1;
    z-index: 1;
    pointer-events: auto;
}

.cbs-media {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.8s cubic-bezier(0.4, 0, 0.2, 1);
    background: #000;
}

.cbs-slide.active:hover .cbs-media {
    transform: scale(1.04);
}

.cbs-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 36px 32px 64px;
    background: linear-gradient(
        to top,
        rgba(0, 0, 0, 0.85) 0%,
        rgba(0, 0, 0, 0.4) 40%,
        transparent 100%
    );
    color: #fff;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s ease 0.2s, transform 0.6s cubic-bezier(0.4, 0, 0.2, 1) 0.2s;
}

.cbs-slide.active .cbs-overlay {
    opacity: 1;
    transform: translateY(0);
}

.cbs-title {
    font-size: clamp(1.4rem, 1.1rem + 1.5vw, 2.2rem);
    font-weight: 800;
    margin-bottom: 10px;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
    opacity: 0;
    transform: translateY(15px);
    transition: opacity 0.5s ease 0.35s, transform 0.5s cubic-bezier(0.4, 0, 0.2, 1) 0.35s;
}

.cbs-slide.active .cbs-title {
    opacity: 1;
    transform: translateY(0);
}

.cbs-subtitle {
    font-size: clamp(0.92rem, 0.85rem + 0.3vw, 1.1rem);
    opacity: 0;
    transform: translateY(10px);
    text-shadow: 0 2px 6px rgba(0, 0, 0, 0.5);
    transition: opacity 0.5s ease 0.5s, transform 0.5s cubic-bezier(0.4, 0, 0.2, 1) 0.5s;
}

.cbs-slide.active .cbs-subtitle {
    opacity: 0.9;
    transform: translateY(0);
}

.cms-banner-slider::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #FFD700, #F5A623, #6C5CE7, #FFD700);
    background-size: 200% 100%;
    z-index: 4;
    animation: cbsShimmer 4s linear infinite;
}

@keyframes cbsShimmer {
    0% { background-position: 0% 0%; }
    100% { background-position: 200% 0%; }
}

.cbs-prev,
.cbs-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.55);
    color: #fff;
    border: 1.5px solid rgba(255, 255, 255, 0.85);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    z-index: 5;
    transition: all 0.25s ease;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
}

.cbs-prev:hover,
.cbs-next:hover {
    background: rgba(0, 0, 0, 0.8);
    border-color: #fff;
    transform: translateY(-50%) scale(1.08);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.5);
}

.cbs-prev:active,
.cbs-next:active {
    transform: translateY(-50%) scale(0.96);
}

.cbs-prev:focus-visible,
.cbs-next:focus-visible {
    outline: 2px solid var(--gold, #FFD700);
    outline-offset: 2px;
}

.cbs-prev { right: 20px; }
.cbs-next { left: 20px; }

.cbs-dots {
    position: absolute;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 8px;
    z-index: 6;
    flex-wrap: wrap;
    justify-content: center;
    padding: 7px 14px;
    background: rgba(0, 0, 0, 0.55);
    border-radius: 9999px;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    box-shadow: 0 3px 12px rgba(0, 0, 0, 0.4);
    pointer-events: auto;
}

.cbs-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.7);
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 0;
}

.cbs-dot:hover { background: rgba(255, 255, 255, 0.85); }

.cbs-dot.active {
    background: var(--gold, #FFD700);
    border-color: #fff;
    transform: scale(1.35);
    box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.25);
}

.cbs-dot:focus-visible {
    outline: 2px solid var(--gold, #FFD700);
    outline-offset: 2px;
}

/* ================================================================
   لیست
   ================================================================ */

.cms-list { display: flex; flex-direction: column; gap: 10px; padding: 14px 0; }

.cms-list-item {
    display: flex; align-items: center; gap: 12px; padding: 12px 16px;
    border-radius: var(--radius-sm); color: var(--text-secondary); text-decoration: none;
    transition: all var(--transition); background: var(--bg-input); border: 1px solid var(--border-color);
}

.cms-list-item:hover { border-color: var(--gold); color: var(--gold); transform: translateX(-5px); }
.cms-list-item i { color: var(--gold); font-size: 0.95rem; flex-shrink: 0; }
body.light .cms-list-item i { color: var(--purple); }
body.light .cms-list-item:hover { border-color: var(--purple); color: var(--purple); }

/* ================================================================
   محصولات
   ================================================================ */

.cms-products { margin: 28px 0; }

.cms-products-title {
    color: var(--gold); font-size: clamp(1.15rem, 1.05rem + 0.5vw, 1.4rem); font-weight: 800;
    margin-bottom: 20px;
    display: flex; align-items: center; gap: 10px;
    border-right: 4px solid var(--gold); padding-right: 14px;
}

body.light .cms-products-title { color: var(--purple); border-right-color: var(--purple); }

.cms-products-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
}

.cms-product-card {
    background: var(--bg-card); border-radius: var(--radius-md); overflow: hidden;
    border: 1px solid var(--border-color); transition: all var(--transition);
}

.cms-product-card:hover {
    transform: translateY(-5px);
    border-color: var(--border-color-hover);
    box-shadow: var(--shadow-card-hover);
}

.cms-product-card a { display: block; text-decoration: none; color: inherit; }
.cms-product-img { position: relative; width: 100%; padding-top: 100%; background: var(--bg-input); overflow: hidden; }

.cms-product-img img {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    object-fit: contain; padding: 14px; transition: transform var(--transition-slow);
}

.cms-product-card:hover .cms-product-img img { transform: scale(1.06); }

.cms-product-name {
    padding: 12px 14px 6px; font-size: 0.9rem; font-weight: 700; color: var(--text-primary);
    overflow: hidden; text-overflow: ellipsis; display: -webkit-box;
    -webkit-line-clamp: 2; -webkit-box-orient: vertical; min-height: 2.8em;
}

.cms-product-price { padding: 4px 14px 14px; font-size: 1rem; font-weight: 700; color: var(--gold); }
body.light .cms-product-price { color: var(--purple); }

/* ================================================================
   دکمه
   ================================================================ */

.cms-button-wrap { padding: 16px 0; }

.cms-button {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    padding: 14px 32px; border-radius: var(--radius-full); font-weight: 700;
    font-size: 0.98rem; text-decoration: none; transition: all var(--transition); cursor: pointer;
}

.cms-button-primary { background: var(--gradient-primary); color: #fff; }
.cms-button-primary:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(108, 92, 231, 0.3); }
.cms-button-gold { background: var(--gradient-gold); color: var(--text-inverse); }
.cms-button-gold:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(255, 215, 0, 0.3); }
.cms-button-outline { background: transparent; color: var(--gold); border: 2px solid var(--gold); }
body.light .cms-button-outline { color: var(--purple); border-color: var(--purple); }
.cms-button-outline:hover { background: var(--gold); color: var(--text-inverse); }

/* ================================================================
   تصویر
   ================================================================ */

.cms-image-wrap { text-align: center; padding: 16px 0; }
.cms-image { max-width: 100%; height: auto; display: inline-block; }

/* ================================================================
   گالری
   ================================================================ */

.cms-gallery { margin: 24px 0; }
.cms-gallery-grid { display: grid; gap: 14px; }
.cms-gallery-item { position: relative; overflow: hidden; }
.cms-gallery-slider { position: relative; overflow: hidden; }
.cms-gallery-slides { display: flex; }
.cms-gallery-slide { flex-shrink: 0; }
.cms-gallery-slide img { display: block; }

.cms-gallery-prev,
.cms-gallery-next {
    position: absolute; top: 50%; transform: translateY(-50%);
    width: 42px; height: 42px; border-radius: 50%;
    background: rgba(0, 0, 0, 0.6); color: #fff;
    border: none; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    font-size: 1rem; z-index: 2; transition: all 0.2s;
}

.cms-gallery-prev:hover,
.cms-gallery-next:hover { background: var(--gold); color: #000; }
.cms-gallery-prev { right: 12px; }
.cms-gallery-next { left: 12px; }

.cms-gallery-dots {
    display: flex; justify-content: center; gap: 8px;
    margin-top: 14px; flex-wrap: wrap;
}

.cms-gallery-dot {
    width: 10px; height: 10px; border-radius: 50%;
    background: var(--border-color); border: none;
    cursor: pointer; transition: all 0.2s; padding: 0;
}

.cms-gallery-dot.active { background: var(--gold); transform: scale(1.3); }
body.light .cms-gallery-dot.active { background: var(--purple); }

/* ================================================================
   ویدیو
   ================================================================ */

.cms-video { margin: 24px 0; }
.cms-video-title { color: var(--gold); font-size: clamp(1.05rem, 1rem + 0.4vw, 1.3rem); margin-bottom: 14px; }
body.light .cms-video-title { color: var(--purple); }

.cms-video-wrap {
    position: relative; width: 100%; padding-top: 56.25%;
    border-radius: var(--radius-md); overflow: hidden; background: #000;
}

.cms-video-wrap iframe {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%; border: none;
}

/* ================================================================
   کمکی‌ها
   ================================================================ */

.cms-spacer { width: 100%; }
.cms-divider { width: 100%; margin: 24px 0; }
.cms-html { color: var(--text-primary); line-height: 1.85; }
.cms-loading { text-align: center; padding: 36px; color: var(--text-muted); font-size: 0.92rem; }

/* ================================================================
   ریسپانسیو — تمیز و هم‌راستا با style.css
   ================================================================ */

@media (max-width: 1400px) {
    .cms-products-list {
        grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
        gap: 18px;
    }
}

@media (max-width: 1200px) {
    .cms-banner-slider {
        height: 380px;
        min-height: 300px;
        max-height: 440px;
    }
    .cms-products-list {
        grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
        gap: 16px;
    }
}

@media (max-width: 992px) {
    .cms-banner-slider {
        height: 340px;
        min-height: 280px;
        max-height: 400px;
    }
    .cms-products-list {
        grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
        gap: 14px;
    }
}

@media (max-width: 768px) {
    .cms-heading.h1 { font-size: 1.6rem; }
    .cms-heading.h2 { font-size: 1.35rem; }
    .cms-heading.h3 { font-size: 1.12rem; }

    .cms-banner-slider {
        height: 300px;
        min-height: 240px;
        max-height: 360px;
        margin-top: 10px;
    }

    .cms-banner-overlay { padding: 24px 20px; }
    .cms-banner-title { font-size: 1.3rem; }
    .cms-banner-subtitle { font-size: 0.88rem; }

    .cbs-overlay { padding: 24px 20px 56px; }
    .cbs-title { font-size: 1.3rem; }
    .cbs-subtitle { font-size: 0.88rem; }

    .cbs-prev, .cbs-next {
        width: 40px;
        height: 40px;
        font-size: 0.88rem;
    }
    .cbs-prev { right: 12px; }
    .cbs-next { left: 12px; }
    .cbs-dots { bottom: 16px; padding: 5px 12px; }
    .cbs-dot { width: 9px; height: 9px; }

    .cms-products-title { font-size: 1.1rem; }
    .cms-products-list {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    .cms-button { padding: 12px 24px; font-size: 0.9rem; }
    .cms-gallery-grid { grid-template-columns: repeat(2, 1fr) !important; }
    .cms-gallery-prev, .cms-gallery-next {
        width: 36px;
        height: 36px;
        font-size: 0.85rem;
    }
}

@media (max-width: 576px) {
    .cms-banner-slider {
        height: 260px;
        min-height: 220px;
        max-height: 300px;
        margin-top: 8px;
    }
}

@media (max-width: 480px) {
    .cms-banner-slider {
        height: 220px;
        min-height: 200px;
        max-height: 260px;
    }

    .cbs-prev, .cbs-next {
        width: 36px;
        height: 36px;
        font-size: 0.82rem;
    }
    .cbs-prev { right: 8px; }
    .cbs-next { left: 8px; }
    .cbs-overlay { padding: 20px 16px 52px; }
    .cbs-title { font-size: 1.15rem; }
    .cbs-subtitle { font-size: 0.82rem; }
    .cbs-dots { bottom: 12px; padding: 4px 10px; gap: 6px; }
    .cbs-dot { width: 8px; height: 8px; }
    .cbs-slide.active:hover .cbs-media { transform: none; }

    .cms-products-list { gap: 10px; }
    .cms-product-name { font-size: 0.82rem; padding: 10px 12px 4px; }
    .cms-product-price { font-size: 0.9rem; padding: 2px 12px 12px; }
    .cms-product-img img { padding: 10px; }
}