/* Mobile Header - App Style Design */

/* Hide original header on mobile - FORCE HIDE */
@media (max-width: 991px) {
    /* Hide desktop header wrapper */
    .desktop-header-only {
        display: none !important;
        visibility: hidden !important;
        opacity: 0 !important;
        height: 0 !important;
        overflow: hidden !important;
        position: absolute !important;
        left: -9999px !important;
    }
    
    /* Hide entire original header */
    header,
    .topbar,
    .navbar,
    .navbar-expand {
        display: none !important;
        visibility: hidden !important;
        opacity: 0 !important;
        height: 0 !important;
        overflow: hidden !important;
        position: absolute !important;
        left: -9999px !important;
    }
    
    /* Specifically hide mobile toggle menu */
    .mobile-toggle-menu {
        display: none !important;
        visibility: hidden !important;
        opacity: 0 !important;
        height: 0 !important;
        width: 0 !important;
        overflow: hidden !important;
        position: absolute !important;
        left: -9999px !important;
        z-index: -1 !important;
    }
    
    /* Hide all header menu elements */
    .top-menu,
    .ms-auto,
    .user-box,
    .dropdown {
        display: none !important;
        visibility: hidden !important;
        opacity: 0 !important;
    }
    
    /* Hide sticky sidebar toggle button */
    .sidebar-toggle {
        display: none !important;
        visibility: hidden !important;
        opacity: 0 !important;
        position: absolute !important;
        left: -9999px !important;
        z-index: -1 !important;
    }
    
    /* Adjust page wrapper for new header */
    .page-wrapper {
        margin-top: 60px !important;
        margin-left: 0 !important;
    }
    
    .wrapper {
        padding-top: 0 !important;
    }
    
    /* Override original mobile menu CSS completely */
    .mobile-toggle-menu {
        display: none !important;
    }
    
    /* Override app.css mobile menu rules */
    .mobile-toggle-menu {
        display: none !important;
        visibility: hidden !important;
        opacity: 0 !important;
        height: 0 !important;
        width: 0 !important;
        overflow: hidden !important;
        position: absolute !important;
        left: -9999px !important;
        z-index: -1 !important;
        pointer-events: none !important;
    }
}

/* Show desktop header on desktop only */
@media (min-width: 992px) {
    .desktop-header-only {
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
        height: auto !important;
        overflow: visible !important;
        position: static !important;
        left: auto !important;
    }
    
    /* Ensure new mobile header is hidden on desktop */
    .new-mobile-header {
        display: none !important;
    }
}

/* New Mobile Header Container */
.new-mobile-header {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    width: 100%;
    height: 60px;
    background: #6366f1;
    z-index: 1000;
    padding: 0 15px;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

/* Show on mobile only */
@media (max-width: 991px) {
    .new-mobile-header {
        display: flex !important;
    }
}

/* Left Section - Menu Icon */
.mobile-header-left {
    display: flex;
    align-items: center;
}

.mobile-menu-btn {
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.15);
    border: none;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.mobile-menu-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: scale(1.05);
}

.mobile-menu-btn i {
    font-size: 20px;
    color: white;
}

/* Center Section - Company Logo Only */
.mobile-header-center {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    justify-content: center;
}

.mobile-company-logo {
    width: 45px;
    height: 45px;
    background: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    color: #4A90E2;
    font-size: 16px;
    box-shadow: 0 3px 12px rgba(0, 0, 0, 0.15);
    overflow: hidden;
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.mobile-logo-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 50%;
    padding: 3px;
}

.mobile-company-name {
    color: white;
    font-size: 14px;
    font-weight: 600;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
    text-align: center;
    margin-top: 2px;
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Right Section - Profile and Action Buttons */
.mobile-header-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.mobile-profile-btn {
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.15);
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    overflow: hidden;
}

.mobile-profile-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: scale(1.05);
}

.mobile-profile-btn i {
    font-size: 20px;
    color: white;
}

.mobile-profile-btn img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

/* Mobile Action Buttons - POS and Sale */
.mobile-action-btn {
    width: 36px;
    height: 36px;
    background: rgba(255, 255, 255, 0.15);
    border: none;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.mobile-action-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: scale(1.05);
}

.mobile-action-btn i {
    font-size: 18px;
    color: white;
}

/* POS Button - Green accent */
.pos-btn:hover {
    background: rgba(76, 175, 80, 0.8);
}

/* Sale Button - Orange accent */
.sale-btn:hover {
    background: rgba(255, 152, 0, 0.8);
}

/* Purchase Button - Blue accent */
.purchase-btn:hover {
    background: rgba(33, 150, 243, 0.8);
}

/* Active state for buttons */
.mobile-action-btn:active {
    transform: scale(0.95);
}

/* Responsive adjustments */
@media (max-width: 480px) {
    .new-mobile-header {
        height: 55px;
        padding: 0 12px;
    }
    
    .page-wrapper {
        margin-top: 55px !important;
    }
    
    .mobile-company-logo {
        width: 40px;
        height: 40px;
        font-size: 14px;
    }
    
    .mobile-profile-btn {
        width: 36px;
        height: 36px;
    }
    
    .mobile-profile-btn i {
        font-size: 18px;
    }
    
    .mobile-menu-btn {
        width: 36px;
        height: 36px;
    }
    
    .mobile-menu-btn i {
        font-size: 18px;
    }
    
    .mobile-action-btn {
        width: 32px;
        height: 32px;
    }
    
    .mobile-action-btn i {
        font-size: 16px;
    }
    
    .mobile-header-right {
        gap: 6px;
    }
}

/* Mobile Sidebar Overlay */
.mobile-sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.mobile-sidebar-overlay.show {
    opacity: 1;
    visibility: visible;
}

/* Mobile Sidebar Adjustments */
@media (max-width: 991px) {
    .sidebar-wrapper {
        left: -300px !important;
        transition: all 0.3s ease;
        z-index: 1001;
    }
    
    .sidebar-wrapper.mobile-show {
        left: 0 !important;
        transform: translateX(0) !important;
    }
}

/* Animation for menu button */
.mobile-menu-btn.active {
    background: rgba(255, 255, 255, 0.3);
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Green background blinking animation */
@keyframes greenBlink {
    0%, 50% { background: rgba(255, 255, 255, 0.15); }
    51%, 100% { background: rgba(76, 175, 80, 0.8); }
}

/* Apply green blinking animation to all mobile header buttons */
.mobile-menu-btn,
.mobile-action-btn,
.mobile-profile-btn {
    animation: greenBlink 2s infinite;
}

/* Different animation delays for variety */
.mobile-menu-btn {
    animation-delay: 0s;
}

.pos-btn {
    animation-delay: 0.2s;
}

.sale-btn {
    animation-delay: 0.4s;
}

.purchase-btn {
    animation-delay: 0.6s;
}

.mobile-profile-btn {
    animation-delay: 0.8s;
}

/* Status bar spacing for iOS */
@supports (padding-top: env(safe-area-inset-top)) {
    .new-mobile-header {
        padding-top: env(safe-area-inset-top);
        height: calc(60px + env(safe-area-inset-top));
    }
    
    @media (max-width: 991px) {
        .page-wrapper {
            margin-top: calc(60px + env(safe-area-inset-top)) !important;
        }
    }
}
