/**
 * Mobile Menu - Liquid Glass Effect
 * Hiệu ứng glassmorphism cho mobile navigation bar
 */

/* Container cho mobile menu - chỉ hiển thị trên mobile */
.mobile-menu-container {
    position: fixed !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    z-index: 19; /* Giảm z-index để không che sidebar (z-index: 20) */
    display: none;
    padding: 0 env(safe-area-inset-right) 0 env(safe-area-inset-left);
    padding-bottom: env(safe-area-inset-bottom, 0);
    transform: none !important; /* Đảm bảo không bị transform làm lệch */
}

/* Hiển thị mobile menu trên màn hình < 1024px */
@media (max-width: 1023px) {
    .mobile-menu-container {
        display: block;
    }
}

/* Liquid glass wrapper với backdrop blur - Apple Music Style */
.liquid-glass-menu {
    margin: 0 16px;
    margin-bottom: calc(10px + env(safe-area-inset-bottom, 0));
    padding: 8px 6px;
    border-radius: 20px;
    position: relative;
    overflow: hidden;
    
    /* Glassmorphism effect - Trắng đục hơn */
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(40px) saturate(180%) brightness(1.1);
    -webkit-backdrop-filter: blur(40px) saturate(180%) brightness(1.1);
    
    /* Border subtle */
    border: 0.5px solid rgba(0, 0, 0, 0.04);
    
    /* Shadow nhẹ nhàng */
    box-shadow: 
        0 8px 32px 0 rgba(0, 0, 0, 0.12),
        0 1px 2px 0 rgba(0, 0, 0, 0.06),
        inset 0 1px 0 0 rgba(255, 255, 255, 0.7);
}

/* Light mode - Nền sáng đục hơn */
.light .liquid-glass-menu,
[data-kt-theme-mode="light"] .liquid-glass-menu {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(40px) saturate(180%) brightness(1.15);
    -webkit-backdrop-filter: blur(40px) saturate(180%) brightness(1.15);
    border: 0.5px solid rgba(0, 0, 0, 0.06);
    box-shadow: 
        0 8px 32px 0 rgba(0, 0, 0, 0.15),
        0 2px 8px 0 rgba(0, 0, 0, 0.08),
        inset 0 1px 0 0 rgba(255, 255, 255, 0.8);
}

/* Dark mode - Nền tối (giữ tối nhưng mềm hơn) */
.dark .liquid-glass-menu,
[data-kt-theme-mode="dark"] .liquid-glass-menu {
    background: rgba(30, 30, 35, 0.85);
    backdrop-filter: blur(40px) saturate(180%);
    -webkit-backdrop-filter: blur(40px) saturate(180%);
    border: 0.5px solid rgba(255, 255, 255, 0.08);
    box-shadow: 
        0 8px 32px 0 rgba(0, 0, 0, 0.5),
        0 2px 8px 0 rgba(0, 0, 0, 0.3),
        inset 0 1px 0 0 rgba(255, 255, 255, 0.1);
}

/* Animated gradient background overlay - Subtle hơn */
.liquid-glass-menu::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(
        circle at center,
        rgba(255, 45, 85, 0.03) 0%,
        rgba(255, 45, 85, 0.02) 25%,
        transparent 50%
    );
    animation: liquid-pulse 10s ease-in-out infinite;
    pointer-events: none;
}

/* Light mode - Gradient hồng nhạt */
.light .liquid-glass-menu::before,
[data-kt-theme-mode="light"] .liquid-glass-menu::before {
    background: radial-gradient(
        circle at center,
        rgba(255, 45, 85, 0.04) 0%,
        rgba(255, 45, 85, 0.02) 25%,
        transparent 50%
    );
}

@keyframes liquid-pulse {
    0%, 100% {
        transform: translate(0, 0) rotate(0deg);
        opacity: 0.8;
    }
    33% {
        transform: translate(10%, 10%) rotate(120deg);
        opacity: 1;
    }
    66% {
        transform: translate(-10%, 5%) rotate(240deg);
        opacity: 0.9;
    }
}

/* Menu items container */
.mobile-menu-items {
    display: flex;
    justify-content: space-around;
    align-items: center;
    position: relative;
    z-index: 1;
    gap: 4px;
}

/* Individual menu item - Thu nhỏ lại */
.mobile-menu-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    padding: 6px 4px;
    text-decoration: none;
    border-radius: 14px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    min-height: 56px;
}

/* Ripple effect background - màu hồng */
.mobile-menu-item::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 45, 85, 0.15);
    transform: translate(-50%, -50%);
    transition: width 0.4s ease, height 0.4s ease;
}

.mobile-menu-item:active::before {
    width: 100%;
    height: 100%;
}

/* Icon wrapper - Thu nhỏ lại */
.mobile-menu-icon {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    z-index: 1;
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.mobile-menu-icon i {
    font-size: 22px;
    color: rgba(60, 60, 67, 0.6);
    transition: color 0.3s ease;
}

/* Light mode - Icon xám đậm (Apple style) */
.light .mobile-menu-icon i,
[data-kt-theme-mode="light"] .mobile-menu-icon i {
    color: rgba(60, 60, 67, 0.6);
}

/* Dark mode - Icon trắng */
.dark .mobile-menu-icon i,
[data-kt-theme-mode="dark"] .mobile-menu-icon i {
    color: rgba(255, 255, 255, 0.7);
}

/* Text label - Nhỏ hơn */
.mobile-menu-text {
    font-size: 10px;
    font-weight: 500;
    color: rgba(60, 60, 67, 0.6);
    transition: all 0.3s ease;
    position: relative;
    z-index: 1;
    text-align: center;
    line-height: 1.2;
}

/* Light mode - Text xám (Apple style) */
.light .mobile-menu-text,
[data-kt-theme-mode="light"] .mobile-menu-text {
    color: rgba(60, 60, 67, 0.6);
    font-weight: 500;
}

/* Dark mode - Text trắng */
.dark .mobile-menu-text,
[data-kt-theme-mode="dark"] .mobile-menu-text {
    color: rgba(255, 255, 255, 0.7);
    font-weight: 500;
}

/* Hover effect cho desktop (nếu hover được) */
@media (hover: hover) {
    .mobile-menu-item:hover {
        background: rgba(255, 45, 85, 0.08);
    }
    
    .mobile-menu-item:hover .mobile-menu-icon {
        transform: translateY(-2px) scale(1.08);
    }
    
    .mobile-menu-item:hover .mobile-menu-icon i {
        color: #ff2d55;
    }
    
    .mobile-menu-item:hover .mobile-menu-text {
        color: #ff2d55;
    }
}

/* Active state - khi đang ở trang này (Apple Music style) */
.mobile-menu-item.active {
    background: rgba(255, 45, 85, 0.08);
}

.mobile-menu-item.active .mobile-menu-icon {
    transform: scale(1.0);
}

.mobile-menu-item.active .mobile-menu-icon i {
    color: #ff2d55;
    filter: none;
}

.mobile-menu-item.active .mobile-menu-text {
    color: #ff2d55;
    font-weight: 600;
    text-shadow: none;
}

/* Light mode - Active state màu hồng đỏ */
.light .mobile-menu-item.active,
[data-kt-theme-mode="light"] .mobile-menu-item.active {
    background: rgba(255, 45, 85, 0.1);
}

.light .mobile-menu-item.active .mobile-menu-icon i,
[data-kt-theme-mode="light"] .mobile-menu-item.active .mobile-menu-icon i {
    color: #ff2d55;
    filter: none;
}

.light .mobile-menu-item.active .mobile-menu-text,
[data-kt-theme-mode="light"] .mobile-menu-item.active .mobile-menu-text {
    color: #ff2d55;
    font-weight: 600;
}

/* Dark mode - Active state hồng sáng hơn */
.dark .mobile-menu-item.active,
[data-kt-theme-mode="dark"] .mobile-menu-item.active {
    background: rgba(255, 55, 95, 0.12);
}

.dark .mobile-menu-item.active .mobile-menu-icon i,
[data-kt-theme-mode="dark"] .mobile-menu-item.active .mobile-menu-icon i {
    color: #ff375f;
}

.dark .mobile-menu-item.active .mobile-menu-text,
[data-kt-theme-mode="dark"] .mobile-menu-item.active .mobile-menu-text {
    color: #ff375f;
}

/* Active indicator dot - ẩn đi cho clean như Apple */
.mobile-menu-item.active::after {
    content: none;
}

/* Touch feedback */
.mobile-menu-item:active {
    transform: scale(0.95);
}

/* Spacing cho nội dung tránh bị menu che - Tính toán chính xác */
@media (max-width: 1023px) {
    body {
        /* Tăng padding để đảm bảo không bị che */
        padding-bottom: calc(90px + env(safe-area-inset-bottom, 0));
    }
    
    /* Đảm bảo kt-wrapper cũng có đủ khoảng cách */
    .kt-wrapper {
        padding-bottom: calc(90px + env(safe-area-inset-bottom, 0));
    }
    
    /* Main content cũng cần padding */
    main#content {
        padding-bottom: calc(90px + env(safe-area-inset-bottom, 0));
    }
    
    /* Điều chỉnh khi sidebar mở */
    body.kt-drawer-on .mobile-menu-container {
        z-index: 18; /* Thấp hơn sidebar overlay */
    }
}

/* Animation khi load - ĐƠN GIẢN HÓA */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.mobile-menu-container {
    animation: fadeIn 0.3s ease-in-out forwards;
    /* Đảm bảo position luôn cố định */
    animation-fill-mode: both;
}

/* Staggered animation cho từng item */
.mobile-menu-item {
    opacity: 0;
    animation: fadeInUp 0.4s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.mobile-menu-item:nth-child(1) { animation-delay: 0.1s; }
.mobile-menu-item:nth-child(2) { animation-delay: 0.15s; }
.mobile-menu-item:nth-child(3) { animation-delay: 0.2s; }
.mobile-menu-item:nth-child(4) { animation-delay: 0.25s; }

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Responsive cho màn hình rất nhỏ */
@media (max-width: 360px) {
    .mobile-menu-text {
        font-size: 9px;
    }
    
    .mobile-menu-icon i {
        font-size: 20px;
    }
    
    .liquid-glass-menu {
        margin: 0 12px;
        margin-bottom: calc(8px + env(safe-area-inset-bottom, 0));
        padding: 6px 4px;
    }
    
    .mobile-menu-item {
        min-height: 52px;
        padding: 5px 3px;
    }
    
    /* Điều chỉnh padding cho màn hình nhỏ */
    body {
        padding-bottom: calc(85px + env(safe-area-inset-bottom, 0)) !important;
    }
    
    .kt-wrapper {
        padding-bottom: calc(85px + env(safe-area-inset-bottom, 0)) !important;
    }
    
    main#content {
        padding-bottom: calc(85px + env(safe-area-inset-bottom, 0)) !important;
    }
}

/* Sử dụng CSS dynamic viewport units để xử lý browser bar */
@supports (height: 100dvh) {
    @media (max-width: 1023px) {
        .mobile-menu-container {
            /* Sử dụng dynamic viewport height */
            position: fixed;
            bottom: 0;
        }
    }
}

/* Hỗ trợ iOS Safari */
@supports (-webkit-touch-callout: none) {
    .mobile-menu-container {
        /* iOS Safari specific adjustments */
        position: fixed;
        bottom: 0;
        padding-bottom: env(safe-area-inset-bottom);
    }
    
    .liquid-glass-menu {
        margin-bottom: max(10px, env(safe-area-inset-bottom));
    }
}

