html {
    font-size: 14px;
}

@media (min-width: 768px) {
    html {
        font-size: 16px;
    }
}

.btn:focus,
.btn:active:focus,
.btn-link.nav-link:focus,
.form-control:focus,
.form-check-input:focus {
    box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
}

html {
    position: relative;
    min-height: 100%;
}

/* --- Mobile Menu Toggler --- */
.custom-mobile-toggler {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    border: none;
    border-radius: 50%;
    /* Rounded Circle */
    padding: 0;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    z-index: 1060;
    position: relative;
    margin-right: 15px;
    flex-shrink: 0;
}

.custom-mobile-toggler:hover {
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
}

.custom-mobile-toggler:focus {
    box-shadow: 0 0 0 4px rgba(var(--primary-rgb), 0.3);
    outline: none;
}

.custom-mobile-toggler .navbar-toggler-icon {
    background-image: none !important;
    display: flex;
    align-items: center;
    justify-content: center;
    width: auto;
    height: auto;
    margin: 0;
}

.custom-mobile-toggler i {
    color: #fff;
    font-size: 1.6rem;
    line-height: 1;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

/* --- Mobile Offcanvas Menu (Premium Design) --- */
@media (max-width: 991px) {
    #offcanvasNavbar {
        width: 85%;
        max-width: 360px;
        border: none;
        border-top-left-radius: 25px;
        border-bottom-left-radius: 25px;
        box-shadow: -10px 0 40px rgba(0, 0, 0, 0.2);
        background-color: #f4f6f9;
        /* Contrast background */
    }

    /* Header */
    .offcanvas-header {
        background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
        padding: 25px;
        color: #fff;
        box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    }

    .offcanvas-title {
        font-weight: 800;
        font-size: 1.4rem;
        letter-spacing: 0.5px;
        text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    }

    /* Close Button */
    .offcanvas-header .btn-close {
        background: rgba(255, 255, 255, 0.2);
        backdrop-filter: blur(5px);
        width: 38px;
        height: 38px;
        border-radius: 50%;
        opacity: 1;
        transition: all 0.3s ease;
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 0;
        border: 1px solid rgba(255, 255, 255, 0.3);
    }

    .offcanvas-header .btn-close:hover {
        background: rgba(255, 255, 255, 0.35);
        transform: rotate(90deg);
        box-shadow: 0 0 10px rgba(255, 255, 255, 0.3);
    }

    .offcanvas-header .btn-close::before {
        content: "\eb99";
        /* RemixIcon Close Line */
        font-family: 'remixicon';
        font-size: 1.4rem;
        color: #fff;
    }

    /* Body */
    .offcanvas-body {
        padding: 20px;
        overflow-y: auto;
        scrollbar-width: thin;
        scrollbar-color: rgba(0, 0, 0, 0.1) transparent;
    }

    /* Nav Links (Cards) */
    .offcanvas-body .nav-item {
        margin-bottom: 12px;
    }

    .offcanvas-body .nav-link {
        background: #fff;
        border-radius: 15px;
        /* Softer corners */
        padding: 18px 20px;
        color: #444 !important;
        font-weight: 700;
        font-size: 1.05rem;
        box-shadow: 0 4px 10px rgba(0, 0, 0, 0.03);
        /* Softer shadow */
        border: 1px solid transparent;
        transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
        display: flex;
        align-items: center;
        justify-content: space-between;
        position: relative;
        overflow: hidden;
    }

    .offcanvas-body .nav-link:hover,
    .offcanvas-body .nav-link:active,
    .offcanvas-body .nav-link.active {
        transform: translateY(-2px);
        box-shadow: 0 8px 20px rgba(0, 0, 0, 0.08);
        color: var(--primary-color) !important;
    }

    /* Left Border Indicator */
    .offcanvas-body .nav-link.active::before {
        content: '';
        position: absolute;
        left: 0;
        top: 0;
        bottom: 0;
        width: 6px;
        background: var(--primary-color);
    }

    /* Dropdown Arrow */
    .offcanvas-body .dropdown-toggle::after {
        font-size: 1.1em;
        margin-left: auto;
        transition: transform 0.3s;
        opacity: 0.4;
        border: none;
        content: "\ea4e";
        /* RemixIcon arrow down */
        font-family: 'remixicon';
        vertical-align: middle;
    }

    .offcanvas-body .nav-link:hover .dropdown-toggle::after {
        opacity: 0.8;
        color: var(--primary-color);
    }

    .offcanvas-body .nav-link[aria-expanded="true"].dropdown-toggle::after {
        transform: rotate(180deg);
        color: var(--primary-color);
        opacity: 1;
    }

    /* Dropdown Menu (Clean Inset) */
    .offcanvas-body .dropdown-menu {
        border: none;
        background: transparent;
        margin-top: 5px;
        padding: 5px 0 5px 15px;
        /* Indent content */
        box-shadow: none;
        position: static !important;
        /* Force static flow */
        transform: none !important;
        width: 100%;
    }

    /* Separate Cards for Dropdown Items */
    .offcanvas-body .dropdown-item {
        background: transparent;
        /* Transparent to blend */
        margin-bottom: 4px;
        border-radius: 10px;
        padding: 12px 15px;
        font-weight: 500;
        color: #666;
        border: none;
        transition: all 0.2s;
        position: relative;
        white-space: normal;
        line-height: 1.4;
        display: flex;
        align-items: center;
    }

    .offcanvas-body .dropdown-item::before {
        content: '';
        display: inline-block;
        width: 6px;
        height: 6px;
        border-radius: 50%;
        background-color: #ddd;
        margin-right: 10px;
        transition: background-color 0.2s;
    }

    .offcanvas-body .dropdown-item:hover {
        background: rgba(255, 255, 255, 0.5);
        color: var(--primary-color);
        padding-left: 20px;
        transform: none;
    }

    .offcanvas-body .dropdown-item:hover::before {
        background-color: var(--primary-color);
    }

    .offcanvas-body .dropdown-item:active {
        background: rgba(255, 255, 255, 0.8);
    }
}

/* --- Force Hide Legacy Mobile Menu (Prevention) --- */
.mobile-menu,
.mobile-cart {
    display: none !important;
}

/* --- Mobile App Footer (Premium Glass Design) --- */
@media (max-width: 767px) {
    body {
        padding-bottom: 110px !important;
    }

    .mobile-app-footer {
        position: fixed;
        bottom: calc(12px + env(safe-area-inset-bottom));
        left: 10px;
        right: 10px;
        z-index: 1050;
        background: rgba(255, 255, 255, 0.92);
        backdrop-filter: blur(18px);
        -webkit-backdrop-filter: blur(18px);
        border-radius: 24px;
        box-shadow: 0 18px 40px rgba(15, 23, 42, 0.14);
        border: 1px solid rgba(255, 255, 255, 0.75);
        padding: 8px 6px calc(8px + env(safe-area-inset-bottom));
    }

    .mobile-nav-container {
        display: grid;
        grid-template-columns: repeat(5, minmax(0, 1fr));
        align-items: end;
        gap: 2px;
    }

    .mobile-nav-item {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 4px;
        text-decoration: none;
        color: #888;
        position: relative;
        transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        min-width: 0;
        padding: 2px 0 0;
    }

    .mobile-nav-item .icon-wrapper {
        width: 38px;
        height: 38px;
        border-radius: 12px;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 18px;
        transition: all 0.25s ease;
        position: relative;
        z-index: 2;
        background: rgba(255, 255, 255, 0.18);
        color: var(--secondary-color);
    }

    .mobile-nav-item .icon-wrapper i {
        background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
        -webkit-background-clip: text;
        -webkit-text-fill-color: transparent;
        background-clip: text;
        transition: all 0.3s ease;
    }

    .mobile-nav-item .nav-label {
        font-size: 8px;
        font-weight: 700;
        transition: all 0.25s ease;
        line-height: 1.1;
        min-height: 2.2em;
        display: flex;
        align-items: flex-start;
        justify-content: center;
        text-align: center;
        max-width: 100%;
        padding: 0 1px;
        overflow-wrap: normal;
        word-break: normal;
        hyphens: none;
        letter-spacing: -0.01em;
        background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
        -webkit-background-clip: text;
        -webkit-text-fill-color: transparent;
        background-clip: text;
        color: transparent;
    }

    .mobile-nav-item.active .icon-wrapper,
    .mobile-nav-item:hover .icon-wrapper {
        background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
        transform: translateY(-3px);
        box-shadow: 0 5px 15px rgba(var(--primary-color-rgb), 0.3);
    }

    .mobile-nav-item.active .icon-wrapper i,
    .mobile-nav-item:hover .icon-wrapper i {
        background: none;
        -webkit-text-fill-color: #fff;
        color: #fff;
    }

    .mobile-nav-item.active .nav-label,
    .mobile-nav-item:hover .nav-label {
        font-weight: 700;
        opacity: 1;
    }

    .mobile-nav-item.active::after {
        content: '';
        position: absolute;
        bottom: -2px;
        width: 4px;
        height: 4px;
        background: var(--primary-color);
        border-radius: 50%;
        opacity: 1;
    }

    .mobile-nav-item-primary {
        transform: translateY(-12px);
        gap: 0;
    }

    .mobile-nav-item-primary .icon-wrapper {
        width: 54px;
        height: 54px;
        border-radius: 20px;
        background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
        border: 3px solid rgba(255, 255, 255, 0.95);
        box-shadow: 0 14px 30px rgba(var(--primary-color-rgb), 0.34);
        overflow: visible;
    }

    .mobile-nav-item-primary .icon-wrapper::before {
        content: '';
        position: absolute;
        inset: -6px;
        border-radius: 24px;
        background: radial-gradient(circle, rgba(var(--primary-color-rgb), 0.22) 0%, rgba(var(--primary-color-rgb), 0) 72%);
        z-index: -1;
    }

    .mobile-nav-item-primary .icon-wrapper i,
    .mobile-nav-item-primary.active .icon-wrapper i,
    .mobile-nav-item-primary:hover .icon-wrapper i {
        background: none;
        -webkit-text-fill-color: #fff;
        color: #fff;
        font-size: 21px;
        transform: translateY(1px);
    }

    .mobile-nav-item-primary.active::after,
    .mobile-nav-item-primary:hover::after {
        display: none;
    }

    .mobile-nav-item-primary.active .icon-wrapper,
    .mobile-nav-item-primary:hover .icon-wrapper {
        transform: translateY(-2px) scale(1.04);
    }
}

@media (max-width: 374px) {
    body {
        padding-bottom: 104px !important;
    }

    .mobile-app-footer {
        left: 8px;
        right: 8px;
        border-radius: 22px;
        padding-left: 4px;
        padding-right: 4px;
    }

    .mobile-nav-item .icon-wrapper {
        width: 34px;
        height: 34px;
        font-size: 16px;
    }

    .mobile-nav-item-primary .icon-wrapper {
        width: 48px;
        height: 48px;
        border-radius: 18px;
    }

    .mobile-nav-item-primary .icon-wrapper i,
    .mobile-nav-item-primary.active .icon-wrapper i,
    .mobile-nav-item-primary:hover .icon-wrapper i {
        font-size: 19px;
    }

    .mobile-nav-item .nav-label {
        font-size: 7.25px;
        line-height: 1.05;
    }
}
