/**
 * Salam Prints - Professional Mega Menu CSS
 * Modern mega menu with comprehensive product organization
 */

/* Body padding for fixed header */
body {
    padding-top: 0px;
}

/* Mega Menu Navigation */
.mega-menu-nav {
    background: linear-gradient(135deg, #f8af3c 0%, #d35400 100%) !important;
    border-bottom: none !important;
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    z-index: 99999 !important;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1) !important;
    width: 100% !important;
    overflow: visible !important;
    height: auto !important;
    min-height: 70px !important;
}

.mega-menu-container {
    max-width: 1200px !important;
    margin: 0 auto !important;
    padding: 0 1.5rem !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    height: 70px !important;
    width: 100% !important;
    box-sizing: border-box !important;
    position: relative !important;
    z-index: 99998 !important;
    overflow: visible !important;
    min-height: 70px !important;
    color: #ffffff !important;
}

/* Logo Section */
.mega-menu-logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.5rem;
    font-weight: 700;
    color: #ffffff;
    text-decoration: none;
    flex-shrink: 0;
    min-width: fit-content;
}

.mega-menu-logo .logo-img {
    width: 50px;
    height: 50px;
    object-fit: contain;
}

/* Mobile Menu Toggle */
.mobile-menu-toggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    width: 40px;
    height: 40px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    z-index: 100000;
}

.hamburger-line {
    width: 24px;
    height: 2px;
    background: rgba(255, 255, 255, 0.85);
    margin: 3px 0;
    transition: all 0.3s ease;
    border-radius: 1px;
}

.mobile-menu-toggle.active .hamburger-line:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.mobile-menu-toggle.active .hamburger-line:nth-child(2) {
    opacity: 0;
}

.mobile-menu-toggle.active .hamburger-line:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -6px);
}

/* Main Navigation */
.mega-menu-main {
    flex: 1;
    display: flex;
    justify-content: center;
    overflow: visible;
    max-width: 800px;
    margin: 0 auto;
    position: relative;
    z-index: 99997;
}

.mega-menu-list {
    display: flex;
    list-style: none;
    gap: 0.25rem;
    margin: 0;
    padding: 0;
    flex-wrap: nowrap;
    overflow-x: auto;
    /* Hide scrollbar for IE/Edge */
    -ms-overflow-style: none;
    align-items: center;
}

/* Hide scrollbar for Safari/Chrome (WebKit) */
.mega-menu-list::-webkit-scrollbar {
    display: none;
}

/* Hide scrollbar for Firefox - only apply where supported */
@supports (scrollbar-width: none) {
    .mega-menu-list {
        scrollbar-width: none;
    }
}

.mega-menu-item {
    position: relative;
    flex-shrink: 0;
}

.mega-menu-item.mega-dropdown {
    position: relative;
}

/* Mega Menu Links */
.mega-menu-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 0.85rem;
    color: rgba(255, 255, 255, 0.85);
    font-weight: 500;
    border-radius: 10px;
    transition: all 0.25s ease;
    text-decoration: none;
    white-space: nowrap;
    font-size: 14px;
    min-width: fit-content;
    position: relative;
    background: transparent;
    border: none;
    letter-spacing: 0.01em;
}

.mega-menu-link i {
    font-size: 16px;
    width: 20px;
    text-align: center;
    transition: all 0.3s ease;
    color: inherit;
}

.mega-menu-link i.fa-chevron-down {
    font-size: 12px;
    transition: transform 0.3s ease;
    margin-left: 4px;
}

.mega-menu-link:hover {
    background: rgba(255, 255, 255, 0.18);
    color: #ffffff;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.12);
}

.mega-menu-link.active {
    background: rgba(255, 255, 255, 0.24);
    color: #ffffff;
    font-weight: 600;
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.16);
}

.mega-menu-item.mega-dropdown:hover .mega-menu-link i.fa-chevron-down {
    transform: rotate(180deg);
    color: #ffffff;
}

.mega-menu-item.mega-dropdown.active .mega-menu-link i.fa-chevron-down {
    transform: rotate(180deg);
    color: #ffffff;
}

/* Mega Dropdown Content */
.mega-dropdown-content {
    position: fixed !important;
    top: 78px !important; /* Position below the fixed header */
    left: 50% !important;
    transform: translateX(-50%) translateY(-10px) !important;
    background: #ffffff !important;
    border: 1px solid #e5e7eb !important;
    border-radius: 12px !important;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15), 
                0 8px 16px rgba(0, 0, 0, 0.1) !important;
    min-width: 800px !important;
    max-width: 1000px !important;
    width: max-content !important;
    display: none !important;
    z-index: 100000 !important;
    overflow: visible !important;
    opacity: 0 !important;
    visibility: hidden !important;
    transition: all 0.2s ease !important;
    pointer-events: none !important;
    padding: 0 !important;
    margin: 0 !important;
}

.mega-dropdown-content::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #f59e0b 0%, #d97706 50%, #b45309 100%);
    border-radius: 16px 16px 0 0;
    box-shadow: 0 2px 4px rgba(217, 119, 6, 0.2);
}

.mega-dropdown-content.show {
    opacity: 1 !important;
    visibility: visible !important;
    transform: translateX(-50%) translateY(0) !important;
    pointer-events: auto !important;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.2), 
                0 12px 24px rgba(0, 0, 0, 0.15) !important;
    z-index: 100000 !important;
    display: block !important;
}

/* Mega Dropdown Grid */
.mega-dropdown-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0;
    padding: 2rem;
}

.mega-dropdown-section {
    padding: 0 1rem;
    border-right: 1px solid rgba(217, 119, 6, 0.12);
}

.mega-dropdown-section:last-child {
    border-right: none;
}

.mega-section-title {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 16px;
    font-weight: 600;
    color: #b45309;
    margin-bottom: 1.5rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid rgba(217, 119, 6, 0.18);
}

.mega-section-title i {
    font-size: 18px;
    color: #d97706;
    width: 24px;
    text-align: center;
}

.mega-section-links {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.mega-link {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem;
    color: #374151;
    text-decoration: none;
    font-weight: 500;
    font-size: 14px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 10px;
    position: relative;
    border-left: 3px solid transparent;
}

.mega-link:hover {
    background: linear-gradient(90deg, rgba(255, 247, 237, 0.9) 0%, rgba(254, 243, 199, 0.9) 100%);
    color: #b45309;
    border-left-color: #f59e0b;
    transform: translateX(4px);
    box-shadow: 0 6px 14px rgba(217, 119, 6, 0.15);
}

.mega-link i {
    font-size: 18px;
    width: 24px;
    text-align: center;
    color: #d97706;
    transition: all 0.3s ease;
}

.mega-link:hover i {
    color: #b45309;
    transform: scale(1.1);
}

.mega-link div {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.mega-link-title {
    font-weight: 600;
    color: #1f2937;
    font-size: 14px;
}

.mega-link-desc {
    font-size: 12px;
    color: #6b7280;
    line-height: 1.4;
}

/* Mega Menu Footer */
.mega-dropdown-footer {
    background: linear-gradient(135deg, #fff7ed 0%, #fef3c7 100%);
    border-top: 1px solid rgba(217, 119, 6, 0.18);
    padding: 1.5rem 2rem;
    border-radius: 0 0 16px 16px;
}

.mega-footer-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
}

.mega-footer-content h4 {
    font-size: 16px;
    font-weight: 600;
    color: #b45309;
    margin: 0 0 0.5rem 0;
}

.mega-footer-content p {
    font-size: 14px;
    color: #6b7280;
    margin: 0;
    line-height: 1.4;
}

.mega-footer-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: #ffffff;
    text-decoration: none;
    border-radius: 10px;
    font-weight: 600;
    font-size: 14px;
    transition: all 0.3s ease;
    white-space: nowrap;
    box-shadow: 0 6px 14px rgba(245, 158, 11, 0.35);
}

.mega-footer-btn:hover {
    background: linear-gradient(135deg, #f97316 0%, #c2410c 100%);
    transform: translateY(-2px);
    box-shadow: 0 8px 18px rgba(249, 115, 22, 0.4);
}

/* Header Actions */
.mega-menu-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-shrink: 0;
}

/* Button Styles */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-weight: 500;
    font-size: 14px;
    text-decoration: none;
    transition: all 0.2s ease;
    border: 1px solid transparent;
    cursor: pointer;
}

.btn-outline {
    background-color: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.5);
    color: #ffffff;
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
}

.btn-outline:hover {
    background-color: rgba(255, 255, 255, 0.2);
    color: #ffffff;
}

.btn-primary {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: #ffffff;
    border: none;
    box-shadow: 0 8px 16px rgba(245, 158, 11, 0.35);
}

.btn-primary:hover {
    background: linear-gradient(135deg, #f97316 0%, #c2410c 100%);
    box-shadow: 0 10px 22px rgba(249, 115, 22, 0.45);
}

.user-menu {
    position: relative;
}

.user-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.55rem 1.1rem;
    background-color: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.45);
    border-radius: 10px;
    color: #ffffff;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
}

.user-btn:hover {
    background-color: rgba(255, 255, 255, 0.2);
    color: #ffffff;
}

.user-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: #ffffff;
    border: 1px solid rgba(217, 119, 6, 0.18);
    border-radius: 12px;
    box-shadow: 0 20px 40px rgba(217, 119, 6, 0.15);
    min-width: 200px;
    display: none;
    z-index: 99999;
    overflow: hidden;
}

.user-dropdown a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    color: #374151;
    text-decoration: none;
    font-weight: 500;
    font-size: 14px;
    transition: all 0.3s ease;
    border-left: 3px solid transparent;
}

.user-dropdown a:hover {
    background: linear-gradient(90deg, rgba(255, 247, 237, 0.9) 0%, rgba(254, 243, 199, 0.9) 100%);
    color: #b45309;
    border-left-color: #f59e0b;
}

.user-dropdown hr {
    border: none;
    height: 1px;
    background: rgba(217, 119, 6, 0.15);
    margin: 0.5rem 0;
}

.cart-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.55rem 1.1rem;
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: #ffffff;
    text-decoration: none;
    border-radius: 10px;
    font-weight: 500;
    transition: all 0.3s ease;
    position: relative;
    box-shadow: 0 8px 16px rgba(245, 158, 11, 0.3);
}

.cart-btn:hover {
    background: linear-gradient(135deg, #f97316 0%, #c2410c 100%);
    box-shadow: 0 10px 22px rgba(249, 115, 22, 0.4);
}

.cart-count {
    background: #ef4444;
    color: #ffffff;
    font-size: 12px;
    font-weight: 600;
    padding: 0.25rem 0.5rem;
    border-radius: 12px;
    min-width: 20px;
    text-align: center;
    line-height: 1;
}

/* Mobile Navigation Overlay */
.mobile-nav-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 99996;
    display: none;
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
}

.mobile-nav-overlay.active {
    display: block;
}

/* Responsive Design */
@media (max-width: 1200px) {
    .mega-dropdown-content {
        min-width: 700px;
        max-width: 800px;
    }
    
    .mega-dropdown-grid {
        grid-template-columns: repeat(3, 1fr);
        padding: 1.5rem;
    }
}

@media (max-width: 1024px) {
    .mobile-menu-toggle {
        display: flex;
    }
    
    .mega-menu-main {
        position: fixed;
        top: 0;
        right: -100%;
        width: 320px;
        height: 100vh;
        background: linear-gradient(135deg, #f8af3c 0%, #d35400 100%);
        box-shadow: -4px 0 20px rgba(0, 0, 0, 0.15);
        transition: right 0.3s ease;
        z-index: 99999;
        overflow-y: auto;
        padding: 2rem;
        color: #ffffff;
    }
    
    .mega-menu-main.active {
        right: 0;
    }
    
    .mega-menu-list {
        flex-direction: column;
        gap: 0;
        width: 100%;
    }
    
    .mega-menu-item {
        width: 100%;
    }
    
    .mega-menu-link {
        width: 100%;
        padding: 1rem;
        border-radius: 8px;
        justify-content: space-between;
        color: rgba(255, 255, 255, 0.9);
    }
    
    .mega-dropdown-content {
        position: static;
        display: none;
        min-width: auto;
        width: 100%;
        box-shadow: none;
        border: 1px solid rgba(255, 255, 255, 0.18);
        background: rgba(255, 255, 255, 0.92);
        -webkit-backdrop-filter: blur(10px);
        backdrop-filter: blur(10px);
        margin-top: 0.5rem;
        border-radius: 8px;
        opacity: 1;
        visibility: visible;
        transform: none;
        transition: none;
    }
    
    .mega-dropdown-content.show {
        display: block;
    }
    
    .mega-dropdown-grid {
        grid-template-columns: 1fr;
        padding: 1rem;
        gap: 1rem;
    }
    
    .mega-dropdown-section {
        border-right: none;
        border-bottom: 1px solid rgba(255, 255, 255, 0.25);
        padding: 0 0 1rem 0;
    }
    
    .mega-dropdown-section:last-child {
        border-bottom: none;
    }
    
    .mega-dropdown-footer {
        padding: 1rem;
    }
    
    .mega-footer-content {
        flex-direction: column;
        text-align: center;
        gap: 1rem;
    }
}

@media (max-width: 768px) {
    body {
        padding-top:0px;
    }
    
    .mega-menu-container {
        padding: 0 1rem;
        height: 60px;
    }
    
    .mega-menu-logo .logo-img {
        width: 40px;
        height: 40px;
    }
    
    .mega-menu-main {
        width: 100%;
        right: -100%;
    }
    
    .mega-menu-actions {
        gap: 0.5rem;
    }
    
    .user-btn span,
    .cart-btn span:not(.cart-count) {
        display: none;
    }
}

/* Enhanced dropdown positioning for edge cases */
@media (min-width: 1025px) {
    .mega-dropdown-content {
        position: fixed !important;
        top: 78px !important;
        left: 50% !important;
        transform: translateX(-50%) translateY(-10px) !important;
        z-index: 100000 !important;
    }
    
    /* Adjust positioning for edge dropdowns */
    .mega-menu-item.mega-dropdown:first-child .mega-dropdown-content {
        left: 1.5rem !important;
        transform: translateX(0) translateY(-10px) !important;
    }
    
    .mega-menu-item.mega-dropdown:last-child .mega-dropdown-content,
    .mega-menu-item.mega-dropdown:nth-last-child(-n+2) .mega-dropdown-content {
        left: auto !important;
        right: 1.5rem !important;
        transform: translateX(0) translateY(-10px) !important;
    }
}

/* Fix transform for edge dropdowns */
.mega-menu-item.mega-dropdown:first-child .mega-dropdown-content.show {
    transform: translateX(0) translateY(0) !important;
}

.mega-menu-item.mega-dropdown:last-child .mega-dropdown-content.show,
.mega-menu-item.mega-dropdown:nth-last-child(-n+2) .mega-dropdown-content.show {
    transform: translateX(0) translateY(0) !important;
}

/* Ensure dropdown appears above all content */
.mega-dropdown-content {
    z-index: 100000 !important;
    position: fixed !important;
}

/* Make sure no other elements interfere with mega menu */
.hero-slider,
.featured-products,
.about-section,
.why-choose-us,
.share-print-section,
.main-footer {
    position: relative;
    z-index: 1;
}
