@font-face {
    font-family: 'BKoodak';
    src: url('fonts/BKodak.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
}

body {
    font-family: 'BKoodak', sans-serif;
}

/* ================== FOOTER ================== */

.footer-compact {
    background: #eaeaec;
    padding: 15px 10px;
    margin-top: auto;
}

.footer-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

.footer-contact {
    display: flex;
    align-items: center;
    gap: 20px;
}

.contact-title {
    font-size: 18px;
    font-weight: bold;
    color: #3f4064;
}

.social-icons {
    display: flex;
    gap: 25px;
}

.social-icons a {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    text-decoration: none;
    transition: 0.3s;
}

.social-icons a:hover {
    transform: translateY(-3px);
    color: #ef394e;
}

.social-icons img {
    width: 35px;
    height: 35px;
    border-radius: 8px;
}

.social-icons span {
    font-size: 13px;
    color: #3f4064;
    font-weight: bold;
}

.footer-address {
    font-size: 16px;
    color: #3f4064;
    font-weight: bold;
}

/* ================== HEADER ================== */

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    width: 100%;
    padding: 10px 30px;
    box-sizing: border-box;
}

/* لوگو */

.logo img {
    height: 60px;
}

/* سمت چپ هدر */

/* ===== HEADER LEFT FIX ===== */

.header-left {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: nowrap;
    min-width: 0;
    flex: 1;              /* اجازه بگیر کل فضای خالی هدر */
    justify-content: flex-end;
}

/* سرچ */
.search-box {
    position: relative;
    flex: 1;              /* فقط فضای باقی‌مانده را بگیرد */
    max-width: 500px;     /* سقف منطقی */
    min-width: 0;
}

/* مهم: هرگز width بیشتر از 100% نداشته باش */
.search-box input[type="text"] {
    width: 100%;
    box-sizing: border-box;
}

/* آیکون حساب هرگز کوچک نشود */
.user-account {
    flex-shrink: 0;
}


.search-box input[type="text"] {
    text-align: center;
    width: 100%;
    padding: 12px 20px;
    font-size: 0.95rem;
    font-weight: 500;
    color: #333;
    background: #ffffff;

    border: 1.5px solid #d0d0d0;
    border-radius: 12px;

    outline: none;
    transition: all 0.25s ease;

    box-shadow: 0 2px 6px rgba(0,0,0,0.08);
}

.search-box input[type="text"]:focus {
    border-color: #ef394e;
    box-shadow: 0 3px 10px rgba(239,57,78,0.25);
}

.search-box input[type="text"]::placeholder {
    color: #777;
}

/* نتایج جستجو */

.search-results {
    position: absolute;
    top: 105%;
    right: 0;
    width: 100%;
    background: #fff;
    border-radius: 12px;
    margin-top: 6px;
    max-height: 260px;
    overflow-y: auto;
    box-shadow: 0 6px 20px rgba(0,0,0,0.15);
    display: none;
    z-index: 1000;
}

.search-results a {
    display: block;
    padding: 12px 20px;
    text-decoration: none;
    color: #333;
    font-size: 14px;
    border-bottom: 1px solid #f1f1f1;
}

.search-results a:last-child {
    border-bottom: none;
}

.search-results a:hover {
    background: #f7f7f7;
    color: #ef394e;
}

/* ================== USER ACCOUNT ================== */

.user-account {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    overflow: hidden;
    border: 1.5px solid #777;
    cursor: pointer;
    flex-shrink: 0;
    transition: border-color 0.3s ease;
}

.user-account:hover {
    border-color: #007BFF;
}

.user-account img.user-icon {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* ================== NAV MENU ================== */

.nav {
    order: 3;
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;

    background: #fcfcfc;

    border-radius: 10px;
    margin-top: 14px;
    padding: 12px 0;

    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.nav {
    margin-top: 16px;
    padding: 14px 0;
    background: #eaeaed;
}

.nav a {
    text-decoration: none;
    color: #333;
    font-size: 1.15rem;   /* بزرگ‌تر شد */
    font-weight: 700;     /* بولد */
    padding: 12px 28px;
    transition: 0.25s;
}

.nav a:hover {
    color: #ef394e;
}


.nav a:hover {
    color: #ef394e;
}

/* ================== SLIDER ================== */

.slider-container {
    position: relative;
    max-width: 1200px;
    margin: 30px auto 10px;
    overflow: hidden;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

.slider {
    display: flex;
    transition: transform 0.5s ease-in-out;
}

.slide {
    min-width: calc(100% / 3);
}

.slide img {
    width: 100%;
    height: 300px;
    object-fit: cover;
}


.prev-btn,
.next-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0,0,0,0.4);
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    font-size: 25px;
    cursor: pointer;
}

.prev-btn:hover,
.next-btn:hover {
    background: rgba(0,0,0,0.7);
}

.prev-btn { left: 15px; }
.next-btn { right: 15px; }

.slider-caption {
    text-align: center;
    font-size: 1.3rem;
    font-weight: 700;
    color: #444;
    margin-bottom: 40px;
}

/* ================== CATEGORIES ================== */

.category-grid {
    max-width: 900px;
    margin: 0 auto 60px;

    display: grid;
    grid-template-columns: repeat(4,1fr);
    grid-template-rows: repeat(2,150px);

    gap: 20px;

    border-radius: 15px;
    padding: 20px 25px;

    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
    background: #fff;

    direction: rtl;
}

.category-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;

    border: 2px solid #aaa;
    border-radius: 12px;

    text-decoration: none;
    color: #222;

    font-weight: 700;
    font-size: 1.1rem;

    transition: 0.3s;

    background: #fafafa;
}

.category-item:hover {
    box-shadow: 0 8px 15px rgba(0,0,0,0.18);
    transform: scale(1.07);
    border-color: #4a6fa5;
}

.category-item img {
    max-width: 90px;
    max-height: 90px;
    margin-bottom: 10px;
    object-fit: contain;
}

/* ================== RESPONSIVE ================== */

@media(max-width:1100px){

.category-grid{
grid-template-columns:repeat(2,1fr);
grid-template-rows:repeat(4,150px);
margin:0 20px 60px;
}

}

@media(max-width:600px){

.header-left{
flex-wrap:wrap;
justify-content:center;
width:100%;
}

.search-box{
max-width:100%;
}

.nav{
flex-wrap:wrap;
gap:10px;
}

.category-grid{
grid-template-columns:1fr;
grid-template-rows:auto;
margin:0 15px 60px;
}

}

.nav a {
    position: relative;
    padding: 12px 35px;
}

.nav a:not(:last-child)::after {
    content: "";
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 2px;              /* ضخیم‌تر شد */
    height: 24px;
    background-color: #999;  /* پررنگ‌تر */
}

header {
    position: fixed;
    top: 0;
    right: 0;
    width: 100%;
    z-index: 1000;
    background: white;
}
.footer-compact {
    position: fixed;
    bottom: 0;
    right: 0;
    width: 99%;
    z-index: 1000;
}
body {
    padding-top: 120px;   /* اندازه تقریبی ارتفاع هدر */
    padding-bottom: 80px; /* اندازه ارتفاع فوتر */
}

.products-grid{
display:grid;
grid-template-columns:repeat(4,1fr);
gap:25px;
margin-top:40px;
}

.product-card{
background:#fff;
border-radius:12px;
box-shadow:0 4px 15px rgba(0,0,0,0.1);
padding:15px;
text-align:center;
transition:0.3s;
}

.product-card:hover{
transform:translateY(-5px);
}

.product-card img{
width:100%;
height:180px;
object-fit:contain;
}

.product-card h3{
font-size:16px;
margin-top:10px;
}

.kitchen-page{
margin-top:40px;
}

.category-title{
font-size:22px;
margin:40px 0 20px;
font-weight:700;
}

.subcat-grid{
display:grid;
grid-template-columns:repeat(5,1fr);
gap:20px;
}

.subcat-card{
background:#fff;
border-radius:12px;
box-shadow:0 4px 15px rgba(0,0,0,0.1);
padding:15px;
text-align:center;
transition:0.3s;
}

.subcat-card:hover{
transform:translateY(-5px);
}

.subcat-card img{
width:100%;
height:120px;
object-fit:contain;
}

.subcat-card span{
display:block;
margin-top:10px;
font-size:15px;
}

/* فونت کل بدنه */
body, .subcategories, .card {
    font-family: 'BKoodak', Tahoma, sans-serif;
}

/* کانتینر کارت‌ها */
.subcategories {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 20px;
    padding: 20px 0;
}

/* هر کارت محصول */
.card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    overflow: hidden;
    color: #333;
    text-decoration: none;

    /* برای ایجاد انیمیشن نرم هنگام هاور */
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    display: flex;
    flex-direction: column;
    cursor: pointer;
}

/* وقتی فوکوس یا موس روی کارت هست */
.card:hover, .card:focus {
    transform: scale(1.07);
    box-shadow: 0 8px 30px rgba(0,0,0,0.2);
    z-index: 5;
}

/* تصویر در بالا کارت */
.card img {
    width: 100%;
    height: 140px;
    object-fit: cover;
    border-bottom: 2px solid #eee;
    transition: transform 0.3s ease;
}

/* تصویر کمی بزرگتر هنگام هاور */
.card:hover img {
    transform: scale(1.1);
}

/* متن زیر تصویر */
.card span {
    display: block;
    padding: 12px 15px;
    font-weight: 600;
    font-size: 1rem;
    text-align: center;
    color: #222;
    flex-grow: 1;
    line-height: 1.3;
    user-select: none;
}

/* ریسپانسیو برای موبایل */
@media (max-width: 600px) {
    .subcategories {
        grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
        gap: 15px;
        padding: 15px 0;
    }

    .card img {
        height: 110px;
    }

    .card span {
        font-size: 0.9rem;
    }
}

.header {
    position: sticky;
    top: 0;
    height: 70px;
    padding: 15px 40px;
    background: white;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
    z-index: 100;
    box-sizing: border-box;
}

#title {
    padding-top: 80px;
    margin-top: 0;
}

/* ظرف محتوا هم فاصله کوچک داشته باشد */
.container {
    padding-top: 20px;
}

#category-container {
    padding: 20px;
    max-width: 1200px;
    margin: 0 auto;
    font-family: "BKoodak", sans-serif;
}

.subcategory-card {
    border-radius: 12px;
    box-shadow: 0 6px 12px rgba(0,0,0,0.1);
    margin-bottom: 18px;
    background: white;
    overflow: hidden;
    transition: box-shadow 0.3s ease;
}

.subcategory-card:hover {
    box-shadow: 0 10px 20px rgba(0,0,0,0.15);
}

.subcategory-header {
    display: flex;
    align-items: center;
    padding: 15px 20px;
    gap: 20px;
    background: #f0f0f0;
}

.subcategory-header img {
    width: 48px;
    height: 48px;
    object-fit: cover;
    border-radius: 10px;
}

.subcategory-header span {
    font-size: 1.3rem;
    font-weight: 600;
    color: #333;
}

.subcategory-content {
    padding: 12px 20px;
    background: #fff;
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    overflow: hidden;
}

.item-card {
    display: flex;
    flex-direction: column;
    width: 110px;
    text-decoration: none;
    color: #222;
    border-radius: 10px;
    box-shadow: 0 3px 6px rgba(0,0,0,0.1);
    transition: transform 0.25s ease, box-shadow 0.25s ease;
    cursor: pointer;
    background: #fafafa;
    padding: 10px;
    align-items: center;
    gap: 8px;
}

.item-card:hover {
    box-shadow: 0 6px 16px rgba(0,0,0,0.2);
    transform: translateY(-5px);
}

.item-card img {
    width: 80px;
    height: 80px;
    object-fit: contain;
    border-radius: 8px;
}

.item-card span {
    font-size: 0.9rem;
    text-align: center;
    font-family: "BKoodak", sans-serif;
}
.subcategory-content {
    overflow: hidden;
    max-height: 0;
    transition: max-height 0.4s ease;
}
.slider-container {
    overflow: hidden;
    position: relative;
}

.slider {
    display: flex;
    transition: transform 0.5s ease;
}

.slide {
    min-width: calc(100% / 3);
    box-sizing: border-box;
}

.product-link{
text-decoration:none;
color:inherit;
display:block;
}

/* کدهای ریسپانسیو برای هدر در تبلت و موبایل */
@media (max-width: 768px) {
    header {
        display: flex;
        flex-direction: column; /* المان ها زیر هم قرار بگیرند */
        align-items: center;
        gap: 15px;
        padding: 10px;
        height: auto;
    }

    /* منوی ناوبری در موبایل */
    .nav {
        display: flex;
        flex-wrap: wrap; /* اگر جا نشد بروند خط بعد */
        justify-content: center;
        gap: 10px;
        width: 100%;
    }

    .nav a {
        font-size: 14px;
        padding: 5px;
    }

    /* بخش جستجو و حساب کاربری در موبایل */
    .header-left {
        width: 100%;
        display: flex;
        justify-content: space-between;
        align-items: center;
    }

    .search-box {
        width: 80%;
    }

    .search-box input {
        width: 100%; /* باکس جستجو کل عرض باقیمانده را بگیرد */
    }
}

/* ====================================================
   اصلاحات اختصاصی موبایل (رفع مشکل هدر و زیردسته‌ها)
==================================================== */
@media (max-width: 768px) {
    /* 1. جلوگیری از اسکرول افقی در کل سایت */
    body, html {
        overflow-x: hidden;
        width: 100%;
        margin: 0;
        padding: 0;
    }

    /* 2. اصلاح هدر: جلوگیری از رفتن محتوا به زیر هدر و مرتب‌سازی */
    header {
        display: flex;
        flex-direction: column;
        align-items: center;
        position: relative !important; /* حل مشکل رفتن عنوان‌ها زیر هدر */
        height: auto !important;
        padding: 10px;
    }

    .header-left {
        width: 100%;
        justify-content: center;
        margin-top: 15px;
    }

    .search-box {
        width: 100%;
        max-width: 100%;
    }

    /* 3. اصلاح منوی ۵ تایی: نمایش زیر هم بدون بیرون زدن از صفحه */
    .nav {
        display: flex;
        flex-direction: column;
        width: 100%;
        padding: 0;
        margin-top: 15px;
        gap: 0;
    }

    .nav a {
        width: 100%;
        text-align: center;
        padding: 12px 0 !important; /* حذف پدینگ‌های اضافه که باعث اسکرول می‌شد */
        border-bottom: 1px solid #eee; /* یک خط جداکننده زیبا برای موبایل */
    }

    .nav a:not(:last-child)::after {
        display: none !important; /* حذف خطوط عمودی بین منوها در حالت لپ‌تاپ */
    }

    /* 4. اصلاح زیرلایه‌های سوم (مثل ابزار آشپزی) در category.php */
    .subcat-grid {
        display: grid !important;
        grid-template-columns: repeat(2, 1fr); /* دو ستونه شدن منظم و دقیق */
        gap: 10px;
    }

    .subcat-item {
        width: 100% !important; /* پر کردن دقیق عرض ستون */
        margin: 0;
    }

    .subcat-item img {
        height: 110px !important; /* تناسب بهتر عکس در موبایل */
    }
    /* ====================================================
       اصلاح عنوان‌ها و فاصله‌ها در موبایل
    ==================================================== */
    
    /* 1. اصلاح عنوان دسته‌ها (مثل لوازم خانگی برقی) */
    h1, .category-title, .subcategory-title {
        text-align: center !important; /* وسط چین کردن متن */
        margin-top: 15px !important; /* کاهش فاصله زیاد از بالا */
        margin-bottom: 15px !important; /* کاهش فاصله با جدول پایینی */
        padding: 0 20px !important; /* ایجاد فاصله از چپ و راست تا متن به لبه‌ها نچسبد و بریده نشود */
        font-size: 20px !important; /* متناسب کردن سایز فونت با موبایل */
        line-height: 1.5;
        word-wrap: break-word; /* جلوگیری از بیرون زدن کلمات طولانی */
        width: 100%;
        box-sizing: border-box;
    }

    /* 2. کاهش فضای خالی بالای صفحه (زیر هدر) */
    body {
        padding-top: 80px !important; /* در حالت لپ‌تاپ 120 پیکسل است که برای موبایل خیلی زیاد بود */
    }
    
    .kitchen-page {
        margin-top: 15px !important;
    }
    /* فاصله دادن کادرهای دسته بندی از لبه های گوشی */
    .subcat-grid, .subcategories {
        padding-left: 15px !important;
        padding-right: 15px !important;
        box-sizing: border-box !important;
        gap: 15px !important; /* فاصله بین خود مستطیل‌ها */
    }
    /* اصلاح گرید محصولات در موبایل و تبلت */
    .product-grid { /* اگر کلاس محصولات شما اسم دیگری مثل .products دارد اینجا تغییر دهید */
        padding-left: 15px !important;
        padding-right: 15px !important;
        box-sizing: border-box !important;
        gap: 15px !important;
        width: 100% !important;
        /* نمایش 2 ستونه در موبایل */
        grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)) !important; 
    }

    /* جلوگیری از بیرون زدن کارت محصول */
    .product-card {
        width: 100% !important;
        box-sizing: border-box !important;
    }

    /* تنظیم عنوان محصولات ("محصولات این دسته") */
    h2, .section-title { 
        padding-left: 15px !important;
        padding-right: 15px !important;
        box-sizing: border-box !important;
        width: 100% !important;
        text-align: center !important; /* وسط چین کردن عنوان */
        margin-top: 30px !important; /* فاصله از المان بالایی */
    }


    .category-item {
        width: 95% !important;
        max-width: none !important;  /* حذف محدودیت */
        margin: 0 auto 15px auto !important;
        padding-left: 6px !important;
        padding-right: 6px !important;
        box-sizing: border-box !important;
    }

    .products-title {
        text-align: center !important;
        width: 100% !important;
        margin: 0 auto !important;
        display: block !important;
    }
}

