/* ================================
   سبداک — CSS اصلی
   ================================ */

/* ---------- پایه ---------- */
* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    font-family: sans-serif;
    direction: rtl;
    background-color: #F9FAFB;
    color: #111111;
}

section[id] {
    scroll-margin-top: 140px;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

a:focus-visible,
button:focus-visible {
    outline: 3px solid #2563EB;
    outline-offset: 2px;
    border-radius: 4px;
}

.header-nav a:focus-visible {
    outline-color: #B8F500;
}

.skip-link {
    position: absolute;
    top: -100px;
    right: 20px;
    background-color: #2563EB;
    color: white;
    padding: 12px 20px;
    border-radius: 10px;
    text-decoration: none;
    font-weight: 600;
    z-index: 1000;
    transition: top 0.2s;
}

.skip-link:focus {
    top: 20px;
    outline: 3px solid #B8F500;
    outline-offset: 2px;
}


/* ================================
   هدر
   ================================ */
header {
    position: sticky;
    top: 0;
    z-index: 100;
    background-color: #FAFAF9;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.top-bar {
    background-color: #B8F500;
    color: #111111;
    text-align: center;
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 500;
}

.header-main {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 32px;
    padding: 16px 40px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    white-space: nowrap;
}

.logo-icon {
    flex-shrink: 0;
    transition: transform 0.3s ease;
}

.logo:hover .logo-icon {
    transform: rotate(-8deg) scale(1.05);
}

.logo-text-group {
    display: flex;
    flex-direction: column;
}

.logo-text {
    color: #111111;
    font-weight: 800;
    font-size: 24px;
    line-height: 1.2;
}

.logo-tagline {
    color: #6B7280;
    font-size: 12px;
    font-weight: 500;
    margin-top: 2px;
}

.search-box {
    flex: 1;
    max-width: 560px;
    display: flex;
    align-items: center;
    background-color: #F3F4F6;
    border: 1px solid #E5E7EB;
    border-radius: 12px;
    padding: 0 14px;
    transition: border-color 0.2s, background-color 0.2s;
}

.search-box:focus-within {
    background-color: white;
    border-color: #2563EB;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.search-icon {
    font-size: 16px;
    color: #6B7280;
    margin-left: 8px;
}

.search-box input {
    flex: 1;
    border: none;
    outline: none;
    background: transparent;
    padding: 12px 8px;
    font-family: inherit;
    font-size: 14px;
    color: #111111;
}

.search-box input::placeholder {
    color: #9CA3AF;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 20px;
}

.login-link {
    text-decoration: none;
    color: #111111;
    font-weight: 500;
    font-size: 14px;
    white-space: nowrap;
    transition: color 0.2s;
}

.login-link:hover {
    color: #2563EB;
}

.cart-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    background-color: #2563EB;
    color: white;
    border: none;
    padding: 10px 18px;
    border-radius: 12px;
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: background-color 0.2s, transform 0.15s;
}

.cart-btn:hover {
    background-color: #7C3AED;
}

.cart-btn:active {
    transform: scale(0.97);
}

.header-nav {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 40px;
    background-color: #111111;
    overflow-x: auto;
}

.header-nav a {
    text-decoration: none;
    color: #E5E7EB;
    font-size: 14px;
    font-weight: 500;
    padding: 14px 16px;
    white-space: nowrap;
    transition: color 0.2s, background-color 0.2s;
}

.header-nav a:hover {
    color: #B8F500;
}

.header-nav .all-categories {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #B8F500;
    font-weight: 700;
    position: relative;
}

.all-categories::after {
    content: "";
    position: absolute;
    bottom: 8px;
    right: 50%;
    width: 0;
    height: 2px;
    background-color: #B8F500;
    transition: width 0.3s ease, right 0.3s ease;
}

.all-categories:hover::after {
    width: calc(100% - 32px);
    right: 16px;
}

.nav-toggle {
    display: none;
}

.nav-toggle-label {
    display: none;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 8px;
}


/* ================================
   Hero
   ================================ */
.hero {
    background: linear-gradient(135deg, #2563EB 0%, #7C3AED 100%);
    color: white;
    padding: 80px 40px;
    text-align: center;
}

.hero-content {
    max-width: 700px;
    margin: 0 auto;
}

.hero h1 {
    font-size: 48px;
    font-weight: 800;
    margin: 0 0 16px 0;
    line-height: 1.2;
}

.hero p {
    font-size: 18px;
    margin: 0 0 32px 0;
    opacity: 0.9;
}

.hero-btn {
    display: inline-block;
    background-color: #B8F500;
    color: #111111;
    text-decoration: none;
    font-weight: 700;
    font-size: 16px;
    padding: 16px 32px;
    border-radius: 12px;
    transition: background-color 0.2s, transform 0.15s;
}

.hero-btn:hover {
    background-color: #A3DC00;
    transform: translateY(-2px);
}

.hero-btn:active {
    transform: translateY(0);
}


/* ================================
   Categories
   ================================ */
.categories {
    padding: 60px 40px;
    max-width: 1280px;
    margin: 0 auto;
}

.categories h2 {
    font-size: 28px;
    font-weight: 700;
    margin: 0 0 32px 0;
    color: #111111;
}

.categories-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 20px;
}

.category-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    background-color: white;
    border: 1px solid #E5E7EB;
    border-radius: 16px;
    padding: 24px 16px;
    text-decoration: none;
    transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s;
}

.category-card:hover {
    transform: translateY(-4px);
    border-color: #2563EB;
    box-shadow: 0 8px 20px rgba(37, 99, 235, 0.08);
}

.category-icon {
    font-size: 40px;
    line-height: 1;
}

.category-name {
    font-size: 14px;
    font-weight: 600;
    color: #111111;
    text-align: center;
}


/* ================================
   دسته‌بندی‌های محبوب
   ================================ */
.popular {
    padding: 60px 40px;
    max-width: 1280px;
    margin: 0 auto;
}

.popular h2 {
    font-size: 28px;
    font-weight: 700;
    margin: 0 0 32px 0;
    color: #111111;
}

.popular-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
}

.popular-card {
    display: flex;
    align-items: center;
    gap: 20px;
    background: linear-gradient(135deg, #EFF6FF 0%, #F5F3FF 100%);
    border: 1px solid #DBEAFE;
    border-radius: 20px;
    padding: 28px 24px;
    text-decoration: none;
    transition: transform 0.25s, box-shadow 0.25s, border-color 0.25s;
}

.popular-card:hover {
    transform: translateY(-6px);
    border-color: #2563EB;
    box-shadow: 0 12px 28px rgba(37, 99, 235, 0.12);
}

.popular-icon {
    font-size: 56px;
    line-height: 1;
    flex-shrink: 0;
}

.popular-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.popular-name {
    font-size: 20px;
    font-weight: 700;
    color: #111111;
}

.popular-count {
    font-size: 13px;
    font-weight: 500;
    color: #6B7280;
}


/* ================================
   بخش محصولات
   ================================ */
.products-section {
    padding: 60px 40px;
    max-width: 1280px;
    margin: 0 auto;
}

.products-section h2 {
    font-size: 28px;
    font-weight: 700;
    margin: 0 0 32px 0;
    color: #111111;
}

.products {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
}


/* ================================
   کارت محصول
   ================================ */
.product-card {
    display: flex;
    flex-direction: column;
    background-color: white;
    border: 1px solid #E5E7EB;
    border-radius: 16px;
    overflow: hidden;
    transition: transform 0.25s, box-shadow 0.25s, border-color 0.25s;
}

.product-card:hover,
.product-card:focus-within {
    transform: translateY(-6px);
    border-color: #2563EB;
    box-shadow: 0 12px 28px rgba(37, 99, 235, 0.1);
}

.product-image {
    position: relative;
    background-color: #F9FAFB;
    aspect-ratio: 1 / 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    overflow: hidden;
}

.product-image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 12px;
    transition: transform 0.4s ease;
}

.product-card:hover .product-image img,
.product-card:focus-within .product-image img {
    transform: scale(1.1);
}

.discount-badge {
    position: absolute;
    top: 12px;
    right: 12px;
    background-color: #FF6B35;
    color: white;
    font-size: 13px;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 20px;
    z-index: 1;
}

.product-name {
    font-size: 15px;
    font-weight: 700;
    color: #111111;
    margin: 16px 16px 6px 16px;
}

.product-weight {
    font-size: 13px;
    color: #6B7280;
    margin: 0 16px 4px 16px;
}

.product-desc {
    font-size: 12px;
    color: #9CA3AF;
    margin: 0 16px 16px 16px;
}

.product-footer {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 12px;
    padding: 0 16px 16px 16px;
    margin-top: auto;
}

.product-price {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.old-price {
    font-size: 12px;
    color: #9CA3AF;
    text-decoration: line-through;
}

.current-price {
    font-size: 16px;
    font-weight: 800;
    color: #111111;
}

.add-btn {
    background-color: #2563EB;
    color: white;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 12px;
    font-size: 24px;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background-color 0.2s, transform 0.15s;
}

.add-btn:hover {
    background-color: #7C3AED;
}

.add-btn:active {
    transform: scale(0.9);
}


/* ================================
   بخش تخفیف‌ها
   ================================ */
.discount-section {
    position: relative;
}

.discount-section::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, #FFF7ED 0%, #FFEDD5 100%);
    border-radius: 24px;
    z-index: -1;
}


/* ================================
   کاروسل (Scroll Snap)
   ================================ */
.carousel {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    gap: 20px;
    padding: 8px 4px 20px 4px;
    scrollbar-width: thin;
    scrollbar-color: #2563EB #F3F4F6;
}

.carousel::-webkit-scrollbar {
    height: 8px;
}

.carousel::-webkit-scrollbar-track {
    background: #F3F4F6;
    border-radius: 10px;
}

.carousel::-webkit-scrollbar-thumb {
    background: #2563EB;
    border-radius: 10px;
}

.carousel::-webkit-scrollbar-thumb:hover {
    background: #7C3AED;
}

.carousel .product-card {
    flex: 0 0 280px;
    scroll-snap-align: start;
}

.carousel:focus-visible {
    outline: 3px solid #2563EB;
    outline-offset: 4px;
    border-radius: 8px;
}


/* ================================
   Footer
   ================================ */
.footer {
    background-color: #111111;
    color: #E5E7EB;
    margin-top: 80px;
}

.footer-main {
    max-width: 1280px;
    margin: 0 auto;
    padding: 60px 40px;
    display: grid;
    grid-template-columns: 1.5fr 1fr 1fr 1.5fr;
    gap: 40px;
}

.footer-logo {
    display: inline-block;
    color: #FFFFFF;
    font-size: 26px;
    font-weight: 800;
    text-decoration: none;
    margin-bottom: 12px;
    transition: color 0.2s;
}

.footer-logo:hover {
    color: #B8F500;
}

.footer-tagline {
    color: #9CA3AF;
    font-size: 14px;
    margin: 0;
    line-height: 1.6;
}

.footer-title {
    color: #FFFFFF;
    font-size: 16px;
    font-weight: 700;
    margin: 0 0 20px 0;
}

.footer-links {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.footer-links a {
    color: #9CA3AF;
    text-decoration: none;
    font-size: 14px;
    transition: color 0.2s, transform 0.2s;
    display: inline-block;
}

.footer-links a:hover {
    color: #B8F500;
    transform: translateX(-4px);
}

.footer-contact {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.footer-contact li {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: 14px;
    color: #9CA3AF;
    line-height: 1.6;
}

.footer-contact li span:first-child {
    flex-shrink: 0;
    font-size: 16px;
}

.footer-bottom {
    border-top: 1px solid #1F2937;
    max-width: 1280px;
    margin: 0 auto;
    padding: 24px 40px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    flex-wrap: wrap;
}

.footer-copy {
    margin: 0;
    font-size: 13px;
    color: #6B7280;
}

.back-to-top {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #B8F500;
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
    padding: 8px 16px;
    border: 1px solid #B8F500;
    border-radius: 10px;
    transition: background-color 0.2s, color 0.2s, transform 0.15s;
}

.back-to-top:hover {
    background-color: #B8F500;
    color: #111111;
}

.back-to-top:active {
    transform: scale(0.97);
}


/* ================================
   Reduce Motion
   ================================ */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}


/* ================================
   Responsive — تبلت (تا 1024px)
   ================================ */
@media (max-width: 1024px) {

    .header-main {
        padding: 14px 24px;
        gap: 20px;
    }

    .logo-text {
        font-size: 20px;
    }

    .search-box {
        max-width: 400px;
    }

    .header-nav {
        padding: 0 24px;
    }

    .hero {
        padding: 60px 24px;
    }

    .hero h1 {
        font-size: 36px;
    }

    .hero p {
        font-size: 16px;
    }

    .categories,
    .popular,
    .products-section {
        padding: 50px 24px;
    }

    .categories-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 16px;
    }

    .popular-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
    }

    .products {
        grid-template-columns: repeat(3, 1fr);
        gap: 16px;
    }

    .carousel .product-card {
        flex: 0 0 240px;
    }

    .footer-main {
        grid-template-columns: 1fr 1fr;
        gap: 32px;
        padding: 50px 24px;
    }

    .footer-bottom {
        padding: 20px 24px;
    }
}


/* ================================
   Responsive — موبایل (تا 640px)
   ================================ */
@media (max-width: 640px) {

    .top-bar {
        font-size: 12px;
        padding: 6px 12px;
    }

    .header-main {
        padding: 12px 16px;
        gap: 10px;
        flex-wrap: wrap;
    }

    .logo-text {
        font-size: 18px;
    }

    .logo-tagline {
        display: none;
    }

    .logo-icon {
        width: 32px;
        height: 32px;
    }

    .search-box {
        order: 3;
        flex-basis: 100%;
        max-width: 100%;
    }

    .login-link {
        font-size: 13px;
    }

    .cart-btn {
        padding: 8px 10px;
        font-size: 13px;
    }

    .cart-btn span:not(:first-child) {
        display: none;
    }

    .header-nav {
        padding: 0;
        flex-wrap: wrap;
    }

    .nav-toggle-label {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 44px;
        height: 44px;
        font-size: 22px;
        color: #B8F500;
        cursor: pointer;
        padding: 0 16px;
        flex-shrink: 0;
    }

    .nav-links {
        display: none;
        flex-direction: column;
        align-items: stretch;
        gap: 0;
        width: 100%;
    }

    .nav-toggle:checked ~ .nav-links {
        display: flex;
    }

    .nav-links a {
        padding: 14px 20px;
        border-bottom: 1px solid #1F2937;
        font-size: 14px;
    }

    .nav-links a:last-child {
        border-bottom: none;
    }

    .all-categories::after {
        display: none;
    }

    .hero {
        padding: 48px 20px;
    }

    .hero h1 {
        font-size: 28px;
    }

    .hero p {
        font-size: 15px;
        margin-bottom: 24px;
    }

    .hero-btn {
        padding: 14px 24px;
        font-size: 15px;
    }

    .categories,
    .popular,
    .products-section {
        padding: 40px 16px;
    }

    .categories h2,
    .popular h2,
    .products-section h2 {
        font-size: 22px;
        margin-bottom: 24px;
    }

    .categories-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    .category-card {
        padding: 18px 12px;
        gap: 8px;
    }

    .category-icon {
        font-size: 32px;
    }

    .category-name {
        font-size: 13px;
    }

    .popular-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .popular-card {
        padding: 20px 18px;
        gap: 16px;
    }

    .popular-icon {
        font-size: 44px;
    }

    .popular-name {
        font-size: 17px;
    }

    .products {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    .carousel .product-card {
        flex: 0 0 220px;
    }

    .product-image {
        padding: 12px;
    }

    .product-image img {
        border-radius: 8px;
    }

    .product-name {
        font-size: 14px;
        margin: 12px 12px 4px 12px;
    }

    .product-weight {
        font-size: 12px;
        margin: 0 12px 4px 12px;
    }

    .product-desc {
        font-size: 11px;
        margin: 0 12px 12px 12px;
    }

    .product-footer {
        padding: 0 12px 12px 12px;
        gap: 8px;
    }

    .current-price {
        font-size: 14px;
    }

    .old-price {
        font-size: 11px;
    }

    .add-btn {
        width: 36px;
        height: 36px;
        font-size: 20px;
        border-radius: 10px;
    }

    .discount-badge {
        font-size: 11px;
        padding: 3px 8px;
        top: 8px;
        right: 8px;
    }

    .footer-main {
        grid-template-columns: 1fr;
        gap: 28px;
        padding: 40px 20px;
    }

    .footer-bottom {
        padding: 20px;
        flex-direction: column;
        align-items: center;
        text-align: center;
        gap: 16px;
    }
}