/* =========================================================
   Kian Rayaneh — Mobile layout
   منوی اصلی در عرض <= 992px بسته است و فقط با دکمه باز می‌شود.
   قوانین باز/بسته خود منو در includes/navbar.php است تا با
   استایل inline همان فایل تداخل نکند.
   ========================================================= */

.menu-toggle {
    display: none;
    position: relative;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    background: #f8fafc;
    color: #0f172a;
    cursor: pointer;
    flex: 0 0 44px;
}

/* kr-hamburger-centered: سه خط دقیقاً وسط دکمه، مستقل از اندازه دکمه */
.menu-toggle span {
    position: absolute;
    left: calc(50% - 9px);
    width: 18px;
    height: 2px;
    border-radius: 2px;
    background: currentColor;
    transition: transform .2s ease, opacity .2s ease, top .2s ease;
}

.menu-toggle span:nth-child(1) { top: calc(50% - 7px); }
.menu-toggle span:nth-child(2) { top: calc(50% - 1px); }
.menu-toggle span:nth-child(3) { top: calc(50% + 5px); }

.menu-toggle.is-open span:nth-child(1) {
    top: calc(50% - 1px);
    transform: rotate(45deg);
}

.menu-toggle.is-open span:nth-child(2) { opacity: 0; }

.menu-toggle.is-open span:nth-child(3) {
    top: calc(50% - 1px);
    transform: rotate(-45deg);
}

.shop-filter-toggle,
.header-account-icon {
    display: none;
}

@media (max-width: 992px) {
    html,
    body {
        overflow-x: hidden;
        max-width: 100%;
    }

    body.kr-nav-open {
        overflow: hidden;
    }

    .menu-toggle {
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    .header-account-icon {
        display: inline;
    }

    .header {
        z-index: 10040;
    }

    #cart-overlay.active {
        z-index: 10050 !important;
    }

    #cart-drawer,
    #cart-drawer.active {
        z-index: 10060 !important;
    }

    .header > .container,
    .navbar > .container,
    .main > .container,
    .footer .container,
    .kr-wrap {
        width: min(100% - 20px, 1400px) !important;
    }

    .header-top {
        display: grid !important;
        grid-template-columns: auto minmax(0, 1fr) auto;
        grid-template-areas:
            "toggle logo tools"
            "search search search";
        align-items: center;
        column-gap: 10px;
        row-gap: 8px;
        padding: 8px 0 !important;
    }

    .menu-toggle { grid-area: toggle; }

    .header-top .logo {
        grid-area: logo;
        width: auto !important;
        min-width: 0;
        justify-content: flex-start;
        text-align: right;
    }

    .header-top .logo img,
    .logo img {
        height: 46px !important;
        width: auto;
        max-width: 100%;
        object-fit: contain;
    }

    .header-top .search-box {
        grid-area: search;
        order: unset !important;
        width: 100% !important;
        max-width: none !important;
        min-width: 0 !important;
        flex: none !important;
    }

    .header-top .search-box form,
    .search-box form {
        height: 44px;
        width: 100%;
    }

    .search-box input {
        min-width: 0;
        font-size: 14px;
    }

    .header-tools {
        grid-area: tools;
        width: auto !important;
        margin: 0 !important;
        justify-content: flex-end;
        gap: 6px !important;
        flex-wrap: nowrap;
    }

    .header-account-text { display: none; }

    #cart-count {
        top: 2px;
        left: 2px;
        width: 18px;
        height: 18px;
        font-size: 10px;
    }

    .header-tools a,
    .header-tools .theme-toggle,
    #cart-btn {
        width: 42px;
        height: 42px;
        min-width: 42px;
        padding: 0 !important;
        display: inline-flex !important;
        align-items: center;
        justify-content: center;
        font-size: 18px;
        position: relative;
    }

    .site-ticker {
        z-index: 10030;
    }

    .site-ticker .tk-in {
        max-width: 100% !important;
        white-space: normal;
        flex-wrap: wrap;
        justify-content: center;
        text-align: center;
    }

    img,
    video,
    iframe,
    svg,
    canvas {
        max-width: 100%;
    }

    iframe {
        max-width: 100% !important;
    }

    input,
    select,
    textarea,
    button {
        max-width: 100%;
    }

    .main,
    .kr-home,
    .product-page-v3,
    .shop-page,
    .contact-layout,
    .repair-layout {
        min-width: 0;
    }

    .shop-products,
    .products,
    .categories,
    .services,
    .kr-promos,
    .kr-strips,
    .kr-news,
    .kr-benefits,
    .kr-brands,
    .footer-main,
    .footer-maps,
    .contact-layout,
    .repair-layout,
    .repair-hero,
    .product-page-v3,
    .checkout-layout,
    .cart-layout,
    .form-grid,
    .form-row,
    .checkout-form {
        grid-template-columns: 1fr !important;
    }

    .kr-benefits,
    .categories,
    .kr-brands,
    .shop-products {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    }

    .kr-section-head {
        flex-wrap: wrap;
        gap: 8px;
        align-items: flex-start;
    }

    .kr-section-head h2,
    .section-title h2 {
        font-size: 20px;
        line-height: 1.6;
    }

    .kr-hero-main {
        height: min(58vw, 280px) !important;
    }

    .kr-slide img,
    .slide img {
        width: 100%;
        height: 100%;
        object-fit: cover;
    }

    .kr-hero-side {
        grid-template-columns: 1fr !important;
    }

    .kr-side-card {
        min-height: 112px;
    }

    /* ریل محصولات: یکسان در هر سه قالب (classic/ui/aurora) */
    .kr-rail,
    .ui-rail,
    .au-rail {
        grid-auto-columns: min(78vw, 260px);
    }

    .ui-rail .ui-card {
        width: auto;
    }

    .kr-product,
    .product-card,
    .kr-cat {
        min-width: 0;
    }

    .shop-layout,
    .shop-layout.filter-right,
    .shop-layout.filter-left {
        grid-template-columns: 1fr !important;
        direction: rtl !important;
    }

    .shop-sidebar {
        position: static !important;
        top: auto !important;
        display: none;
    }

    .shop-layout.filters-open .shop-sidebar {
        display: block;
    }

    .shop-filter-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 100%;
        min-height: 46px;
        margin: 0 0 14px;
        border: 1px solid #dbe3ee;
        border-radius: 12px;
        background: #fff;
        color: #0f172a;
        font-family: inherit;
        font-size: 14px;
        font-weight: 800;
        cursor: pointer;
        box-shadow: 0 8px 20px rgba(15, 23, 42, .05);
    }

    .shop-heading {
        flex-direction: column;
        align-items: stretch !important;
        padding: 16px !important;
        gap: 12px !important;
    }

    .shop-heading h1 {
        font-size: 20px !important;
    }

    .shop-search,
    .shop-toolbar,
    .shop-toolbar select {
        width: 100% !important;
    }

    .product-page-v3 {
        padding: 12px !important;
        gap: 16px !important;
        border-radius: 16px !important;
    }

    .product-main-photo {
        height: min(78vw, 320px) !important;
    }

    .product-info-v3 h1 {
        font-size: 22px !important;
    }

    .product-price-v3 {
        font-size: 22px !important;
    }

    .cart-table,
    .table-responsive,
    .data-table,
    .profile-content,
    .orders-table,
    .ticket-table {
        display: block;
        width: 100%;
        max-width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    table {
        max-width: 100%;
    }

    pre,
    code {
        white-space: pre-wrap;
        word-break: break-word;
    }

    .kr-hero-layout,
    .ui-hero,
    .repair-hero,
    .contact-layout,
    .ticket-grid,
    .bios-layout.shop-layout {
        grid-template-columns: 1fr !important;
    }

    .kr-rail-btn,
    .ui-rail-btn,
    .au-rail-btn,
    .au-arrow,
    .slider-prev,
    .slider-next {
        display: none !important;
    }

    .ui-hero-main,
    .au-hero-main,
    .kr-hero-main {
        height: min(58vw, 280px) !important;
        min-height: 0 !important;
    }

    .au-hero-main {
        min-height: 220px !important;
    }

    .ui-copy,
    .au-copy,
    .kr-slide-copy {
        max-width: 88% !important;
    }

    .ui-copy h1,
    .au-copy h1,
    .kr-slide-copy h1,
    .bios-hero h1 {
        font-size: 24px !important;
    }

    .ticket-head,
    .tv-head,
    .bios-toolbar,
    .section-title,
    .kr-section-head,
    .ui-sec-head,
    .au-sec-head {
        flex-wrap: wrap !important;
        align-items: flex-start !important;
    }

    .bios-search {
        min-width: 0 !important;
        width: 100%;
        flex-wrap: wrap;
    }

    .bios-search input,
    .bios-search button {
        min-width: 0;
        width: 100%;
    }

    .auth-wrapper,
    .auth-card,
    .repair-container,
    .contact-container,
    .bios-page,
    .ticket-page,
    .blg-list-wrap {
        width: min(100% - 20px, 1200px);
        max-width: 100%;
        box-sizing: border-box;
    }

    .auth-body {
        padding: 22px 16px;
    }

    .profile-wrapper {
        flex-direction: column !important;
        margin: 16px 0 !important;
    }

    .profile-sidebar {
        width: 100% !important;
        position: static !important;
    }

    #cart-drawer {
        width: min(100%, 420px) !important;
        max-width: 100%;
    }

    .footer-main,
    .footer-bottom,
    .footer-intro {
        text-align: center;
    }

    .footer-bottom {
        flex-direction: column;
        gap: 10px;
        padding-bottom: calc(12px + env(safe-area-inset-bottom));
    }

    .footer-contact-row,
    .footer-address {
        justify-content: center;
    }

    .auth-box,
    .login-box,
    .profile-layout,
    .account-layout {
        width: min(100% - 20px, 520px);
        margin-inline: auto;
    }
}

@media (max-width: 480px) {
    .categories,
    .kr-brands,
    .kr-benefits,
    .shop-products,
    .profile-menu,
    .stats-grid {
        grid-template-columns: 1fr !important;
    }

    .header-tools a,
    .header-tools .theme-toggle,
    #cart-btn,
    .menu-toggle {
        width: 38px;
        height: 38px;
        min-width: 38px;
    }

    .header-top .logo img,
    .logo img {
        height: 36px !important;
        max-width: 100%;
    }

    .kr-hero-main,
    .ui-hero-main {
        height: 200px !important;
    }

    .footer-map-card iframe {
        height: 180px !important;
    }
}

html[data-theme="dark"] .menu-toggle,
html[data-theme="dark"] .shop-filter-toggle {
    background: #16213a;
    color: #f8fafc;
    border-color: #334155;
}

html[data-theme="dark"] .header-tools a,
html[data-theme="dark"] #cart-btn {
    background: #16213a;
    color: #f8fafc;
}

/* نکته: بخش‌های تکراری/خرابِ «auto-generated dark overrides» و نسخه‌های دوم و سوم این استایل‌شیت که باعث مخفی‌شدن دکمه منو در حالت تاریک شده بودند، حذف شدند. */


/* ===== kr-mobile-compact-v3: فشرده‌سازی کلی موبایل — همه‌چیز کمی کوچک‌تر ===== */
@media (max-width: 992px){

    /* هدر */
    .header-top {
        padding: 4px 0 5px !important;
        row-gap: 6px;
    }

    .header .logo img,
    .logo img {
        height: 36px !important;
    }

    .menu-toggle,
    .header-tools a,
    .header-tools .theme-toggle,
    .theme-toggle,
    .header-account,
    .header-cart {
        width: 36px !important;
        height: 36px !important;
        min-width: 36px !important;
    }

    .menu-toggle span { width: 16px; left: calc(50% - 8px); }
    .menu-toggle span:nth-child(1) { top: calc(50% - 6px); }
    .menu-toggle span:nth-child(2) { top: calc(50% - 1px); }
    .menu-toggle span:nth-child(3) { top: calc(50% + 4px); }
    .menu-toggle.is-open span:nth-child(1),
    .menu-toggle.is-open span:nth-child(3) { top: calc(50% - 1px); }

    .header-top .search-box form,
    .search-box form { height: 38px; }

    .search-box input { font-size: 13px; padding: 8px 14px; }

    .search-box button { width: 38px !important; margin: 2px !important; }

    /* تیتر بخش‌ها */
    .kr-section-head h2,
    .section-title h2 { font-size: 18px !important; }

    .shop-heading { padding: 12px !important; gap: 10px !important; }
    .shop-heading h1 { font-size: 18px !important; }

    /* اسلایدر و هیرو */
    .kr-hero-main,
    .ui-hero-main,
    .au-hero-main { height: min(50vw, 220px) !important; }

    .kr-side-card { min-height: 92px; }

    .ui-copy h1,
    .au-copy h1,
    .kr-slide-copy h1,
    .bios-hero h1 { font-size: 20px !important; }

    /* صفحه محصول */
    .product-page-v3 { padding: 10px !important; gap: 12px !important; }
    .product-main-photo { height: min(70vw, 280px) !important; }
    .product-info-v3 h1 { font-size: 20px !important; }
    .product-price-v3 { font-size: 20px !important; }

    /* کارت‌ها */
    .product-card,
    .kr-product,
    .kr-cat,
    .category-card,
    .service-card { border-radius: 14px !important; }

    /* دکمه‌های اصلی */
    .product-btn,
    .checkout-btn,
    .shop-filter-toggle { min-height: 40px !important; padding: 8px 16px !important; font-size: 13px !important; }

    /* فوتر */
    .footer-bottom { padding-top: 10px; }

}

@media (max-width: 480px){

    .header .logo img,
    .logo img { height: 32px !important; }

    .kr-hero-main,
    .ui-hero-main { height: 180px !important; }

    .kr-section-head h2,
    .section-title h2 { font-size: 17px !important; }

}

/* ===== kr-mobile-compact-v4: فشرده‌سازی بیشتر ===== */
@media (max-width: 992px){

    .header .logo img,
    .logo img { height: 30px !important; }

    .menu-toggle,
    .header-tools a,
    .header-tools .theme-toggle,
    .theme-toggle,
    .header-account,
    .header-cart { width: 32px !important; height: 32px !important; min-width: 32px !important; font-size: 16px !important; }

    .header-cart { font-size: 16px !important; }
    #cart-count { min-width: 16px; height: 16px; font-size: 10px; line-height: 16px; top: -5px; inset-inline-start: -5px; }

    .header-top .search-box form,
    .search-box form { height: 34px; }
    .search-box input { font-size: 12px; padding: 6px 12px; }
    .search-box button { width: 34px !important; }

    .kr-section-head h2,
    .section-title h2 { font-size: 16px !important; }
    .section-title a { min-height: 30px; padding: 0 10px; font-size: 12px; }

    .shop-heading h1 { font-size: 16px !important; }

    .kr-hero-main,
    .ui-hero-main,
    .au-hero-main { height: min(44vw, 190px) !important; }
    .kr-side-card { min-height: 80px; }
    .ui-copy h1,
    .au-copy h1,
    .kr-slide-copy h1,
    .bios-hero h1 { font-size: 18px !important; }

    .product-main-photo { height: min(62vw, 240px) !important; }
    .product-info-v3 h1 { font-size: 18px !important; }
    .product-price-v3 { font-size: 18px !important; }

    .product-btn,
    .checkout-btn,
    .shop-filter-toggle { min-height: 36px !important; padding: 6px 14px !important; font-size: 12px !important; }

    .product-card,
    .kr-product,
    .kr-cat,
    .category-card,
    .service-card { border-radius: 12px !important; }

}

@media (max-width: 480px){

    .header .logo img,
    .logo img { height: 28px !important; }

    .kr-hero-main,
    .ui-hero-main { height: 160px !important; }

    .kr-section-head h2,
    .section-title h2 { font-size: 15px !important; }

}

/* ===== kr-footer-contact-tidy: اطلاعات تماس و آدرس مرتب در موبایل ===== */
@media (max-width: 992px){

    .footer-column-contact { text-align: right; }

    .footer-contact { gap: 8px !important; }

    .footer-contact-row {
        background: rgba(255, 255, 255, .05) !important;
        border: 1px solid rgba(255, 255, 255, .09) !important;
        border-radius: 12px !important;
        padding: 8px 12px !important;
        gap: 10px !important;
        font-size: 13px !important;
    }

    .footer-contact-row > div,
    .footer-contact-row > a {
        display: flex !important;
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 3px !important;
    }

    .footer-contact-icon {
        width: 34px !important;
        height: 34px !important;
        flex: 0 0 34px !important;
        background: rgba(56, 189, 248, .16) !important;
        border-radius: 10px !important;
        font-size: 15px !important;
    }

    .footer-contact-row a { color: #e2e8f0 !important; }

    .footer-address {
        margin-top: 10px !important;
        padding: 10px 12px !important;
        background: rgba(255, 255, 255, .05) !important;
        border: 1px solid rgba(255, 255, 255, .09) !important;
        border-radius: 12px !important;
        font-size: 13px !important;
        text-align: right !important;
        line-height: 2 !important;
        align-items: flex-start !important;
    }

    .footer-address span:first-child { font-size: 16px; }

}

/* kr-footer-contact-align: ردیف‌ها چسبیده به راست، آیکون کنار متن */
@media (max-width: 992px){
    .footer-contact { justify-items: stretch !important; }
    .footer-contact-row {
        justify-content: flex-start !important;
        width: 100% !important;
        box-sizing: border-box !important;
    }
    .footer-address {
        justify-content: flex-start !important;
        width: 100% !important;
        box-sizing: border-box !important;
    }
}