/**
 * MotoMan 100% Native Pure PHP/HTML Categories Navigation & Mega-Menu Styles
 *
 * Fully Server-Side Rendered (SSR) for search engines (Googlebot).
 * Zero-layout-shift, instant CSS-driven transitions, touch-target compliant.
 *
 * @package MotoMan
 * @version 3.0.0
 */

/* ==========================================================================
   1. DESKTOP NAVIGATION BAR (STICKY ROW UNDER HEADER)
   ========================================================================== */
.mm-desktop-nav-bar {
    display: none;
    background: #ffffff;
    border-top: 1px solid #f1f3f5;
    border-bottom: 2px solid #eef0f3;
    position: relative;
    z-index: 998;
}

@media (min-width: 992px) {
    .mm-desktop-nav-bar {
        display: block;
    }
}

.mm-desktop-nav-container {
    position: relative;
    padding: 0 15px;
    margin: 0 auto;
    max-width: 1240px;
}

.mm-desktop-nav-list {
    display: flex;
    align-items: center;
    list-style: none;
    margin: 0;
    padding: 0;
    gap: 4px;
    flex-wrap: nowrap;
    overflow-x: visible;
}

/* Individual Navigation Item */
.mm-desktop-nav-list > .mm-nav-item {
    position: relative;
    list-style: none;
    margin: 0;
    padding: 0;
}

/* Category Link */
.mm-nav-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 14px;
    color: var(--mm-black, #111315);
    font-size: 13.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    text-decoration: none;
    border-radius: 8px;
    transition: color 0.18s ease, background-color 0.18s ease;
    white-space: nowrap;
    line-height: 1;
}

.mm-nav-link:hover,
.mm-nav-link:focus-visible,
.mm-nav-item:hover > .mm-nav-link,
.mm-nav-item:focus-within > .mm-nav-link {
    color: var(--mm-accent, #e10600);
    background-color: rgba(225, 6, 0, 0.06);
    outline: none;
}

/* Category SVG Icon */
.mm-nav-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #6b7280;
    transition: color 0.18s ease;
}

.mm-nav-link:hover .mm-nav-icon,
.mm-nav-item:hover > .mm-nav-link .mm-nav-icon {
    color: var(--mm-accent, #e10600);
}

/* Chevron */
.mm-nav-chevron {
    color: #9ca3af;
    transition: transform 0.2s ease, color 0.18s ease;
    margin-left: 2px;
}

.mm-nav-item:hover > .mm-nav-link .mm-nav-chevron,
.mm-nav-item:focus-within > .mm-nav-link .mm-nav-chevron {
    transform: rotate(180deg);
    color: var(--mm-accent, #e10600);
}

/* PROMO Highlight */
.mm-nav-item--promo > .mm-nav-link {
    color: var(--mm-accent, #e10600);
    font-weight: 800;
}

.mm-nav-badge-promo {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--mm-accent, #e10600);
    color: #ffffff;
    font-size: 11px;
    font-weight: 900;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    margin-left: 4px;
    box-shadow: 0 2px 6px rgba(225, 6, 0, 0.4);
}

/* ==========================================================================
   2. DESKTOP MEGA-MENU DROPDOWN (100% NATIVE CSS HOVER & FOCUS)
   ========================================================================== */
.mm-mega-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 480px;
    background: #ffffff;
    border-radius: 0 0 16px 16px;
    box-shadow: 0 18px 45px rgba(0, 0, 0, 0.12), 0 4px 12px rgba(0, 0, 0, 0.05);
    border: 1px solid #e5e7eb;
    border-top: 3px solid var(--mm-accent, #e10600);
    padding: 20px 24px 16px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    pointer-events: none;
    transition: opacity 0.2s cubic-bezier(0.16, 1, 0.3, 1),
                transform 0.2s cubic-bezier(0.16, 1, 0.3, 1),
                visibility 0.2s ease;
    z-index: 1002;
    box-sizing: border-box;
}

/* Mega dropdown container for large categories */
.mm-has-dropdown:hover > .mm-mega-dropdown,
.mm-has-dropdown:focus-within > .mm-mega-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    pointer-events: auto;
}

/* Prevent dropdown from overflowing the viewport right edge */
.mm-desktop-nav-list > .mm-nav-item:nth-last-child(-n+3) .mm-mega-dropdown {
    left: auto;
    right: 0;
}

/* Sizing per column count */
.mm-mega-cols-2 {
    display: grid;
    grid-template-columns: repeat(2, minmax(200px, 1fr));
    gap: 8px 24px;
    min-width: 460px;
}

.mm-mega-cols-3 {
    display: grid;
    grid-template-columns: repeat(3, minmax(200px, 1fr));
    gap: 8px 20px;
    min-width: 680px;
}

/* Header inside Mega-Dropdown */
.mm-mega-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 12px;
    margin-bottom: 14px;
    border-bottom: 1px solid #f1f3f5;
}

.mm-mega-title {
    margin: 0;
    font-size: 15px;
    font-weight: 800;
    color: var(--mm-black, #111315);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-family: inherit;
}

.mm-mega-view-all {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 700;
    color: var(--mm-accent, #e10600);
    text-decoration: none;
    transition: gap 0.2s ease;
}

.mm-mega-view-all:hover {
    gap: 9px;
    text-decoration: underline;
}

/* Mega-Menu Links Grid */
.mm-mega-grid {
    list-style: none;
    margin: 0;
    padding: 0;
}

.mm-mega-item {
    list-style: none;
    margin: 0;
}

.mm-mega-sublink {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border-radius: 6px;
    color: #374151;
    font-size: 13.5px;
    font-weight: 600;
    text-decoration: none;
    transition: background 0.15s ease, color 0.15s ease, transform 0.15s ease;
    line-height: 1.35;
}

.mm-mega-bullet {
    color: #9ca3af;
    font-size: 16px;
    font-weight: 800;
    transition: color 0.15s ease, transform 0.15s ease;
}

.mm-mega-sublink:hover,
.mm-mega-sublink:focus-visible {
    background-color: #fef2f2;
    color: var(--mm-accent, #e10600);
    transform: translateX(4px);
    outline: none;
}

.mm-mega-sublink:hover .mm-mega-bullet {
    color: var(--mm-accent, #e10600);
}

.mm-mega-subname {
    flex: 1;
}

/* Mega Footer */
.mm-mega-footer {
    margin-top: 14px;
    padding-top: 10px;
    border-top: 1px solid #f1f3f5;
}

.mm-mega-hint {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: #6b7280;
    font-weight: 500;
}

.mm-mega-hint svg {
    color: #16a34a;
}

/* ==========================================================================
   3. HEADER TOP ROW ALIGNMENT, PADDINGS & UTILITIES
   ========================================================================== */
.mm-header {
    padding: 0 !important;
    background: rgba(255, 255, 255, 0.98);
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    padding: 10px 0 !important;
}

/* On Homepage: sleek, compact single-row header */
body.home .mm-header,
body.front-page .mm-header {
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
}

.mm-header-left {
    flex-shrink: 0;
    display: flex;
    align-items: center;
}

.header-search-wrap {
    flex: 1;
    max-width: 620px;
    margin: 0 auto;
}

.mm-header-search {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
    max-width: 360px;
}

.mm-header-search input.search-field {
    width: 100%;
    height: 42px;
    padding: 0 48px 0 20px !important;
    border-radius: 999px;
    border: 1.5px solid #e5e7eb;
    background: #f9fafb;
    font-size: 14px;
    color: #111827;
    transition: border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
    box-sizing: border-box;
}

.mm-header-search input.search-field:focus {
    background: #ffffff;
    border-color: var(--mm-accent, #e10600);
    box-shadow: 0 0 0 3px rgba(225, 6, 0, 0.12);
    outline: none;
}

.mm-header-search button {
    position: absolute;
    left: auto !important;
    right: 5px !important;
    top: 50%;
    transform: translateY(-50%);
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--mm-accent, #e10600);
    color: #ffffff;
    border: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.15s ease;
    padding: 0;
}

.mm-header-search button:hover {
    background: #b90500;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-shrink: 0;
}

.header-action-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: #111315;
    text-decoration: none;
    font-size: 13.5px;
    font-weight: 700;
    padding: 6px 10px;
    border-radius: 6px;
    transition: color 0.18s ease;
}

.header-action-btn:hover {
    color: var(--mm-accent, #e10600);
}

.header-cart-link {
    display: inline-flex;
    align-items: center;
    position: relative;
    padding: 6px;
    color: #111315;
    text-decoration: none;
    transition: color 0.18s ease;
}

.header-cart-link:hover {
    color: var(--mm-accent, #e10600);
}

.header-cart-count {
    position: absolute;
    top: -2px;
    right: -4px;
    background: var(--mm-accent, #e10600);
    color: #ffffff;
    font-size: 11px;
    font-weight: 800;
    min-width: 18px;
    height: 18px;
    line-height: 18px;
    text-align: center;
    border-radius: 999px;
    padding: 0 4px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* ==========================================================================
   4. MOBILE OFFCANVAS DRAWER (RESPONSIVE & TOUCH-FRIENDLY)
   ========================================================================== */
.mm-menu-toggle {
    display: none;
    flex-direction: column;
    justify-content: space-between;
    width: 26px;
    height: 20px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    z-index: 10;
}

.mm-menu-toggle span {
    display: block;
    width: 100%;
    height: 2.5px;
    background: #111315;
    border-radius: 2px;
    transition: transform 0.2s ease, opacity 0.2s ease;
}

@media (max-width: 991px) {
    .mm-menu-toggle {
        display: flex;
    }
    .header-account-btn {
        display: none;
    }
    .header-search-wrap {
        display: none;
    }
    .mm-mobile-search-bar {
        display: block !important;
        padding: 8px 15px 12px;
        background: #ffffff;
        border-bottom: 1px solid #e5e7eb;
    }
    .mm-mobile-search-form {
        position: relative;
        display: flex;
    }
    .mm-mobile-search-form input.search-field {
        width: 100%;
        height: 42px;
        padding: 0 46px 0 16px;
        border-radius: 999px;
        border: 1.5px solid #e5e7eb;
        background: #f9fafb;
        font-size: 14px;
    }
    .mm-mobile-search-form button {
        position: absolute;
        right: 3px;
        top: 50%;
        transform: translateY(-50%);
        width: 36px;
        height: 36px;
        border-radius: 50%;
        background: var(--mm-accent, #e10600);
        color: #ffffff;
        border: none;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }
}

/* Mobile Phone Header (<= 768px): Clean, centered branding without duplicate actions (actions live in sticky bottom nav dock) */
@media (max-width: 768px) {
    .header-inner {
        justify-content: center !important;
        padding: 8px 0 !important;
    }
    .logo-wrap {
        margin: 0 auto;
        display: flex;
        justify-content: center;
    }
    .logo-wrap img,
    .site-logo,
    .custom-logo {
        max-height: 46px !important;
    }
    /* Hide duplicate cart & hamburger toggle from top header on phones (unified in .mm-mobile-bottom-nav) */
    .header-actions {
        display: none !important;
    }
}

/* Drawer Shell */
.mm-offcanvas-menu {
    position: fixed;
    top: 0;
    left: 0;
    right: auto !important;
    width: min(340px, 86vw);
    height: 100%;
    height: 100dvh;
    background: #ffffff;
    z-index: 99999;
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.15);
    transform: translateX(-100%);
    visibility: hidden;
    pointer-events: none;
    transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.28s ease;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-sizing: border-box;
}

.mm-offcanvas-menu.is-active {
    transform: translateX(0) !important;
    visibility: visible;
    pointer-events: auto;
}

.mm-offcanvas-inner {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

/* Drawer Header */
.mm-offcanvas-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 20px;
    background: #111315;
    color: #ffffff;
    flex-shrink: 0;
}

.mm-offcanvas-title {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 15px;
    font-weight: 800;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.mm-offcanvas-close-btn {
    background: transparent;
    border: none;
    color: #ffffff;
    cursor: pointer;
    padding: 4px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: background 0.15s ease;
}

.mm-offcanvas-close-btn:hover {
    background: rgba(255, 255, 255, 0.15);
}

/* Drawer Body */
.mm-offcanvas-body {
    flex: 1;
    padding: 16px 0;
    overflow-y: auto;
}

.mm-drawer-section-heading {
    padding: 10px 20px 6px;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.08em;
    color: #9ca3af;
    text-transform: uppercase;
}

.mm-drawer-section-heading--site {
    margin-top: 16px;
    border-top: 1px solid #f1f3f5;
    padding-top: 18px;
}

/* Category Items in Drawer */
.mm-drawer-cat-list,
.mm-drawer-quick-nav {
    list-style: none;
    margin: 0;
    padding: 0;
}

.mm-drawer-cat-item {
    border-bottom: 1px solid #f3f4f6;
}

.mm-drawer-cat-row {
    display: flex;
    align-items: stretch;
    justify-content: space-between;
    min-height: 48px;
}

.mm-drawer-cat-link {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: flex-start !important;
    gap: 12px;
    padding: 12px 14px 12px 20px;
    color: #111827;
    font-size: 14.5px;
    font-weight: 700;
    text-decoration: none;
    line-height: 1.25;
    text-align: left;
}

.mm-drawer-cat-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    color: #6b7280;
    flex-shrink: 0;
}

.mm-drawer-cat-name {
    display: inline-block;
    text-align: left;
}

.mm-drawer-cat-link .mm-nav-badge-promo {
    margin-left: 6px;
    flex-shrink: 0;
}

.mm-drawer-cat-link:hover .mm-drawer-cat-icon,
.mm-drawer-cat-link:hover {
    color: var(--mm-accent, #e10600);
}

/* Accordion Toggle Button (Touch-Target min 48px) */
.mm-drawer-acc-toggle {
    width: 48px;
    min-height: 48px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: #6b7280;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}

.mm-drawer-acc-toggle:hover {
    background: #f9fafb;
    color: var(--mm-accent, #e10600);
}

.mm-drawer-chevron {
    transition: transform 0.22s ease;
}

.mm-drawer-acc-toggle[aria-expanded="true"] .mm-drawer-chevron {
    transform: rotate(180deg);
    color: var(--mm-accent, #e10600);
}

/* Sub-list in Drawer */
.mm-drawer-sub-list {
    list-style: none;
    margin: 0;
    padding: 6px 0;
    background: #f9fafb;
    border-top: 1px solid #eef0f3;
}

.mm-drawer-sub-item {
    margin: 0;
}

.mm-drawer-sub-link {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
    padding: 10px 20px 10px 42px;
    color: #374151;
    font-size: 13.5px;
    font-weight: 600;
    text-decoration: none;
    line-height: 1.3;
    text-align: left;
    min-height: 40px;
    box-sizing: border-box;
}

.mm-drawer-sub-link:hover {
    color: var(--mm-accent, #e10600);
    background: #fef2f2;
}

.mm-drawer-sub-link--all {
    color: var(--mm-accent, #e10600);
    font-weight: 700;
    justify-content: space-between;
    padding-bottom: 8px;
    border-bottom: 1px dashed #e5e7eb;
    margin-bottom: 4px;
}

.mm-drawer-bullet {
    color: #9ca3af;
    font-weight: 800;
}

/* Quick Nav Links */
.mm-drawer-quick-nav li a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    color: #1f2937;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    border-bottom: 1px solid #f3f4f6;
}

.mm-drawer-quick-nav li a svg {
    color: #6b7280;
}

.mm-drawer-quick-nav li a:hover {
    color: var(--mm-accent, #e10600);
    background: #fef2f2;
}

/* Drawer Footer */
.mm-offcanvas-footer {
    padding: 16px 20px;
    border-top: 1px solid #e5e7eb;
    background: #fafafa;
    display: flex;
    flex-direction: column;
    gap: 10px;
    flex-shrink: 0;
}

.mm-drawer-contact-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 42px;
    border-radius: 8px;
    font-size: 13.5px;
    font-weight: 700;
    text-decoration: none;
    color: #ffffff !important;
}

.mm-drawer-contact-btn--whatsapp {
    background: #166534 !important;
}

.mm-drawer-contact-btn--phone {
    background: #991b1b !important;
}

/* Overlay Backdrop */
.mm-offcanvas-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(2px);
    z-index: 99998;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0.25s ease;
}

.mm-offcanvas-overlay.is-active {
    opacity: 1;
    visibility: visible;
}

/* ==========================================================================
   7. OPTIMIZED VERTICAL PADDINGS & SHOP CATALOG SPACING
   ========================================================================== */

/* Tight, clean shop hero spacing */
.mm-page-hero--shop {
    padding: 24px 0 18px !important;
}

.mm-page-hero--shop .mm-page-hero__inner {
    padding: 0 15px !important;
}

.mm-page-hero--shop .mm-page-hero__title {
    font-size: 1.6rem !important;
    margin-bottom: 4px !important;
}

.mm-page-hero--shop .mm-page-hero__subtitle {
    font-size: 0.92rem !important;
}

/* Categories slider section above products */
.mm-categories-slider-section {
    padding: 16px 0 14px !important;
    background: #f8fafc !important;
    border-bottom: 1px solid #edf2f7 !important;
}

.mm-categories-slider-section .mm-section-header {
    margin-bottom: 12px !important;
}

.mm-categories-slider-section .mm-section-title {
    font-size: 1.25rem !important;
    letter-spacing: 0.02em !important;
}

.mm-categories-slider-section .mm-section-title::after {
    margin-top: 6px !important;
    height: 3px !important;
}

.mm-cat-card {
    padding: 10px 12px !important;
}

.mm-cat-card__image {
    width: 64px !important;
    height: 64px !important;
    margin-bottom: 6px !important;
}

/* Main Shop layout spacing */
.woocommerce-shop .mm-section,
.tax-product_cat .mm-section {
    padding: 18px 0 40px !important;
}

/* Homepage Hero padding */
body.home .mm-header,
body.front-page .mm-header {
    border-bottom: 1px solid rgba(0, 0, 0, 0.08) !important;
}

body.home .hero-section,
body.front-page .hero-section {
    margin-top: 0 !important;
}
