/* ===== Hero Section ===== */
.hero {
    background: linear-gradient(135deg, var(--primary, #3b82f6), var(--primary-dark, #2563eb));
    color: var(--white, #ffffff);
    text-align: center;
    padding-block: clamp(60px, 10vw, 120px);
    padding-inline: clamp(15px, 4vw, 20px);
    position: relative;
    overflow: hidden;
}

.hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100" opacity="0.1"><circle cx="50" cy="50" r="40" fill="none" stroke="white" stroke-width="2"/><circle cx="50" cy="50" r="30" fill="none" stroke="white" stroke-width="2"/><circle cx="50" cy="50" r="20" fill="none" stroke="white" stroke-width="2"/></svg>') repeat;
    animation: rotateBg 60s linear infinite;
}

.hero h1 {
    font-size: clamp(2.2rem, 5vw, 3.5rem);
    font-weight: 800;
    margin-block-end: clamp(15px, 3vw, 20px);
    position: relative;
    animation: fadeInDown 0.8s ease;
    text-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.hero p {
    font-size: clamp(1.1rem, 3vw, 1.3rem);
    max-width: 700px;
    margin-inline: auto;
    margin-block-end: clamp(30px, 5vw, 40px);
    position: relative;
    animation: fadeInUp 0.8s ease 0.2s both;
    opacity: 0.95;
}

/* ===== Search Box ===== */
.search-box {
    max-width: 700px;
    margin-inline: auto;
    position: relative;
    animation: fadeIn 1s ease 0.4s both;
}

.search-box input {
    width: 100%;
    padding-block: clamp(16px, 3vw, 20px);
    padding-inline-start: clamp(100px, 15vw, 140px);
    padding-inline-end: clamp(20px, 4vw, 30px);
    font-size: clamp(1rem, 2.5vw, 1.2rem);
    border: none;
    border-radius: var(--radius-full, 50px);
    box-shadow: var(--shadow-lg);
    outline: none;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    background: var(--white, #ffffff);
}

.search-box input:focus {
    transform: scale(1.02);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.25);
}

.search-box button {
    position: absolute;
    inset-inline-start: 8px;
    inset-block-start: 50%;
    transform: translateY(-50%);
    background: var(--primary, #3b82f6);
    color: var(--white, #ffffff);
    border: none;
    border-radius: var(--radius-full, 50px);
    padding-block: clamp(10px, 2vw, 14px);
    padding-inline: clamp(25px, 5vw, 40px);
    font-size: clamp(1rem, 2vw, 1.1rem);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.3);
}

@media (hover: hover) {
    .search-box button:hover {
        background: var(--primary-dark, #2563eb);
        transform: translateY(-50%) scale(1.05);
        box-shadow: 0 8px 25px rgba(59, 130, 246, 0.4);
    }
}

/* ===== Sections ===== */
.section {
    padding-block: clamp(50px, 8vw, 80px);
    padding-inline: clamp(15px, 4vw, 20px);
    max-width: 1400px;
    margin-inline: auto;
}

.section-header {
    text-align: center;
    margin-block-end: clamp(40px, 6vw, 60px);
}

.section-header h2 {
    font-size: clamp(2rem, 4vw, 2.5rem);
    font-weight: 700;
    color: var(--dark, #0f172a);
    margin-block-end: 15px;
    position: relative;
    display: inline-block;
}

.section-header h2::after {
    content: '';
    position: absolute;
    inset-block-end: -10px;
    inset-inline: 0;
    margin-inline: auto;
    width: 80px;
    height: 4px;
    background: var(--primary, #3b82f6);
    border-radius: 4px;
}

.section-header p {
    font-size: clamp(1rem, 2vw, 1.1rem);
    color: var(--gray, #64748b);
    max-width: 600px;
    margin-inline: auto;
}

/* ===== Ads System ===== */
.ad-ladder { border: 2px solid var(--primary, #3b82f6) !important; box-shadow: 0 0 15px rgba(59, 130, 246, 0.15); }
.ad-clicks { border: 2px solid var(--success, #10b981) !important; box-shadow: 0 0 15px rgba(16, 185, 129, 0.15); }
.ad-vip    { border: 2px solid var(--warning, #f59e0b) !important; box-shadow: 0 0 20px rgba(245, 158, 11, 0.25); }

.ad-badge {
    position: absolute;
    inset-block-start: 15px;
    inset-inline-end: 15px;
    padding: 5px 12px;
    border-radius: var(--radius-full, 50px);
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--white, #ffffff);
    z-index: 10;
    display: flex;
    align-items: center;
    gap: 5px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

.ad-badge.ladder { background: linear-gradient(135deg, var(--primary, #3b82f6), var(--primary-dark, #2563eb)); }
.ad-badge.clicks { background: linear-gradient(135deg, var(--success, #10b981), var(--success-dark, #059669)); }
.ad-badge.vip    { background: linear-gradient(135deg, var(--warning, #f59e0b), var(--warning-dark, #d97706)); }

.ad-banner {
    display: flex;
    align-items: center;
    background: var(--white, #ffffff);
    border-radius: var(--radius-md, 12px);
    padding: clamp(15px, 3vw, 20px);
    margin-inline: auto;
    margin-block-end: 40px;
    max-width: 1400px;
    text-decoration: none;
    color: inherit;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.ad-banner img {
    width: clamp(100px, 20vw, 140px);
    aspect-ratio: 1;
    border-radius: var(--radius-sm, 8px);
    object-fit: cover;
    margin-inline-end: clamp(15px, 3vw, 20px);
    border: 1px solid var(--border, #e2e8f0);
    flex-shrink: 0;
}

.ad-banner-content { flex: 1; min-width: 0; }

.ad-banner-title {
    font-size: clamp(1.15rem, 3vw, 1.35rem);
    font-weight: 700;
    margin-block-end: 8px;
    color: var(--dark, #0f172a);
}

.ad-banner-desc {
    font-size: clamp(0.9rem, 2vw, 1rem);
    color: var(--gray, #64748b);
    margin-block-end: 15px;
    line-height: 1.5;
}

.ad-banner-meta {
    display: flex;
    gap: 15px;
    font-size: 0.95rem;
    color: var(--dark, #0f172a);
    font-weight: 500;
    flex-wrap: wrap;
}

.ad-label {
    position: absolute;
    inset-block-start: 0;
    inset-inline-start: 0;
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    color: var(--white, #ffffff);
    padding: 6px 15px;
    border-end-end-radius: var(--radius-md, 12px);
    font-size: 0.85rem;
    font-weight: bold;
    z-index: 2;
}

@media (hover: hover) {
    .ad-banner:hover {
        transform: translateY(-5px);
        box-shadow: var(--shadow-md);
    }
}

/* ===== Grid ===== */
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr));
    gap: clamp(20px, 4vw, 30px);
    margin-inline: auto;
}

/* ===== Cards ===== */
.card {
    background: var(--white, #ffffff);
    border-radius: var(--radius-md, 12px);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
    border: 1px solid var(--border-light, rgba(0,0,0,0.02));
    position: relative;
}

.card-img-wrapper {
    height: 220px;
    overflow: hidden;
    background: var(--light-gray, #f1f5f9);
    position: relative;
}

.card-img-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.card-badge {
    position: absolute;
    inset-block-start: 15px;
    inset-inline-end: 15px;
    background: var(--danger, #ef4444);
    color: var(--white, #ffffff);
    padding: 6px 15px;
    border-radius: var(--radius-full, 50px);
    font-size: 0.8rem;
    font-weight: 600;
    z-index: 10;
    box-shadow: 0 4px 10px rgba(239, 68, 68, 0.3);
    animation: pulse 2s infinite;
}

.card-content {
    padding: 20px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.card-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-block-end: 8px;
    color: var(--dark, #0f172a);
    line-height: 1.4;
    /* جلوگیری از سرریز متن طولانی */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.card-subtitle {
    font-size: 0.9rem;
    color: var(--gray, #64748b);
    margin-block-end: 12px;
    display: flex;
    align-items: center;
    gap: 5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.card-description {
    font-size: 0.9rem;
    color: var(--gray, #64748b);
    margin-block-end: 15px;
    line-height: 1.6;
    flex: 1;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.card-price {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--danger, #ef4444);
    margin-block-start: 10px;
}

.card-price del {
    color: var(--gray, #64748b);
    font-weight: normal;
    font-size: 1rem;
    margin-inline-end: 8px;
}

.card-footer {
    padding: 15px 20px;
    border-block-start: 1px solid var(--border, #e2e8f0);
    background: var(--bg-color, #fafafa);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.store-badge,
.mall-badge {
    padding: 4px 12px;
    border-radius: var(--radius-full, 50px);
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
}

.store-badge { background: var(--success-light, #e6f7e6); color: var(--success, #10b981); }
.mall-badge  { background: var(--warning-light, #fff3e0); color: var(--warning, #f59e0b); }

.visit-btn {
    color: var(--primary, #3b82f6);
    font-weight: 600;
    font-size: 0.9rem;
    transition: transform 0.3s ease;
    white-space: nowrap;
}

@media (hover: hover) {
    .card:hover {
        transform: translateY(-8px);
        box-shadow: var(--shadow-lg);
    }

    .card:hover .card-img-wrapper img {
        transform: scale(1.1);
    }

    [dir="ltr"] .card:hover .visit-btn { transform: translateX(5px); }
    [dir="rtl"] .card:hover .visit-btn { transform: translateX(-5px); }
}

/* ===== Buttons ===== */
.btn-more {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-block-start: clamp(30px, 5vw, 50px);
    margin-inline: auto;
    padding-block: clamp(12px, 3vw, 16px);
    padding-inline: clamp(30px, 6vw, 50px);
    background: var(--primary, #3b82f6);
    color: var(--white, #ffffff);
    border-radius: var(--radius-full, 50px);
    text-decoration: none;
    font-weight: 600;
    font-size: clamp(1rem, 2vw, 1.1rem);
    transition: all 0.3s ease;
    box-shadow: var(--shadow-sm);
}

.btn-more i {
    margin-inline-end: 8px;
    transition: transform 0.3s ease;
}

@media (hover: hover) {
    .btn-more:hover {
        background: var(--primary-dark, #2563eb);
        transform: translateY(-3px);
        box-shadow: var(--shadow-md);
    }

    [dir="ltr"] .btn-more:hover i { transform: translateX(5px); }
    [dir="rtl"] .btn-more:hover i { transform: translateX(-5px); }
}

/* ===== Stats Section ===== */
.stats-section {
    background: linear-gradient(135deg, var(--primary, #3b82f6), var(--primary-dark, #2563eb));
    color: var(--white, #ffffff);
    padding-block: clamp(40px, 8vw, 60px);
    padding-inline: clamp(15px, 4vw, 20px);
    border-radius: var(--radius-lg, 16px);
    margin-block: clamp(30px, 6vw, 40px);
    margin-inline: auto;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr));
    gap: clamp(20px, 4vw, 30px);
    text-align: center;
    max-width: 1000px;
    margin-inline: auto;
}

.stat-item { padding: 20px; }

.stat-number {
    font-size: clamp(2.2rem, 5vw, 3rem);
    font-weight: 800;
    margin-block-end: 10px;
    line-height: 1;
}

.stat-label {
    font-size: 1.1rem;
    opacity: 0.9;
}

/* ===== CTA Section ===== */
.cta-section {
    text-align: center;
    padding-block: clamp(50px, 8vw, 80px);
    padding-inline: clamp(15px, 4vw, 20px);
    background: var(--white, #ffffff);
    border-radius: var(--radius-lg, 16px);
    margin-block: clamp(30px, 6vw, 40px);
    margin-inline: auto;
}

.cta-section h2 {
    font-size: clamp(1.8rem, 4vw, 2.2rem);
    margin-block-end: 20px;
    color: var(--dark, #0f172a);
}

.cta-section p {
    color: var(--gray, #64748b);
    max-width: 600px;
    margin-inline: auto;
    margin-block-end: 30px;
    font-size: clamp(1rem, 2.5vw, 1.1rem);
}

.cta-button {
    display: inline-block;
    padding-block: clamp(14px, 3vw, 18px);
    padding-inline: clamp(40px, 6vw, 60px);
    background: var(--success, #10b981);
    color: #ffffff !important; /* ثابت کردن رنگ سفید */
    border-radius: var(--radius-full, 50px);
    text-decoration: none;
    font-weight: 600;
    font-size: clamp(1rem, 2vw, 1.2rem);
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3);
}

/* جلوگیری از تغییر رنگ لینک‌های ویزیت شده */
.cta-button:visited, 
.cta-button:active {
    color: #ffffff !important;
}

@media (hover: hover) {
    .cta-button:hover {
        background: var(--success-dark, #059669);
        color: #ffffff !important; /* حفظ رنگ سفید در حالت هاور */
        transform: translateY(-3px);
        box-shadow: 0 8px 25px rgba(16, 185, 129, 0.4);
    }
}


/* ===== Empty State ===== */
.empty-state {
    text-align: center;
    padding-block: clamp(50px, 8vw, 80px);
    padding-inline: 20px;
    color: var(--gray, #64748b);
    background: var(--white, #ffffff);
    border-radius: var(--radius-md, 12px);
    grid-column: 1 / -1;
}

.empty-state img {
    width: clamp(80px, 15vw, 120px);
    opacity: 0.5;
    margin-block-end: 20px;
}

/* ===== Animations ===== */
@keyframes rotateBg {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

@keyframes fadeInDown {
    from { opacity: 0; transform: translateY(-30px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(30px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ============================================================
   Responsive — Mobile First Approach
   768px  : تبلت / موبایل بزرگ
   576px  : موبایل متوسط
   360px  : موبایل خیلی کوچک
   ============================================================ */

@media (max-width: 768px) {

    /* --- Grid: دو ستونه --- */
    .grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    /* --- Card image کوتاه‌تر --- */
    .card-img-wrapper {
        height: 160px;
    }

    /* --- محتوای کارت فشرده‌تر --- */
    .card-content {
        padding: 10px 12px;
    }

    .card-title {
        font-size: 0.82rem;
        -webkit-line-clamp: 2;
    }

    .card-subtitle {
        font-size: 0.75rem;
        margin-block-end: 6px;
    }

    .card-description {
        font-size: 0.75rem;
        -webkit-line-clamp: 2;
        margin-block-end: 8px;
    }

    .card-price {
        font-size: 0.9rem;
        margin-block-start: 6px;
    }

    .card-price del {
        font-size: 0.75rem;
    }

    /* --- Footer کارت --- */
    .card-footer {
        padding: 8px 12px;
        gap: 6px;
    }

    .store-badge,
    .mall-badge {
        font-size: 0.65rem;
        padding: 3px 8px;
    }

    .visit-btn {
        font-size: 0.75rem;
    }

    /* --- Section header کوچکتر --- */
    .section-header {
        margin-block-end: clamp(24px, 4vw, 40px);
    }
}

@media (max-width: 576px) {

    /* --- آگهی بنری: ستونی --- */
    .ad-banner {
        flex-direction: column;
        text-align: center;
        padding: 16px;
    }

    .ad-banner img {
        width: 100%;
        aspect-ratio: 16 / 7;
        height: auto;
        margin-inline-end: 0;
        margin-block-end: 14px;
    }

    .ad-banner-meta {
        justify-content: center;
    }

    .ad-banner-title {
        font-size: 1rem;
    }

    .ad-banner-desc {
        font-size: 0.85rem;
    }
}

/* --- موبایل خیلی کوچک: یک ستونه --- */
@media (max-width: 360px) {

    .grid {
        grid-template-columns: 1fr;
    }

    .card-img-wrapper {
        height: 200px;
    }

    .card-title {
        font-size: 0.9rem;
    }

    .card-price {
        font-size: 1rem;
    }
}
/* =========================================
   دارک‌مود (Dark Mode)
   ========================================= */

/* --- Search Box --- */
[data-theme="dark"] .search-box input {
    background: #242526;
    color: #e4e6eb;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

[data-theme="dark"] .search-box input::placeholder {
    color: #94a3b8;
}

[data-theme="dark"] .search-box input:focus {
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
}

/* --- Section Header --- */
[data-theme="dark"] .section-header h2 {
    color: #e4e6eb;
}

[data-theme="dark"] .section-header p {
    color: #94a3b8;
}

/* --- Ad Banner --- */
[data-theme="dark"] .ad-banner {
    background: #242526;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .ad-banner img {
    border-color: #3a3b3c;
}

[data-theme="dark"] .ad-banner-title {
    color: #e4e6eb;
}

[data-theme="dark"] .ad-banner-desc,
[data-theme="dark"] .ad-banner-meta {
    color: #94a3b8;
}

[data-theme="dark"] .ad-label {
    background: rgba(0, 0, 0, 0.7);
}

/* --- Cards --- */
[data-theme="dark"] .card {
    background: #242526;
    border-color: #3a3b3c;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

[data-theme="dark"] .card-img-wrapper {
    background: #18191a;
}

[data-theme="dark"] .card-title {
    color: #e4e6eb;
}

[data-theme="dark"] .card-subtitle,
[data-theme="dark"] .card-description {
    color: #94a3b8;
}

[data-theme="dark"] .card-price del {
    color: #64748b;
}

[data-theme="dark"] .card-footer {
    background: #1f2022;
    border-block-start-color: #3a3b3c;
}

/* --- Badges (تنظیم رنگ پس‌زمینه برای خوانایی بهتر در دارک‌مود) --- */
[data-theme="dark"] .store-badge { 
    background: #064e3b; /* سبز خیلی تیره */
    color: #34d399; 
}

[data-theme="dark"] .mall-badge { 
    background: #78350f; /* نارنجی/قهوه‌ای تیره */
    color: #fbbf24; 
}

/* --- CTA Section --- */
[data-theme="dark"] .cta-section {
    background: #242526;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .cta-section h2 {
    color: #e4e6eb;
}

[data-theme="dark"] .cta-section p {
    color: #94a3b8;
}

/* --- Empty State --- */
[data-theme="dark"] .empty-state {
    background: #242526;
    color: #94a3b8;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

[data-theme="dark"] .empty-state img {
    opacity: 0.3; /* تاریک‌تر شدن عکس در حالت شب */
    filter: brightness(0.8);
}
