/**
 * Custom Mega Menu Styles
 * 
 * Replicates Naikenepal theme mega menu functionality
 * 
 * @package Holiday_Quest
 * @since 1.0.0
 */

/* CSS Custom Properties - Travel Gusty Brand Colors */
:root {
    --mega-menu-bg: var(--primary-color); /* #ac2e45 - Travel Gusty primary */
    --mega-menu-text: #ffffff;
    --mega-menu-hover: var(--primary-shade); /* #7b2131 - deeper shade */
    --mega-menu-dropdown-bg: #002939; /* Dark blue like Naikenepal */
    --mega-menu-dropdown-secondary: #003347; /* Slightly lighter dark blue */
    --mega-menu-border: #e9ecef;
    --mega-menu-shadow: 0px 4px 20px 0px rgba(0, 0, 0, 0.25);
    --mega-menu-transition: all 0.3s ease;
    --mega-menu-font-family: "Heebo", sans-serif; /* Match Naikenepal font */
    --mega-menu-font-size: 20px; /* Match Naikenepal size */
    --mega-menu-font-weight: 500; /* Match Naikenepal weight */
    --mega-menu-letter-spacing: 0.4px; /* Match Naikenepal spacing */
    --mega-menu-accent: #a8e7ff; /* Light blue like Naikenepal */
}

/* Main Container */
.mega-menu-container {
    position: relative;
    z-index: 999;
}

/* Search Functionality */
.mega-menu-search {
    display: flex;
    flex-wrap: wrap;
    max-width: 112px;
    align-items: center;
    margin-bottom: 0px;
}

.mega-menu-search input {
    border: none;
    max-width: 88px;
    padding-right: 23px;
    font-family: var(--mega-menu-font-family);
    font-size: 20px;
    font-weight: 500;
    line-height: 1;
    letter-spacing: 0.4px;
    text-transform: capitalize;
    outline: none;
    background: none;
    color: var(--mega-menu-text);
}

.mega-menu-search input::placeholder {
    color: var(--mega-menu-text);
    opacity: 0.7;
}

.mega-menu-search input:focus-visible {
    border: none;
    outline: none;
}

.mega-menu-search button {
    background: none;
    padding: 0;
    margin: 0;
    line-height: 0;
    color: var(--mega-menu-text);
    border: none;
    cursor: pointer;
}

.mega-menu-search-container {
    margin: 0;
    padding: 0;
    line-height: normal;
}

.mega-menu-search button svg {
    width: 24px;
    height: 24px;
}

/* Mobile Toggle Button */
.mega-menu-mobile-toggle {
    display: none;
    background: #fff;
    color: var(--mega-menu-bg);
    border: 1px solid var(--mega-menu-bg);
    padding: 8px 13px;
    cursor: pointer;
    transition: var(--mega-menu-transition);
    align-items: center;
    gap: 10px;
    font-weight: bold;
    font-size: 16px;
    line-height: 1.22;
}

.mega-menu-mobile-toggle:hover {
    background: var(--mega-menu-bg);
    color: #fff;
}

.mega-menu-mobile-toggle[aria-expanded="true"] .menuBar:nth-child(1) {
    transform: rotate(45deg) translate(4px, 4px);
}

.mega-menu-mobile-toggle[aria-expanded="true"] .menuBar:nth-child(2) {
    opacity: 0;
}

.mega-menu-mobile-toggle[aria-expanded="true"] .menuBar:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -5px);
}

.menuBar__container {
    display: flex;
    flex-direction: column;
    gap: 4.8px;
}

.menuBar {
    width: 20px;
    height: 2px;
    background-color: currentColor;
    transition: var(--mega-menu-transition);
    border-radius: 0;
}

.menuBar__open,
.menuBar__close {
    margin: 0;
    font-size: 16px;
    font-weight: bold;
}

.menuBar__close {
    display: none;
}

.mega-menu-mobile-toggle[aria-expanded="true"] .menuBar__open {
    display: none;
}

.mega-menu-mobile-toggle[aria-expanded="true"] .menuBar__close {
    display: block;
}

/* Main Menu */
.mega-menu {
    background: var(--mega-menu-bg);
    position: sticky;
    top: 0;
    left: 0;
    z-index: 999;
}

.mega-menu-list {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin: 0;
    padding: 0;
    align-items: center;
    background: var(--mega-menu-bg);
    position: sticky;
    top: 0;
    left: 0;
    z-index: 999;
}

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

.mega-menu-link {
    font-family: var(--mega-menu-font-family);
    font-size: var(--mega-menu-font-size);
    font-weight: var(--mega-menu-font-weight);
    line-height: 1.2;
    letter-spacing: var(--mega-menu-letter-spacing);
    text-transform: capitalize;
    color: var(--mega-menu-text);
    display: inline-block;
    padding: 21px 25px 21px 10px;
    text-decoration: none;
    transition: var(--mega-menu-transition);
    position: relative;
}

.mega-menu-link:hover {
    background: var(--mega-menu-dropdown-bg);
    color: var(--mega-menu-accent);
}

.mega-menu-icon {
    margin-right: 8px;
}

.mega-menu-badge {
    background: #ff6b6b;
    color: #fff;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 10px;
    margin-left: 8px;
    font-weight: bold;
}

.mega-menu-arrow {
    position: absolute;
    top: 50%;
    right: 10px;
    width: 12px;
    height: 7px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='8' viewBox='0 0 14 8' fill='none'%3E%3Cpath d='M13.46 1.20005L12.8759 0.615967L7.23 6.26189L1.58408 0.615967L1 1.20005L7.23 7.43005L13.46 1.20005Z' fill='white' stroke='white' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-size: cover;
    transform: translateY(-50%);
    transition: var(--mega-menu-transition);
}

.mega-menu-item:hover .mega-menu-arrow {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='8' viewBox='0 0 14 8' fill='none'%3E%3Cpath d='M13.46 1.20005L12.8759 0.615967L7.23 6.26189L1.58408 0.615967L1 1.20005L7.23 7.43005L13.46 1.20005Z' fill='%23ffffff' stroke='%23ffffff' stroke-linejoin='round'/%3E%3C/svg%3E");
}

/* Submenu Base Styles */
.mega-menu-submenu {
    position: absolute;
    top: 100%;
    left: 0;
    z-index: 99;
    background: var(--mega-menu-dropdown-bg);
    box-shadow: var(--mega-menu-shadow);
    opacity: 0;
    visibility: hidden;
    transform: translateY(8px);
    transition: var(--mega-menu-transition);
    pointer-events: none;
    padding: 40px 20px 40px 30px;
    max-width: 666px;
    width: 100%;
}

.mega-menu-item:hover .mega-menu-submenu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    pointer-events: auto;
}

/* Style 1: Destination-Based Menu */
.mega-menu-style1-content {
    max-width: 1200px;
    width: 100%;
    padding: 40px 20px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
}

.mega-menu-destinations {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

.mega-menu-destination {
    min-width: 270px;
}

.mega-menu-destination-title {
    margin: 0 0 10px 0;
    font-size: 18px;
    font-weight: 700;
}

.mega-menu-destination-title a {
    color: #fff;
    text-decoration: none;
    transition: var(--mega-menu-transition);
    font-weight: 600;
}

.mega-menu-destination-title a:hover {
    color: var(--mega-menu-accent);
}

.mega-menu-destination-subtitle {
    color: #fff;
    font-size: 12px;
    font-weight: 500;
    line-height: 12px;
    opacity: 0.55;
    margin: 3px 0 15px 0;
}

.mega-menu-regions {
    list-style: none;
    padding: 0;
    margin: 0;
}

.mega-menu-region {
    margin-bottom: 8px;
    position: relative;
}

.mega-menu-region > a {
    color: #fff;
    text-decoration: none;
    display: block;
    padding: 8px 0;
    transition: var(--mega-menu-transition);
    font-weight: 500;
}

.mega-menu-region > a:hover {
    color: var(--mega-menu-accent);
}

.mega-menu-trips {
    list-style: none;
    padding: 15px 0 30px;
    margin: 0;
    background: var(--mega-menu-dropdown-secondary);
    position: absolute;
    left: 100%;
    top: -25px;
    min-width: 320px;
    min-height: 320px;
    display: none;
    z-index: 100;
}

.mega-menu-region:hover .mega-menu-trips {
    display: block;
}

.mega-menu-trips:before {
    content: "";
    background: transparent;
    height: 100%;
    width: 5px;
    position: absolute;
    top: 0;
    left: -4px;
}

.mega-menu-trip {
    margin-bottom: 8px;
}

.mega-menu-trip a {
    color: var(--mega-menu-accent);
    text-decoration: none;
    font-size: 14px;
    display: block;
    padding: 3px 30px;
    transition: var(--mega-menu-transition);
}

.mega-menu-trip a:hover {
    color: #fff;
}

/* Item Info Section */
.mega-menu-item-info {
    position: relative;
    max-width: 231px;
    border-radius: 5px;
    border: 1px solid rgba(255, 255, 255, 0.5);
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    font-size: 12px;
    font-weight: 500;
    line-height: 1.28;
    padding: 15px 44px 15px 20px;
    margin: 30px auto 0px;
}

.mega-menu-item-info p {
    margin: 0;
}

.mega-menu-item-info:before {
    content: " ";
    position: absolute;
    width: 65px;
    height: 55px;
    bottom: 0;
    right: 0;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 65 55'%3E%3Cpath d='M0 55L65 0v55H0z' fill='rgba(255,255,255,0.1)'/%3E%3C/svg%3E") no-repeat;
    background-size: contain;
}

/* Style 2: Package Categories Menu */
.mega-menu-style2-content {
    max-width: 666px;
    width: 100%;
    padding: 40px 20px 40px 30px;
    display: flex;
    gap: 20px;
}

.mega-menu-category-list {
    list-style: none;
    padding: 0;
    margin: 0;
    min-width: 200px;
}

.mega-menu-category {
    margin-bottom: 10px;
}

.mega-menu-category a {
    color: #fff;
    text-decoration: none;
    font-weight: 500;
    display: block;
    padding: 5px 0;
    transition: var(--mega-menu-transition);
}

.mega-menu-category a:hover {
    color: var(--mega-menu-hover);
}

.mega-menu-category-subtitle {
    display: block;
    color: #fff;
    font-size: 12px;
    font-weight: 500;
    line-height: 12px;
    opacity: 0.55;
    margin-top: 3px;
}

.mega-menu-columns {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    margin-top: 20px;
}

.mega-menu-column {
    min-width: 200px;
}

.mega-menu-column-title {
    color: #fff;
    font-size: 16px;
    font-weight: 600;
    margin: 0 0 15px 0;
}

.mega-menu-trip-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.mega-menu-trip-item {
    margin-bottom: 8px;
}

.mega-menu-trip-item a {
    color: var(--mega-menu-hover);
    text-decoration: none;
    font-size: 14px;
    display: block;
    padding: 3px 0;
    transition: var(--mega-menu-transition);
}

.mega-menu-trip-item a:hover {
    color: #fff;
}

/* Style 3: Best Selling Trips Menu */
.mega-menu-style3-content {
    max-width: 997px;
    width: 100%;
    padding: 40px;
}

.mega-menu-trips-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    row-gap: 20px;
}

.mega-menu-trip-card {
    position: relative;
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    transition: transform 0.3s ease;
}

.mega-menu-trip-card:hover {
    transform: translateY(-5px);
}

.mega-menu-trip-image {
    height: 150px;
    overflow: hidden;
}

.mega-menu-trip-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.mega-menu-trip-content {
    padding: 15px;
}

.mega-menu-trip-title {
    font-weight: 600;
    margin: 0 0 5px 0;
    color: #333;
}

.mega-menu-trip-title a {
    color: #333;
    text-decoration: none;
}

.mega-menu-trip-subtitle {
    font-size: 12px;
    color: #666;
    margin: 0 0 10px 0;
}

.mega-menu-trip-price {
    font-weight: 600;
    color: var(--mega-menu-bg);
    margin-bottom: 5px;
}

.mega-menu-trip-rating {
    font-size: 12px;
    color: #ffa500;
}

.mega-menu-trip-link {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1;
    text-indent: -9999px;
}

/* Style 4: Normal Navigation Menu */
.mega-menu-style4-content {
    width: 300px;
    padding: 30px;
}

.mega-menu-page-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.mega-menu-page-item {
    margin-bottom: 10px;
}

.mega-menu-page-item a {
    color: #fff;
    text-decoration: none;
    display: block;
    padding: 8px 0;
    transition: var(--mega-menu-transition);
}

.mega-menu-page-item a:hover {
    color: var(--mega-menu-hover);
}

/* Mobile Styles */
@media only screen and (max-width: 960px) {
    .mega-menu-mobile-toggle {
        display: flex;
        align-self: flex-end;
        margin-top: 10px;
    }
    
    .mega-menu {
        display: none;
    }
    
    .mega-menu.menu-open {
        display: block;
    }
    
    .mega-menu-list {
        flex-direction: column;
        width: 100%;
        gap: 0;
    }
    
    .mega-menu-item {
        width: 100%;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    }
    
    .mega-menu-link {
        display: block;
        padding: 15px 20px;
        width: 100%;
        font-size: 16px;
    }
    
    .mega-menu-arrow {
        display: none;
    }
    
    .mega-menu-submenu {
        position: static;
        display: none;
        width: 100%;
        max-width: none;
        box-shadow: none;
        background: rgba(0, 0, 0, 0.1);
        margin: 0;
        padding: 10px 0;
        opacity: 1;
        visibility: visible;
        transform: none;
        pointer-events: auto;
    }
    
    .mega-menu-item.menu-open .mega-menu-submenu {
        display: block;
    }
    
    .mega-menu-style1-content,
    .mega-menu-style2-content,
    .mega-menu-style3-content,
    .mega-menu-style4-content {
        max-width: none;
        width: 100%;
        padding: 20px;
    }
    
    .mega-menu-destinations {
        grid-template-columns: 1fr;
    }
    
    .mega-menu-trips-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    
    .mega-menu-columns {
        flex-direction: column;
        gap: 10px;
    }
    
    .mega-menu-trips {
        position: static;
        min-height: auto;
        background: rgba(0, 0, 0, 0.1);
        padding: 10px 20px;
        display: block;
    }
}

/* Small Mobile Styles */
@media only screen and (max-width: 480px) {
    .mega-menu-link {
        font-size: 14px;
        padding: 12px 15px;
    }
    
    .mega-menu-style1-content,
    .mega-menu-style2-content,
    .mega-menu-style3-content,
    .mega-menu-style4-content {
        padding: 15px;
    }
    
    .mega-menu-trip-content {
        padding: 10px;
    }
    
    .mega-menu-trip-title {
        font-size: 14px;
    }
    
    .mega-menu-trip-subtitle {
        font-size: 11px;
    }
}

/* Touch Device Optimizations */
@media (hover: none) and (pointer: coarse) {
    .mega-menu-item:hover .mega-menu-submenu {
        opacity: 0;
        visibility: hidden;
    }
    
    .mega-menu-item.mobile-open .mega-menu-submenu {
        opacity: 1;
        visibility: visible;
    }
    
    .mega-menu-link:hover {
        background: transparent;
        color: var(--mega-menu-text);
    }
    
    .mega-menu-item.menu-open .mega-menu-link {
        background: #002939;
        color: var(--mega-menu-hover);
    }
}

/* High DPI Displays */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .mega-menu-arrow {
        background-size: contain;
    }
}

/* Print Styles */
@media print {
    .mega-menu-container {
        display: none;
    }
}

/* Accessibility Improvements */
.mega-menu-link:focus {
    outline: 2px solid var(--mega-menu-hover);
    outline-offset: 2px;
}

.mega-menu-submenu[role="menu"] {
    display: none;
}

.mega-menu-item[aria-expanded="true"] .mega-menu-submenu[role="menu"] {
    display: block;
}

/* Loading States */
.mega-menu-container.loading {
    opacity: 0.7;
    pointer-events: none;
}

.mega-menu-container.loading::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid var(--mega-menu-hover);
    border-top: 2px solid transparent;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}
