/* PrimeReact MegaMenu Customization */

/* Reset global styles that conflict with PrimeReact */
.p-megamenu,
.p-megamenu *,
.p-megamenu-panel,
.p-megamenu-panel *,
.p-menuitem,
.p-menuitem *,
.p-menuitem-link,
.p-menuitem-link *,
.p-menuitem-content,
.p-menuitem-content *,
.p-menuitem-text {
    font-size: 0.8rem !important;
    line-height: 1.5 !important;
    text-decoration: none !important;
}

.p-menuitem a,
.p-menuitem span,
.p-megamenu a:not(.custom-btn),
.p-megamenu-panel a {
    text-decoration: none !important;
    border-bottom: none !important;
}

.p-megamenu-root-list,
.p-megamenu-submenu,
.p-submenu-list,
.p-menuitem {
    list-style: none !important;
    list-style-type: none !important;
}

/* Base MegaMenu Styles */
.p-megamenu {
    background: var(--white-color, #ffffff);
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    position: relative;
}

.p-megamenu>div {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    max-width: 1320px;
    margin: 0 auto;
    position: relative;
}

/* Logo / Brand */
.navbar-logo-wrap {
    display: flex;
    align-items: center;
}

.navbar-logo-link {
    display: flex;
    align-items: center;
    text-decoration: none;
}

.navbar-logo-img {
    display: block;
    height: 28px;
    width: auto;
    max-width: 120px;
}

/* Hamburger Button - Hidden on Desktop */
.p-megamenu-button {
    display: none;
    padding: 0.5rem;
    background: transparent;
    border: none;
    cursor: pointer;
    margin-left: auto;
}

.p-megamenu-button svg {
    width: 24px;
    height: 24px;
}

/* Main Menu List - Horizontal on Desktop */
.p-megamenu-root-list {
    display: flex;
    flex-direction: row;
    align-items: center;
    list-style: none;
    margin: 0;
    padding: 0;
    gap: 0.5rem;
}

/* Desktop only - override mobile on larger screens */
@media (min-width: 993px) {
    .p-megamenu-root-list {
        display: flex !important;
        position: static !important;
        flex-direction: row !important;
        max-height: none !important;
        overflow: visible !important;
        opacity: 1 !important;
        visibility: visible !important;
        padding: 0 !important;
        border: none !important;
        box-shadow: none !important;
        background: transparent !important;
    }
}

.p-menuitem {
    position: relative;
    margin: 0;
    padding: 0;
}

/* Menu Item Content and Links */
.p-menuitem-content {
    display: flex;
    align-items: center;
}

.p-menuitem-link {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    color: var(--text-color, #282d3b);
    text-decoration: none;
    cursor: pointer;
    transition: background-color 0.2s, color 0.2s;
    gap: 0.5rem;
    border-radius: 4px;
}

.p-menuitem-link:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

.p-menuitem-text {
    font-weight: 500;
}

.p-submenu-icon {
    width: 14px;
    height: 14px;
    margin-left: 0.25rem;
    transition: transform 0.2s;
}

.p-menuitem[aria-expanded="true"] > .p-menuitem-content .p-submenu-icon {
    transform: rotate(180deg);
}

/* Dropdown Panels */
.p-megamenu-panel {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    z-index: 1000;
    margin-top: 0.25rem;
    background: var(--white-color, #ffffff);
    /* border: 1px solid rgba(0, 0, 0, 0.1); */
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    min-width: 200px;
}

.p-megamenu-panel.p-megamenu-panel-active {
    display: block;
}

/* Nested panels inside submenu lists expand inline (accordion style) */
.p-submenu-list .p-menuitem .p-megamenu-panel {
    position: static;
    display: none;
    box-shadow: none;
    border: none;
    border-left: 3px solid var(--primary-color, #282d3b);
    border-radius: 0;
    margin: 0;
    margin-left: 1rem;
    background: rgba(0, 0, 0, 0.02);
    min-width: auto;
}

.p-submenu-list .p-menuitem .p-megamenu-panel.p-megamenu-panel-active {
    display: block;
}

.p-megamenu-grid {
    display: flex;
    padding: 0.5rem;
}

.p-megamenu-col-12 {
    flex: 0 0 100%;
    width: 100%;
}

/* Submenu Lists */
.p-megamenu-submenu {
    list-style: none;
    margin: 0;
    padding: 0;
}

.p-megamenu-submenu .p-menuitem {
    margin: 0;
}

.p-megamenu-submenu .p-menuitem-link {
    padding: 0.75rem 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.p-megamenu-submenu .p-menuitem-link:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

.p-menuitem-icon {
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
}

.p-menuitem-icon svg {
    width: 20px;
    height: 20px;
}

/* More Menu - Desktop Icons */
.p-menuitem-more .p-menuitem-icons-desktop {
    display: flex;
    gap: 0.25rem;
    align-items: center;
}

.p-menuitem-more .p-menuitem-more-mobile {
    display: none;
}

/* Mobile Icons - Hidden on Desktop, Shown on Mobile */
.p-menuitem-icons-mobile {
    display: none;
    gap: 0.5rem;
    align-items: center;
    margin-left: auto;
    margin-right: 1rem;
}

.p-menuitem-icon-link {
    padding: 0.375rem !important;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: background-color 0.2s ease;
}

.p-menuitem-icon-link:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

.p-menuitem-icon-link svg {
    width: 22px !important;
    height: 22px !important;
    max-width: 22px !important;
    max-height: 22px !important;
}

/* User Menu */
.p-menuitem-user .p-menuitem-link {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.375rem 0.75rem;
}

.p-menuitem-user-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.p-menuitem-user-icon svg {
    width: 24px;
    height: 24px;
    max-width: 24px;
    max-height: 24px;
}

/* User Submenu Alignment */
.p-menuitem-user .p-megamenu-panel {
    right: 0;
    left: auto;
}

/* Mobile Responsive Styles */
@media (max-width: 992px) {
    .p-megamenu {
        padding: 0.75rem 1rem;
        position: sticky;
        top: 0;
        z-index: 1000;
    }

    .p-megamenu>div {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
    }

    /* Show Hamburger Button */
    .p-megamenu-button {
        display: block;
        color: var(--text-color, #282d3b);
    }

    /* Hide Menu by Default on Mobile */
    .p-megamenu-root-list {
        display: flex;
        flex-direction: column;
        position: fixed;
        top: 60px;
        left: 0;
        right: 0;
        width: 100%;
        background: var(--white-color, #ffffff);
        border-top: 2px solid rgba(0, 0, 0, 0.1);
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
        z-index: 9999;
        padding: 0;
        gap: 0;
        max-height: 0;
        overflow: hidden;
        opacity: 0;
        visibility: hidden;
        transition: max-height 0.3s ease, opacity 0.3s ease, visibility 0.3s ease, padding 0.3s ease;
    }

    /* Show Menu When Active */
    .p-megamenu-root-list.p-megamenu-mobile-active {
        max-height: calc(100vh - 60px);
        overflow-y: auto;
        opacity: 1;
        visibility: visible;
        padding: 1rem;
    }

    /* Stack Menu Items Vertically */
    .p-menuitem {
        width: 100%;
        border-bottom: 1px solid rgba(0, 0, 0, 0.05);
        background: var(--white-color, #ffffff);
    }

    .p-menuitem:last-child {
        border-bottom: none;
    }

    .p-menuitem-content {
        width: 100%;
    }

    .p-menuitem-link {
        width: 100%;
        justify-content: space-between;
        padding: 1rem;
        border-radius: 0;
        color: var(--text-color, #282d3b);
        font-weight: 500;
    }

    .p-menuitem-link:hover {
        background-color: rgba(0, 0, 0, 0.08);
    }

    /* Mobile Panels - Static Position */
    .p-megamenu-panel {
        position: static;
        box-shadow: none;
        border: none;
        border-left: 3px solid var(--primary-color, #282d3b);
        margin: 0;
        margin-left: 1rem;
        border-radius: 0;
        background: rgba(0, 0, 0, 0.02);
    }

    .p-megamenu-panel.p-megamenu-panel-active {
        display: block;
    }

    .p-megamenu-submenu .p-menuitem-link {
        padding: 0.75rem 1rem;
    }

    /* Hide Desktop Icons, Show Mobile Dropdown */
    .p-menuitem-more .p-menuitem-icons-desktop {
        display: none;
    }

    .p-menuitem-more .p-menuitem-more-mobile {
        display: flex;
        width: 100%;
    }

    /* Show Mobile Icons */
    .p-menuitem-icons-mobile {
        display: flex;
        gap: var(--space-md, 12px);
        align-items: center;
        justify-content: flex-end;
    }

    /* Adjust mobile icon sizes */
    .p-menuitem-icons-mobile .p-menuitem-icon-link {
        display: flex;
        align-items: center;
        justify-content: center;
        min-width: 44px;
        min-height: 44px;
        padding: 8px;
        border-radius: var(--border-radius-md, 8px);
        transition: background-color var(--transition-duration, 0.3s);
        -webkit-user-select: none;
        user-select: none;
    }

    .p-menuitem-icons-mobile .p-menuitem-icon-link:active {
        background-color: var(--surface-hover, rgba(0, 0, 0, 0.05));
    }

    .p-menuitem-icons-mobile .p-menuitem-icon-link img {
        width: 20px;
        height: 20px;
        display: block;
    }

    .p-menuitem-icons-mobile .notification-badge {
        top: -6px;
        right: -6px;
        min-width: 16px;
        height: 16px;
        font-size: 9px;
    }

    /* Notification trigger button touch-friendly */
    .p-menuitem-icons-mobile .notification-trigger {
        position: relative;
    }

    /* User Menu Mobile */
    .p-menuitem-user .p-megamenu-panel {
        right: auto;
        left: auto;
    }

    /* Adjust icon sizes for mobile */
    .p-menuitem-user-icon svg {
        width: 24px;
        height: 24px;
    }

    .p-submenu-icon {
        margin-left: auto;
    }
}

/* Small Mobile Devices */
@media (max-width: 576px) {
    .p-megamenu {
        padding: 0.5rem 0.75rem;
    }

    .navbar-logo-img {
        height: 24px;
        width: auto;
    }

    .p-megamenu-button svg {
        width: 20px;
        height: 20px;
    }

    .p-menuitem-link {
        padding: 0.875rem 0.75rem;
        font-size: 0.95rem;
    }

    .p-megamenu-root-list {
        padding: 0.75rem;
    }
}

/* Tablet Responsive */
@media (min-width: 993px) and (max-width: 1200px) {
    .p-megamenu>div {
        max-width: 100%;
        padding: 0 1rem;
    }

    .p-megamenu-root-list {
        gap: 0.25rem;
    }

    .p-menuitem-link {
        padding: 0.625rem 0.75rem;
    }
}

/* Large Desktop */
@media (min-width: 1400px) {
    .p-megamenu>div {
        max-width: 1400px;
    }
}

/* Accessibility and Focus States */
.p-menuitem-link:focus {
    outline: 2px solid var(--primary-color, #282d3b);
    outline-offset: 2px;
}

.p-megamenu-button:focus {
    outline: 2px solid var(--primary-color, #282d3b);
    outline-offset: 2px;
}

/* Smooth Transitions */
.p-megamenu-panel,
.p-megamenu-root-list {
    transition: all 0.3s ease-in-out;
}

/* Prevent text selection on menu items during interaction */
.p-menuitem-link {
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

