:root {
    --primary: #00b894;
    --primary-2: #00e6a1;
    --dark: #2d3436;
    --bg: #f6f8fa;
    --border: #e1e1e1;
    --card: #ffffff;
    --muted: #7f8c8d;
    --shadow-sm: 0 6px 18px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 18px 36px rgba(0, 0, 0, 0.08);
    --radius: 12px;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--dark);
    font-family: 'Vazirmatn', system-ui, -apple-system, sans-serif;
    line-height: 1.7;
    direction: rtl;
    text-align: right;
    overflow-x: hidden;
}

a {
    color: inherit;
    text-decoration: none;
}
a:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

img {
    max-width: 100%;
    display: block;
}

.container {
    max-width: 1350px;
    margin: 0 auto;
    padding: 0 20px;
}

.market-container {
    max-width: 1350px;
    margin: 30px auto 40px;
    padding: 0 20px;
}

.btn-buy {
    display: inline-block;
    background: linear-gradient(135deg, var(--primary), var(--primary-2));
    color: #fff;
    padding: 12px 18px;
    border-radius: 10px;
    font-weight: 800;
    text-align: center;
    box-shadow: 0 10px 24px rgba(0, 184, 148, 0.25);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    border: none;
}
.btn-buy:hover {
    transform: translateY(-2px);
    box-shadow: 0 14px 28px rgba(0, 184, 148, 0.3);
}
.btn-ghost {
    display: inline-block;
    color: var(--primary);
    border: 1px solid var(--primary);
    padding: 10px 16px;
    border-radius: 10px;
    font-weight: 700;
    background: #e8fbf5;
    transition: 0.2s ease;
}
.btn-ghost:hover {
    background: #d2f7eb;
}
.btn-ghost.full {
    display: block;
    text-align: center;
}

.header-row {
    display: flex;
    align-items: center;
    gap: 16px;
}

/* Header */
.site-header {
    position: sticky;
    top: 0;
    z-index: 1000;
    backdrop-filter: blur(14px);
    background: rgba(255, 255, 255, 0.92);
    border-bottom: 1px solid var(--border);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.04);
}
.header-topbar {
    border-bottom: 1px solid var(--border);
    padding: 8px 0;
    font-size: 0.9rem;
    color: var(--muted);
}
.auth-links a {
    font-weight: 700;
}
.top-meta {
    display: flex;
    gap: 14px;
}
.top-meta i {
    color: var(--primary);
}
.header-middle {
    padding: 14px 0;
}
.logo-area {
    display: flex;
    align-items: center;
    gap: 12px;
}
.logo {
    font-weight: 900;
    font-size: 1.6rem;
    letter-spacing: -0.3px;
    color: var(--dark);
}
.mobile-toggle {
    display: none;
    background: none;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 8px;
    cursor: pointer;
    flex-direction: column;
    gap: 4px;
}
.mobile-toggle span {
    width: 20px;
    height: 2px;
    background: var(--dark);
    display: block;
}
.search-bar {
    flex: 1;
    position: relative;
}
.search-bar form {
    display: flex;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}
.search-bar input {
    flex: 1;
    padding: 12px 14px;
    border: none;
    outline: none;
    font-size: 0.95rem;
    background: transparent;
}
.search-bar button {
    border: none;
    background: transparent;
    padding: 0 14px;
    color: var(--muted);
    cursor: pointer;
}
.search-suggest {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    display: none;
    overflow: hidden;
    z-index: 20;
}
.suggest-item {
    display: flex;
    gap: 10px;
    padding: 10px;
    align-items: center;
}
.suggest-item:hover {
    background: #f8f9fa;
}
.suggest-item .thumb {
    width: 50px;
    height: 50px;
    border-radius: 8px;
    overflow: hidden;
    background: #f0f0f0;
}
.suggest-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.suggest-item .title {
    font-weight: 700;
}
.suggest-item .price {
    color: var(--primary);
    font-weight: 700;
}
.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}
.header-bottom {
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
}
.main-nav {
    display: flex;
}
.main-nav ul {
    display: flex;
    gap: 16px;
    list-style: none;
    padding: 12px 0;
    margin: 0;
}
.main-nav a {
    padding: 8px 10px;
    border-radius: 8px;
    font-weight: 700;
    color: var(--dark);
}
.main-nav a:hover {
    background: #eef4f8;
    color: var(--primary);
}
.mega-nav {
    position: relative;
}
.mega-nav .mega-panel {
    position: absolute;
    right: 0;
    left: 0;
    top: 100%;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    padding: 18px;
    display: none;
    z-index: 50;
}
.mega-nav:hover .mega-panel {
    display: block;
}
.mega-cols {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
}
.mega-cols h4 {
    margin: 0 0 8px;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 6px;
}
.mega-cols ul {
    list-style: none;
    padding: 0;
    margin: 0;
}
.mega-cols li {
    margin-bottom: 6px;
}
.mega-cols a {
    color: var(--dark);
    font-weight: 600;
}
.mega-cols a:hover {
    color: var(--primary);
}
.mega-cta .mega-cta-inner {
    background: linear-gradient(135deg, var(--primary), var(--primary-2));
    color: #fff;
    border-radius: 12px;
    padding: 16px;
    box-shadow: var(--shadow-sm);
}

.mobile-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    backdrop-filter: blur(2px);
    display: none;
    z-index: 998;
}
.mobile-overlay.show {
    display: block;
}

.lightbox-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}
.lightbox-inner {
    position: relative;
    max-width: 90%;
    max-height: 90%;
}
.lightbox-inner img {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 10px;
}
.lightbox-close {
    position: absolute;
    top: -10px;
    left: -10px;
    background: #fff;
    color: #111;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: var(--shadow-sm);
}

/* Hero */
.home-hero {
    background: #fff;
    border-bottom: 1px solid var(--border);
    padding: 80px 0 60px;
    text-align: center;
}
.home-hero h1 {
    margin: 0 0 10px;
    font-size: 2.4rem;
    font-weight: 900;
}
.home-hero p {
    margin: 0;
    color: var(--muted);
}

/* Filters */
.filter-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    margin: 16px 0 10px;
    flex-wrap: wrap;
}
.filter-left {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}
.filter-bar select {
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: #fff;
}

/* Grid & Cards */
.market-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 25px;
    margin-top: 20px;
    position: relative;
}
.grid-loading::after {
    content: "در حال بارگذاری...";
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,0.75);
    color: var(--dark);
    font-weight: 800;
    z-index: 10;
}
.market-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
    position: relative;
}
.market-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: #ccefe3;
}
.market-card img {
    height: 190px;
    width: 100%;
    object-fit: cover;
}
.card-body {
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.card-title {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 800;
    color: var(--dark);
}
.card-title a {
    color: inherit;
}
.card-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.9rem;
    color: var(--muted);
    background: #f9fafa;
    padding: 8px 10px;
    border-radius: 10px;
}
.card-footer {
    padding: 14px 16px;
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.card-stats {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    font-size: 0.85rem;
    color: var(--muted);
}
.card-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background: #ffbe0b;
    color: #111;
    padding: 6px 10px;
    border-radius: 8px;
    font-weight: 800;
    font-size: 0.8rem;
    box-shadow: var(--shadow-sm);
}
.badge-sale { background: #ff3b30; color: #fff; }
.badge-new { background: #00b894; color: #fff; }
.badge-update { background: #0984e3; color: #fff; }
.badge-hot { background: #e17055; color: #fff; }
.badge-featured { background: #6c5ce7; color: #fff; }

.badge {
    display: inline-block;
    background: #eef4f8;
    color: var(--dark);
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 0.85rem;
}
.price-tag {
    color: var(--primary);
    font-weight: 800;
}
.btn-icon {
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    background: #e0f7f3;
    color: var(--primary);
    transition: 0.2s ease;
}
.btn-icon:hover {
    background: var(--primary);
    color: #fff;
}
.skeleton {
    background: linear-gradient(90deg, #f3f4f6, #e9ebef, #f3f4f6);
    background-size: 200% 100%;
    animation: shimmer 1.4s ease infinite;
}
@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Single layout */
.product-hero {
    position: relative;
    overflow: hidden;
    padding: 60px 0;
    margin-bottom: 20px;
    color: #fff;
    background-size: cover;
    background-position: center;
}
.product-hero .hero-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(120deg, rgba(0,0,0,0.65), rgba(0,0,0,0.35));
    backdrop-filter: blur(6px);
}
.product-hero .hero-content {
    position: relative;
    display: grid;
    grid-template-columns: 1.1fr 0.9fr;
    align-items: center;
    gap: 30px;
}
.product-hero .hero-text h1 {
    margin: 0 0 10px;
    font-size: 2.2rem;
    font-weight: 900;
}
.hero-meta {
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
    color: #eaeaea;
    font-size: 0.95rem;
}
.hero-actions {
    display: flex;
    gap: 12px;
    margin: 12px 0;
}
.hero-rating {
    color: #ffd166;
    font-weight: 700;
}
.hero-thumb .hero-shot {
    border: 4px solid rgba(255,255,255,0.12);
    box-shadow: 0 18px 36px rgba(0,0,0,0.35);
}
.hero-badge {
    display: inline-block;
    padding: 6px 12px;
    border-radius: 10px;
    background: #ffbe0b;
    color: #111;
    font-weight: 800;
    margin-bottom: 10px;
}

.product-layout {
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 24px;
    align-items: start;
}
.sticky-sidebar {
    position: sticky;
    top: 90px;
}
.purchase-box {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 18px;
    box-shadow: var(--shadow-sm);
}
.price-main {
    font-size: 1.8rem;
    font-weight: 900;
    color: var(--primary);
    text-align: center;
    margin-bottom: 12px;
}
.price-main del {
    color: var(--muted);
}
.meta-list {
    list-style: none;
    padding: 0;
    margin: 14px 0 0;
    font-size: 0.95rem;
    color: #555;
}
.meta-list li {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
}
.product-main {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 20px;
    box-shadow: var(--shadow-sm);
}
.breadcrumbs {
    color: var(--muted);
    font-size: 0.9rem;
}
.product-title {
    margin: 6px 0 14px;
    font-size: 1.9rem;
    font-weight: 900;
}
.stats-row {
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
    color: var(--muted);
    margin-bottom: 10px;
}
.hero-shot {
    width: 100%;
    border-radius: 12px;
    object-fit: cover;
    margin-bottom: 16px;
    box-shadow: var(--shadow-sm);
}
.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 10px;
    margin: 14px 0 18px;
}
.feature-item {
    background: #f9fafa;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 10px 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.95rem;
}
.feature-item strong {
    color: var(--dark);
}
.tabs {
    margin-top: 16px;
}
.tab-buttons {
    display: flex;
    gap: 10px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}
.tab-buttons button {
    padding: 10px 12px;
    border: 1px solid var(--border);
    background: #fff;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 700;
}
.tab-buttons button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}
.tab-buttons button.active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}
.tab-panel {
    display: none;
}
.tab-panel.active {
    display: block;
}
.content-text {
    line-height: 1.9;
    color: #444;
}
.changelog-box {
    background: #f7f8fa;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 14px;
}
.changelog-box pre,
.prev-versions pre {
    white-space: pre-wrap;
    margin: 0;
    font-family: inherit;
    line-height: 1.7;
}
.related-block {
    margin-top: 20px;
}
.related-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 12px;
}
.related-card {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 10px;
    box-shadow: var(--shadow-sm);
    position: relative;
}
.related-thumb {
    width: 100%;
    height: 130px;
    object-fit: cover;
    border-radius: 8px;
}
.related-title {
    font-weight: 700;
    margin: 8px 0 4px;
}
.related-meta {
    font-size: 0.85rem;
    color: var(--muted);
}
.info-strip {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    background: #f4f7f9;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 10px 12px;
    margin: 10px 0 14px;
    color: var(--muted);
    font-size: 0.95rem;
}
.info-strip span {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.faq-block details {
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 10px 12px;
    background: #fff;
    margin-bottom: 8px;
}
.faq-block summary {
    cursor: pointer;
    font-weight: 800;
}

/* Sticky CTA mobile */
.sticky-cta-mobile {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #fff;
    border-top: 1px solid var(--border);
    box-shadow: 0 -8px 20px rgba(0,0,0,0.08);
    padding: 12px 16px;
    display: none;
    align-items: center;
    justify-content: space-between;
    z-index: 100;
}
.sticky-cta-mobile .cta-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

/* Footer */
.site-footer {
    background: #2d3436;
    color: #fff;
    margin-top: 60px;
}
.footer-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    padding: 40px 0;
}
.site-footer h4 {
    margin: 0 0 10px;
}
.site-footer p {
    margin: 0;
    color: #dfe6e9;
}
.site-footer ul {
    list-style: none;
    padding: 0;
    margin: 0;
}
.site-footer li {
    margin-bottom: 8px;
}
.site-footer a {
    color: #dfe6e9;
}
.trust-row {
    display: flex;
    gap: 8px;
    margin-top: 10px;
}
.trust-row span {
    background: #f5f5f5;
    color: #2d3436;
    padding: 8px 10px;
    border-radius: 8px;
    font-weight: 700;
}
.newsletter-form {
    display: flex;
    gap: 8px;
    margin: 10px 0 14px;
}
.newsletter-form input {
    flex: 1;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 10px;
    font-family: inherit;
}
.newsletter-form button {
    border: none;
    background: var(--primary);
    color: #fff;
    padding: 10px 14px;
    border-radius: 10px;
    font-weight: 700;
    cursor: pointer;
}
.footer-bottom {
    text-align: center;
    padding: 14px 0;
    border-top: 1px solid rgba(255,255,255,0.08);
    color: #dfe6e9;
}

/* Responsive */
@media (max-width: 1024px) {
    .product-layout {
        grid-template-columns: 1fr;
    }
    .sticky-sidebar {
        position: static;
        order: -1;
    }
    .product-hero .hero-content {
        grid-template-columns: 1fr;
        text-align: center;
    }
}
@media (max-width: 900px) {
    .header-row {
        flex-wrap: wrap;
    }
    .main-nav {
        display: none;
        width: 100%;
        position: fixed;
        top: 70px;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(255,255,255,0.98);
        padding: 20px;
        overflow-y: auto;
        z-index: 999;
    }
    .main-nav ul {
        flex-direction: column;
        gap: 10px;
        padding: 12px;
    }
    .main-nav.active {
        display: block;
    }
    .mega-nav .mega-panel {
        position: static;
        display: block;
        border: none;
        box-shadow: none;
        padding: 12px 0 0;
    }
    .mobile-toggle {
        display: inline-flex;
    }
    .market-grid {
        grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    }
    .sticky-cta-mobile {
        display: flex;
    }
}
@media (max-width: 600px) {
    .search-bar form {
        flex-direction: row;
    }
    .card-meta {
        flex-direction: column;
        gap: 6px;
        align-items: flex-start;
    }
    .product-title {
        font-size: 1.4rem;
    }
    .filter-left {
        flex-direction: column;
        align-items: flex-start;
    }
}

/* FORCE GRID LAYOUT */
.market-grid {
    display: grid !important;
    grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)) !important;
    gap: 25px !important;
    max-width: 1400px !important;
    margin: 40px auto !important;
    padding: 0 20px !important;
}
.market-card {
    background: #fff;
    border: 1px solid #e1e1e1;
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    display: flex;
    flex-direction: column;
    height: 100%;
    position: relative;
}
.market-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 24px rgba(0,0,0,0.08);
    border-color: #00b894;
}
.market-card img {
    width: 100% !important;
    height: 180px !important;
    object-fit: cover !important;
    border-bottom: 1px solid #f0f0f0;
}
.card-body {
    padding: 18px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.card-title {
    font-size: 1rem;
    font-weight: 700;
    color: #2d3436;
    margin: 0;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.card-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.8rem;
    color: #888;
    background: #f8f9fa;
    padding: 6px 10px;
    border-radius: 6px;
}
.card-footer {
    padding: 15px 18px;
    border-top: 1px solid #f0f0f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #fff;
}
.price-tag {
    font-family: 'Vazirmatn', sans-serif;
    font-weight: 800;
    font-size: 1.1rem;
    color: #00b894;
}
.btn-icon {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: #e0f7f3;
    color: #00b894;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: 0.2s;
}
.btn-icon:hover {
    background: #00b894;
    color: #fff;
}
.card-media {
    position: relative;
    display: block;
    overflow: hidden;
}
.card-media img {
    transition: transform 0.35s ease;
}
.market-card:hover .card-media img {
    transform: scale(1.04);
}
