/**
 * TitanCart — Storefront Header, Nav & Footer
 *
 * Loaded on all TitanCart pages.
 * Hides theme default header/footer and replaces with TitanCart nav.
 */

/* ══════════════════════════════════════════════════════════════════════════════
   THEME OVERRIDE — hide default header/footer on TitanCart pages
   ══════════════════════════════════════════════════════════════════════════════ */
body.titancart-shop #header,
body.titancart-product #header,
body.titancart-cart #header,
body.titancart-checkout #header,
body.titancart-order-received #header,
body.titancart-account #header,
body.titancart-search #header {
    display: none !important;
}
body.titancart-shop #footer,
body.titancart-product #footer,
body.titancart-cart #footer,
body.titancart-checkout #footer,
body.titancart-order-received #footer,
body.titancart-account #footer,
body.titancart-search #footer {
    display: none !important;
}
/* Hide <hr> separators from classic themes */
body.titancart-shop #page > hr,
body.titancart-product #page > hr,
body.titancart-cart #page > hr,
body.titancart-checkout #page > hr,
body.titancart-order-received #page > hr,
body.titancart-account #page > hr,
body.titancart-search #page > hr {
    display: none !important;
}

/* ══════════════════════════════════════════════════════════════════════════════
   TOP BAR
   ══════════════════════════════════════════════════════════════════════════════ */
.tc-site-header {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    line-height: 1.5;
}

.tc-topbar {
    background: #111;
    color: #ccc;
    font-size: 12px;
}
.tc-topbar__inner {
    max-width: 1280px;
    margin: 0 auto;
    padding: 8px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}
.tc-topbar__links {
    display: flex;
    gap: 20px;
}
.tc-topbar__links a {
    color: #ccc;
    text-decoration: none;
    transition: color 0.15s;
}
.tc-topbar__links a:hover {
    color: #fff;
}
.tc-topbar__right {
    display: flex;
    align-items: center;
    gap: 16px;
}
.tc-topbar__msg {
    color: #aaa;
    font-size: 11px;
}

/* ══════════════════════════════════════════════════════════════════════════════
   MAIN NAV
   ══════════════════════════════════════════════════════════════════════════════ */
.tc-nav {
    background: #fff;
    border-bottom: 1px solid #e5e5e5;
    position: sticky;
    top: 0;
    z-index: 999;
}
/* WP admin bar offset */
body.admin-bar .tc-nav {
    top: 32px;
}
@media (max-width: 782px) {
    body.admin-bar .tc-nav {
        top: 46px;
    }
}

.tc-nav__inner {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 24px;
    height: 64px;
    display: flex;
    align-items: center;
    gap: 24px;
}

/* Logo */
.tc-nav__logo {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    flex-shrink: 0;
}
.tc-nav__logo-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: linear-gradient(135deg, #2563EB, #3B82F6);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 700;
    font-size: 12px;
    box-shadow: 0 2px 6px rgba(37, 99, 235, 0.25);
}
.tc-nav__logo-text {
    font-size: 18px;
    font-weight: 700;
    color: #111;
    letter-spacing: -0.3px;
}

/* Hamburger (mobile only) */
.tc-nav__hamburger {
    display: none;
    background: none;
    border: none;
    font-size: 24px;
    color: #111;
    cursor: pointer;
    padding: 4px;
    margin-left: auto;
}

/* Desktop menu links */
.tc-nav__menu {
    display: flex;
    align-items: center;
    gap: 4px;
    flex: 1;
    margin-left: 8px;
}
.tc-nav__link {
    padding: 8px 14px;
    font-size: 14px;
    font-weight: 500;
    color: #444;
    text-decoration: none;
    border-radius: 6px;
    transition: background 0.12s, color 0.12s;
    white-space: nowrap;
}
.tc-nav__link:hover {
    background: #f5f5f5;
    color: #111;
}

/* WordPress assigned menu items — match .tc-nav__link styling */
.tc-nav__menu .menu-item {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    align-items: center;
}
.tc-nav__menu .menu-item a {
    padding: 8px 14px;
    font-size: 14px;
    font-weight: 500;
    color: #444;
    text-decoration: none;
    border-radius: 6px;
    transition: background 0.12s, color 0.12s;
    white-space: nowrap;
}
.tc-nav__menu .menu-item a:hover {
    background: #f5f5f5;
    color: #111;
}
.tc-nav__menu .menu-item.current-menu-item a {
    color: #111;
    font-weight: 600;
}

/* Search bar */
.tc-nav__search {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #f5f5f5;
    border: 1px solid #e5e5e5;
    border-radius: 8px;
    padding: 0 14px;
    height: 38px;
    min-width: 260px;
    max-width: 360px;
    flex-shrink: 1;
    transition: border-color 0.15s;
}
.tc-nav__search:focus-within {
    border-color: #111;
    background: #fff;
}
.tc-nav__search i {
    color: #999;
    font-size: 14px;
    flex-shrink: 0;
}
.tc-nav__search-input {
    border: none;
    background: transparent;
    font-size: 13px;
    color: #111;
    outline: none;
    width: 100%;
    font-family: inherit;
}
.tc-nav__search-input::placeholder {
    color: #999;
}

/* Icon buttons */
.tc-nav__icons {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}
.tc-nav__icon-btn {
    position: relative;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    border: none;
    background: transparent;
    color: #333;
    font-size: 18px;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.12s;
}
.tc-nav__icon-btn:hover {
    background: #f5f5f5;
    color: #111;
}

/* Badge */
.tc-nav__badge {
    position: absolute;
    top: 4px;
    right: 2px;
    min-width: 16px;
    height: 16px;
    background: #dc2626;
    color: #fff;
    font-size: 10px;
    font-weight: 600;
    border-radius: 99px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    line-height: 1;
}

/* ══════════════════════════════════════════════════════════════════════════════
   MOBILE OFFCANVAS MENU
   ══════════════════════════════════════════════════════════════════════════════ */
.tc-mobile-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 9998;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s, visibility 0.25s;
}
.tc-mobile-overlay.tc-open {
    opacity: 1;
    visibility: visible;
}
.tc-mobile-menu {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 300px;
    max-width: 85vw;
    background: #fff;
    z-index: 9999;
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}
.tc-mobile-menu.tc-open {
    transform: translateX(0);
}
.tc-mobile-menu__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid #eee;
}
.tc-mobile-menu__close {
    background: none;
    border: none;
    font-size: 20px;
    color: #666;
    cursor: pointer;
    padding: 4px;
}
.tc-mobile-menu__search {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 16px 20px;
    padding: 10px 14px;
    background: #f5f5f5;
    border: 1px solid #e5e5e5;
    border-radius: 8px;
}
.tc-mobile-menu__search i {
    color: #999;
    font-size: 15px;
}
.tc-mobile-menu__search input {
    border: none;
    background: transparent;
    font-size: 14px;
    color: #111;
    outline: none;
    width: 100%;
    font-family: inherit;
}
.tc-mobile-menu__links {
    display: flex;
    flex-direction: column;
    padding: 8px 12px;
}
.tc-mobile-menu__links a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 12px;
    font-size: 15px;
    color: #333;
    text-decoration: none;
    border-radius: 8px;
    transition: background 0.12s;
}
.tc-mobile-menu__links a:hover {
    background: #f5f5f5;
}
.tc-mobile-menu__links a i {
    font-size: 17px;
    color: #666;
    width: 22px;
    text-align: center;
}
.tc-mobile-menu__links hr {
    border: none;
    border-top: 1px solid #eee;
    margin: 8px 12px;
}

/* ══════════════════════════════════════════════════════════════════════════════
   FOOTER
   ══════════════════════════════════════════════════════════════════════════════ */
.tc-site-footer {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    color: #333;
    line-height: 1.6;
}

.tc-footer__main {
    background: #fafafa;
    border-top: 1px solid #e5e5e5;
    padding: 56px 24px 48px;
}
.tc-footer__inner {
    max-width: 1280px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 1.3fr 1fr 1fr 1.2fr;
    gap: 40px;
}

/* Brand col */
.tc-footer__brand .tc-footer__logo {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    margin-bottom: 16px;
}
.tc-footer__desc {
    font-size: 13px;
    color: #666;
    margin: 0 0 20px;
    max-width: 280px;
}
.tc-footer__social {
    display: flex;
    gap: 8px;
}
.tc-footer__social a {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    border: 1px solid #d4d4d4;
    color: #444;
    font-size: 15px;
    text-decoration: none;
    transition: border-color 0.15s, color 0.15s;
}
.tc-footer__social a:hover {
    border-color: #111;
    color: #111;
}

/* Link columns */
.tc-footer__heading {
    font-size: 14px;
    font-weight: 600;
    color: #111;
    margin: 0 0 16px;
}
.tc-footer__links {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.tc-footer__links a {
    font-size: 13px;
    color: #666;
    text-decoration: none;
    transition: color 0.12s;
}
.tc-footer__links a:hover {
    color: #111;
}

/* Newsletter */
.tc-footer__newsletter p {
    font-size: 13px;
    color: #666;
    margin: 0 0 14px;
}
.tc-footer__nl-form {
    display: flex;
    gap: 0;
    border-radius: 8px;
    overflow: hidden;
    border: 1.5px solid #d4d4d4;
    transition: border-color 0.15s;
}
.tc-footer__nl-form:focus-within {
    border-color: #111;
}
.tc-footer__nl-form input {
    flex: 1;
    padding: 10px 14px;
    border: none;
    font-size: 13px;
    color: #111;
    outline: none;
    font-family: inherit;
    background: #fff;
}
.tc-footer__nl-form input::placeholder {
    color: #999;
}
.tc-footer__nl-form button {
    width: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #111;
    border: none;
    color: #fff;
    font-size: 16px;
    cursor: pointer;
    transition: background 0.12s;
}
.tc-footer__nl-form button:hover {
    background: #333;
}

/* Bottom bar */
.tc-footer__bottom {
    background: #fff;
    border-top: 1px solid #e5e5e5;
    padding: 20px 24px;
    font-size: 12px;
    color: #888;
}
.tc-footer__bottom-inner {
    max-width: 1280px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    flex-wrap: wrap;
}
.tc-footer__bottom p {
    margin: 0;
}
.tc-footer__policy-links {
    display: flex;
    gap: 20px;
}
.tc-footer__policy-links a {
    color: #888;
    text-decoration: none;
    transition: color 0.12s;
}
.tc-footer__policy-links a:hover {
    color: #111;
}
.tc-footer__payments {
    display: flex;
    gap: 8px;
    align-items: center;
}
.tc-footer__payments svg {
    border-radius: 3px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.08);
}

/* ══════════════════════════════════════════════════════════════════════════════
   WP NAV MENU INTEGRATION
   wp_nav_menu outputs <ul class="menu"><li><a> structure.
   These rules normalize that to match our layout.
   ══════════════════════════════════════════════════════════════════════════════ */

/* Top bar WP menu items (no <ul> wrapper due to items_wrap='%3$s') */
.tc-topbar__links .menu-item {
    list-style: none;
    margin: 0;
    padding: 0;
}
.tc-topbar__links .menu-item a {
    color: #ccc;
    text-decoration: none;
    transition: color 0.15s;
}
.tc-topbar__links .menu-item a:hover {
    color: #fff;
}

/* Main nav WP menu — legacy .menu rules kept for themes that use default items_wrap */
.tc-nav__menu .menu {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 4px;
}
.tc-nav__menu .menu li {
    list-style: none;
}
.tc-nav__menu .menu a {
    padding: 8px 14px;
    font-size: 14px;
    font-weight: 500;
    color: #444;
    text-decoration: none;
    border-radius: 6px;
    transition: background 0.12s, color 0.12s;
    white-space: nowrap;
    display: block;
}
.tc-nav__menu .menu a:hover {
    background: #f5f5f5;
    color: #111;
}

/* Mobile menu WP menu items (no <ul> wrapper due to items_wrap='%3$s') */
.tc-mobile-menu__links .menu-item {
    list-style: none;
    margin: 0;
    padding: 0;
}
.tc-mobile-menu__links .menu-item a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 12px;
    font-size: 15px;
    color: #333;
    text-decoration: none;
    border-radius: 8px;
    transition: background 0.12s;
}
.tc-mobile-menu__links .menu-item a:hover {
    background: #f5f5f5;
}

/* Footer WP menu — inherits .tc-footer__links styling */
.tc-footer__links.menu,
.tc-footer__col .menu {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.tc-footer__links.menu li,
.tc-footer__col .menu li {
    list-style: none;
}
.tc-footer__links.menu a,
.tc-footer__col .menu a {
    font-size: 13px;
    color: #666;
    text-decoration: none;
    transition: color 0.12s;
}
.tc-footer__links.menu a:hover,
.tc-footer__col .menu a:hover {
    color: #111;
}

/* WP adds .current-menu-item — highlight active */
.tc-nav__menu .current-menu-item > a {
    color: #111;
    font-weight: 600;
}

/* ══════════════════════════════════════════════════════════════════════════════
   RESPONSIVE
   ══════════════════════════════════════════════════════════════════════════════ */
@media (max-width: 1024px) {
    .tc-nav__menu {
        display: none;
    }
    .tc-nav__search {
        flex: 1;
        max-width: none;
        margin-left: 16px;
    }
    .tc-nav__hamburger {
        display: flex;
        order: -1;
        margin-left: 0;
    }
    .tc-nav__logo {
        order: -2;
    }
    .tc-nav__icons {
        margin-left: auto;
    }

    .tc-footer__inner {
        grid-template-columns: 1fr 1fr;
        gap: 32px;
    }
    .tc-footer__brand {
        grid-column: 1 / -1;
    }
}

@media (max-width: 768px) {
    .tc-topbar {
        display: none;
    }
    .tc-nav__inner {
        padding: 0 16px;
        height: 56px;
        gap: 12px;
    }
    .tc-nav__search {
        display: none;
    }
    .tc-nav__logo-text {
        font-size: 16px;
    }

    .tc-footer__inner {
        grid-template-columns: 1fr;
        gap: 28px;
    }
    .tc-footer__main {
        padding: 40px 16px 32px;
    }
    .tc-footer__bottom-inner {
        flex-direction: column;
        text-align: center;
        gap: 12px;
    }
}

/* ══════════════════════════════════════════════════════════════════════════════
   SEARCH SUGGESTIONS DROPDOWN
   ══════════════════════════════════════════════════════════════════════════════ */
.tc-suggest-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin-top: 6px;
    background: #fff;
    border: 1px solid #e5e5e5;
    border-radius: 10px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.12);
    z-index: 1000;
    overflow: hidden;
    max-height: 420px;
    overflow-y: auto;
}

.tc-suggest__item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    text-decoration: none;
    color: #111;
    transition: background 0.1s;
    border-bottom: 1px solid #f5f5f5;
}
.tc-suggest__item:last-of-type {
    border-bottom: none;
}
.tc-suggest__item:hover {
    background: #f8f8f8;
}

.tc-suggest__thumb {
    width: 44px;
    height: 44px;
    border-radius: 8px;
    object-fit: cover;
    flex-shrink: 0;
    background: #f5f5f5;
}
.tc-suggest__thumb--empty {
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ccc;
    font-size: 18px;
}

.tc-suggest__info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.tc-suggest__name {
    font-size: 13px;
    font-weight: 500;
    color: #111;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.tc-suggest__prices {
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 6px;
}
.tc-suggest__price {
    font-weight: 600;
    color: #111;
}
.tc-suggest__old-price {
    color: #999;
    text-decoration: line-through;
    font-weight: 400;
}

.tc-suggest__viewall {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 12px 14px;
    font-size: 13px;
    font-weight: 500;
    color: #2563EB;
    text-decoration: none;
    border-top: 1px solid #eee;
    transition: background 0.1s;
}
.tc-suggest__viewall:hover {
    background: #f0f7ff;
}

.tc-suggest__empty {
    padding: 20px 14px;
    text-align: center;
    font-size: 13px;
    color: #888;
}

/* Mobile: dropdown takes full width */
@media (max-width: 1024px) {
    .tc-suggest-dropdown {
        border-radius: 0 0 10px 10px;
        margin-top: 2px;
    }
}

/* ══════════════════════════════════════════════════════════════════════════
   Mega Menu — wide dropdown with 3-level category hierarchy
   ══════════════════════════════════════════════════════════════════════════ */

.tc-mega-parent {
    position: static;              /* dropdown positions relative to .navbar, not this li */
}

.tc-mega-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    padding-top: 0;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.18s ease, visibility 0.18s ease;
    z-index: 1050;
}

.tc-mega-parent:hover > .tc-mega-dropdown,
.tc-mega-dropdown:hover {
    opacity: 1;
    visibility: visible;
}

.tc-mega-dropdown__inner {
    background: #fff;
    border-top: 2px solid #111;
    box-shadow: 0 12px 48px rgba(0,0,0,0.12), 0 2px 6px rgba(0,0,0,0.04);
    padding: 28px 32px 24px;
    max-width: 1200px;
    margin: 0 auto;
}

.tc-mega-dropdown__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 1px solid #f0f0f0;
}

.tc-mega-dropdown__title {
    font-size: 16px;
    font-weight: 700;
    color: #111;
    letter-spacing: -0.3px;
}

.tc-mega-dropdown__viewall {
    font-size: 13px;
    font-weight: 500;
    color: #2563eb;
    text-decoration: none;
    transition: color 0.15s;
}
.tc-mega-dropdown__viewall:hover {
    color: #1d4ed8;
}

/* Multi-column layout for Level 2 groups */
.tc-mega-dropdown__columns {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 8px 32px;
}

/* Each Level 2 category group */
.tc-mega-dropdown__group {
    padding-bottom: 12px;
    break-inside: avoid;
}

/* Level 2 heading (clickable) */
.tc-mega-dropdown__heading {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: #111;
    text-decoration: none;
    padding: 6px 0;
    margin-bottom: 2px;
    border-bottom: 1px solid #f3f4f6;
    transition: color 0.12s;
}
.tc-mega-dropdown__heading:hover {
    color: #2563eb;
}

/* Level 3 links container */
.tc-mega-dropdown__sublinks {
    display: flex;
    flex-direction: column;
    gap: 0;
    padding-top: 4px;
}

/* Level 3 link */
.tc-mega-dropdown__link {
    display: block;
    padding: 5px 0 5px 0;
    font-size: 13px;
    font-weight: 400;
    color: #4b5563;
    text-decoration: none;
    transition: color 0.12s;
    line-height: 1.4;
}
.tc-mega-dropdown__link:hover {
    color: #111;
}

/* Chevron rotation on hover */
.tc-mega-parent:hover > .nav-link .bi-chevron-down {
    transform: rotate(180deg);
    transition: transform 0.2s ease;
}
.tc-mega-parent > .nav-link .bi-chevron-down {
    transition: transform 0.2s ease;
}

/* Hide mega menu on mobile — subcategories show in offcanvas instead */
@media (max-width: 1199px) {
    .tc-mega-dropdown {
        display: none !important;
    }
    .tc-mega-parent > .nav-link .bi-chevron-down {
        display: none;
    }
}
