/* ============================================================
   Global Header + Page Title Compact Modern Overrides
   Loaded site-wide after style.css / mobile-app.css so these
   rules win the cascade. No logic/functionality changes.
   ============================================================ */

/* ============================================================
   NAVBAR - smart compact (desktop & tablet; mobile header is
   already handled by mobile-app.css)
   ============================================================ */
@media (min-width: 577px) {

    /* --- Top bar --- */
    .header-top {
        padding: 7px 0;
        font-size: 12.5px;
    }

    .header-top-left {
        gap: 14px;
    }

    .header-top-right {
        gap: 10px;
    }

    .header-top-right a,
    .header-top-right button {
        gap: 5px;
        font-size: 12.5px;
    }

    .header-top .btn-login,
    .header-top .btn-register,
    .header-top .btn-logout {
        padding: 6px 14px;
        font-size: 12px;
        border-radius: 999px;
    }

    .header-top .auth-user-name {
        font-size: 12.5px;
    }

    .header-top .auth-user-avatar,
    .header-top .auth-user-avatar img {
        width: 24px;
        height: 24px;
    }

    .header-top .auth-avatar-initial {
        font-size: 11px;
    }

    /* --- Main header row --- */
    .header-main {
        padding: 13px 0;
    }

    .header-main .container {
        gap: 18px;
    }

    .logo {
        gap: 10px;
    }

    .logo-img,
    .logo-image {
        max-height: 44px;
    }

    .logo-icon {
        font-size: 22px;
    }

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

    .logo-slogan {
        font-size: 11px !important;
    }

    /* --- Search bar --- */
    .search-bar {
        max-width: 460px;
    }

    .search-bar form {
        border-width: 1px;
        border-radius: 999px;
        overflow: visible;
    }

    .search-input {
        padding: 11px 16px;
        font-size: 14px;
        border-radius: 999px 0 0 999px;
    }

    .search-btn {
        padding: 11px 20px;
        font-size: 14px;
        border-radius: 0 999px 999px 0;
    }

    /* --- Header action icons --- */
    .header-actions {
        gap: 10px;
    }

    .header-action {
        width: 42px;
        height: 42px;
        font-size: 16px;
    }

    .header-action i {
        font-size: 16px;
    }

    .action-badge {
        top: -5px;
        right: -5px;
        min-width: 17px;
        height: 17px;
        font-size: 10px;
        padding: 0 5px;
    }

    /* --- Nav bar --- */
    .nav-main .container {
        gap: 22px;
    }

    .nav-menu {
        gap: 2px;
    }

    .nav-menu a {
        padding: 12px 15px;
        font-size: 14.5px;
        border-radius: 8px;
    }

    .nav-categories-btn {
        padding: 11px 18px;
        font-size: 14px;
        gap: 10px;
        border-radius: 8px;
    }

    .nav-categories-dropdown {
        border-radius: 10px;
    }

    .nav-categories-dropdown a {
        padding: 10px 16px;
        font-size: 13px;
        gap: 10px;
    }

    .nav-categories-dropdown a i {
        width: 18px;
        font-size: 13px;
    }

    /* --- Category hover submenus --- */
    .nav-categories-dropdown .category-item {
        position: relative;
        display: block;
        width: 100%;
    }

    .nav-categories-dropdown .category-item > .category-link {
        justify-content: space-between;
        width: 100%;
    }

    .nav-categories-dropdown .submenu-arrow {
        margin-left: auto;
        font-size: 11px;
        opacity: 0.7;
    }

    .nav-categories-dropdown .category-submenu {
        position: absolute;
        top: -6px;
        left: calc(100% - 2px);
        min-width: 220px;
        max-width: 320px;
        max-height: 70vh;
        overflow-y: auto;
        background: var(--white, #ffffff);
        border-radius: var(--radius, 10px);
        box-shadow: var(--shadow-lg, 0 10px 30px rgba(0,0,0,0.15));
        opacity: 0;
        visibility: hidden;
        transform: translateX(10px);
        transition: var(--transition, all 0.3s ease);
        z-index: 101;
        padding: 6px 0;
    }

    .nav-categories-dropdown .category-item:hover > .category-submenu,
    .nav-categories-dropdown .category-submenu:hover {
        opacity: 1;
        visibility: visible;
        transform: translateX(0);
    }

    .nav-categories-dropdown .category-submenu a {
        padding: 9px 16px;
        font-size: 12.5px;
        gap: 10px;
        border-bottom: 1px solid var(--gray-100, #f8f9fa);
    }

    .nav-categories-dropdown .category-submenu a:last-child {
        border-bottom: none;
    }

    .nav-categories-dropdown .category-submenu .submenu-all {
        background: var(--gray-100, #f8f9fa);
        color: var(--primary, #7d3cff);
        font-weight: 600;
    }

    .nav-categories-dropdown .category-submenu .submenu-all:hover {
        background: var(--primary, #7d3cff);
        color: var(--white, #ffffff);
    }

    .nav-categories-dropdown .category-submenu a .subcat-thumb {
        width: 26px;
        height: 26px;
        border-radius: 50%;
        overflow: hidden;
        flex-shrink: 0;
        display: flex;
        align-items: center;
        justify-content: center;
        background: var(--gray-100, #f8f9fa);
        border: 1px solid var(--gray-200, #e9ecef);
    }

    .nav-categories-dropdown .category-submenu a .subcat-thumb img {
        width: 100%;
        height: 100%;
        object-fit: cover;
        display: block;
    }

    .nav-categories-dropdown .category-submenu a .subcat-thumb-placeholder i {
        font-size: 11px;
        color: var(--primary, #7d3cff);
    }
}

/* ============================================================
   PAGE TITLE / BANNER SECTION - compact on every page
   ============================================================ */
.page-banner {
    padding: 34px 0;
}

.page-banner.has-image {
    padding: 34px 0;
}

.page-banner h1 {
    font-size: 24px;
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
}

.page-banner h1 i {
    font-size: 20px;
}

.page-banner p {
    font-size: 13.5px;
    margin-bottom: 6px;
    opacity: 0.9;
}

.page-banner .breadcrumbs,
.breadcrumbs {
    font-size: 12px;
    gap: 6px;
    margin-top: 4px;
}

/* Small banner variant */
.page-banner-sm {
    padding: 22px 0;
}

.page-banner-sm h1 {
    font-size: 20px;
    gap: 8px;
}

.page-banner-sm h1 i {
    font-size: 17px;
}

.page-banner-sm .breadcrumbs {
    font-size: 11.5px;
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .page-banner,
    .page-banner.has-image {
        padding: 24px 0;
    }

    .page-banner h1 {
        font-size: 20px;
    }

    .page-banner h1 i {
        font-size: 17px;
    }

    .page-banner p {
        font-size: 12.5px;
    }

    .page-banner-sm {
        padding: 18px 0;
    }

    .page-banner-sm h1 {
        font-size: 18px;
    }
}

@media (max-width: 576px) {
    .page-banner,
    .page-banner.has-image {
        padding: 18px 0;
    }

    .page-banner h1 {
        font-size: 17px;
        gap: 7px;
    }

    .page-banner h1 i {
        font-size: 15px;
    }

    .page-banner p {
        font-size: 12px;
    }

    .page-banner .breadcrumbs,
    .breadcrumbs {
        font-size: 11px;
    }

    .page-banner-sm {
        padding: 14px 0;
    }

    .page-banner-sm h1 {
        font-size: 16px;
    }
}

/* ============================================================
   SUGGESTED / RELATED PRODUCT CARDS - 4 fixed zones (all screens)
   Applies to related-products, products-grid-4 and wishlist grids
   on every page: 1) image  2) name  3) price  4) bottom button
   ============================================================ */
.related-products-grid,
.products-grid-4,
.wishlist-grid {
    align-items: stretch;
}

.related-products-grid .product-card,
.products-grid-4 .product-card,
.wishlist-grid .product-card {
    height: auto !important;
    min-height: 0;
    display: flex !important;
    flex-direction: column !important;
}

.related-products-grid .product-card .product-image,
.products-grid-4 .product-card .product-image,
.wishlist-grid .product-card .product-image {
    flex: none !important;
    height: 160px !important;
    min-height: 160px !important;
    max-height: 160px !important;
    width: 100%;
    padding: 0 !important;
    overflow: hidden !important;
}

.related-products-grid .product-card .product-image img,
.related-products-grid .product-card .product-image video,
.related-products-grid .product-card .product-image .no-image,
.products-grid-4 .product-card .product-image img,
.products-grid-4 .product-card .product-image video,
.products-grid-4 .product-card .product-image .no-image,
.wishlist-grid .product-card .product-image img,
.wishlist-grid .product-card .product-image video,
.wishlist-grid .product-card .product-image .no-image {
    display: block !important;
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
}

.related-products-grid .product-card .product-info,
.products-grid-4 .product-card .product-info,
.wishlist-grid .product-card .product-info {
    flex: 1 1 auto !important;
    height: auto !important;
    display: flex !important;
    flex-direction: column !important;
}

.related-products-grid .product-card .product-category,
.products-grid-4 .product-card .product-category,
.wishlist-grid .product-card .product-category {
    display: none !important;
}

.related-products-grid .product-card .product-title,
.products-grid-4 .product-card .product-title,
.wishlist-grid .product-card .product-title {
    min-height: 34px !important;
    max-height: 34px !important;
    margin-bottom: 4px !important;
    display: -webkit-box !important;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden !important;
}

.related-products-grid .product-card .product-price,
.products-grid-4 .product-card .product-price,
.wishlist-grid .product-card .product-price {
    min-height: 20px;
    margin-bottom: 6px !important;
}

.related-products-grid .product-card .btn-add-cart,
.related-products-grid .product-card .btn-out-of-stock,
.products-grid-4 .product-card .btn-add-cart,
.products-grid-4 .product-card .btn-out-of-stock,
.wishlist-grid .product-card .btn-add-cart,
.wishlist-grid .product-card .btn-out-of-stock {
    margin-top: auto !important;
    margin-bottom: 0 !important;
}

/* ============================================================
   UNIVERSAL PRODUCT CARD - 4 fixed zones on small screens
   Applies site-wide to every grid/slider of product cards
   (suggested, related, wishlist, cross-sell, up-sell):
   1) image (fixed)  2) name (2-line slot)  3) price (fixed)
   4) Add to Cart button (pinned to card bottom)
   ============================================================ */
@media (max-width: 768px) {
    .products-grid,
    .products-grid-4,
    .related-products-grid,
    .wishlist-grid {
        align-items: stretch;
    }

    .product-card {
        height: 100% !important;
        min-height: 0;
        display: flex !important;
        flex-direction: column !important;
    }

    /* Zone 1 - image: identical box on every card */
    .product-card .product-image,
    .related-products-grid .product-card .product-image,
    .products-grid-4 .product-card .product-image,
    .wishlist-grid .product-card .product-image {
        flex: none !important;
        height: 150px !important;
        min-height: 150px !important;
        max-height: 150px !important;
        width: 100%;
        padding: 0 !important;
        overflow: hidden !important;
    }

    .product-card .product-image img,
    .product-card .product-image video,
    .product-card .product-image .no-image {
        display: block !important;
        width: 100% !important;
        height: 100% !important;
        object-fit: cover !important;
    }

    .product-card .product-info {
        flex: 1 1 auto !important;
        height: auto !important;
        display: flex !important;
        flex-direction: column !important;
    }

    /* Hide optional category label so cards without it stay aligned */
    .product-card .product-category {
        display: none !important;
    }

    /* Zone 2 - product name: always reserves 2 lines */
    .product-card .product-title {
        min-height: 34px !important;
        max-height: 34px !important;
        margin-bottom: 4px !important;
        display: -webkit-box !important;
        -webkit-line-clamp: 2;
        line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden !important;
    }

    /* Zone 3 - price: fixed slot */
    .product-card .product-price {
        min-height: 20px;
        margin-bottom: 6px !important;
    }

    /* Zone 4 - button: pinned to the bottom of every card */
    .product-card .btn-add-cart,
    .product-card .btn-out-of-stock {
        margin-top: auto !important;
        margin-bottom: 0 !important;
    }

    /* Horizontal auto-sliders keep their smaller image */
    .product-auto-slider .product-card .product-image,
    .mobile-related-slider .product-card .product-image {
        height: 130px !important;
        min-height: 130px !important;
        max-height: 130px !important;
    }
}

@media (max-width: 400px) {
    .product-card .product-image {
        height: 132px !important;
        min-height: 132px !important;
        max-height: 132px !important;
    }

    .product-auto-slider .product-card .product-image,
    .mobile-related-slider .product-card .product-image {
        height: 120px !important;
        min-height: 120px !important;
        max-height: 120px !important;
    }
}

/* ============================================================
   MOBILE SIDEBAR GUEST AUTH BUTTONS - compact modern (<=576px)
   Login / Sign Up buttons inside the floating mobile drawer
   ============================================================ */
@media (max-width: 576px) {
    .mob-sidebar-auth {
        padding: 10px 12px;
    }

    .mob-sidebar-auth p {
        font-size: 11px;
        margin-bottom: 7px;
        line-height: 1.35;
    }

    .mob-auth-btns {
        gap: 6px;
    }

    .mob-auth-login,
    .mob-auth-register {
        padding: 7px 10px;
        font-size: 11px;
        border-radius: 999px;
        gap: 5px;
        letter-spacing: 0.2px;
    }

    .mob-auth-login {
        background: linear-gradient(135deg, #7d3cff 0%, #f857a6 100%);
        box-shadow: 0 3px 10px rgba(125, 60, 255, 0.3);
        border: none;
    }

    .mob-auth-login:active {
        transform: scale(0.97);
        box-shadow: 0 2px 6px rgba(125, 60, 255, 0.35);
    }

    .mob-auth-register {
        background: transparent;
        border: 1.5px solid rgba(125, 60, 255, 0.35);
        box-shadow: none;
    }

    .mob-auth-register:active {
        background: rgba(125, 60, 255, 0.08);
        transform: scale(0.97);
    }

    .mob-auth-login i,
    .mob-auth-register i {
        font-size: 10px;
    }
}
