/* Base Styles */
.custom-mega-menu-widget {
    position: relative;
    font-family: inherit;
    width: 100%;
}

/* Desktop Menu */
.custom-menu-desktop {
    display: flex;
    list-style: none;
    margin: 0;
    padding: 0;
    gap: 20px;
    align-items: center;
}

.custom-menu-desktop > .menu-item {
    position: relative;
}

.custom-menu-desktop > .menu-item > a {
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    padding: 10px 0;
    color: #333;
    font-weight: 500;
    transition: all 0.2s ease;
}

.arrow-down {
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease;
}
.arrow-down svg {
    width: 12px;
    height: 12px;
    fill: currentColor;
}
.arrow-down i {
    font-size: 12px;
}

/* Dropdown & Mega Menu Base */
.simple-dropdown,
.mega-menu {
    position: absolute;
    top: 100%;
    left: 0;
    background: #fff;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 99;
    border-radius: 8px;
    margin-top: 10px;
}

/* Simple Dropdown */
.simple-dropdown {
    list-style: none;
    min-width: 220px;
    padding: 10px 0;
}

.simple-dropdown li a {
    display: block;
    padding: 10px 20px;
    color: #555;
    text-decoration: none;
    transition: background 0.2s;
}
.simple-dropdown li a:hover {
    background: rgba(0,0,0,0.05);
}

/* Mega Menu */
.has-mega-menu {
    position: static !important;
}

.has-mega-menu .mega-menu {
    left: 0;
    right: 0;
    width: 100%;
    padding: 30px;
}

.mega-menu-inner {
    display: flex;
    gap: 30px;
}

.mega-column {
    flex: 1;
}

.mega-column-title {
    font-weight: bold;
    margin-bottom: 15px;
    color: #222;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(0,0,0,0.05);
}

.mega-column-title a {
    color: inherit;
    text-decoration: none;
    transition: color 0.2s;
}

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

.mega-links-list li a {
    display: block;
    padding: 8px 0;
    color: #666;
    text-decoration: none;
    transition: color 0.2s;
}

/* Desktop Triggers */
.desktop-trigger-hover .has-children:hover > .simple-dropdown,
.desktop-trigger-hover .has-children:hover > .mega-menu {
    opacity: 1;
    visibility: visible;
    margin-top: 0;
}

.desktop-trigger-click .has-children.is-open > .simple-dropdown,
.desktop-trigger-click .has-children.is-open > .mega-menu {
    opacity: 1;
    visibility: visible;
    margin-top: 0;
}
.desktop-trigger-click .has-children.is-open > a .arrow-down {
    transform: rotate(180deg);
}

/* Mobile Toggle Button */
.mobile-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 10px;
    margin: 0;
    color: #333;
    display: flex;
    align-items: center;
    justify-content: center;
}
.mobile-toggle svg {
    width: 24px;
    height: 24px;
    fill: currentColor;
}
.mobile-toggle i {
    font-size: 24px;
}

/* Mobile Container */
.mobile-menu-container {
    position: fixed;
    top: 0;
    bottom: 0;
    width: 320px;
    max-width: 100vw;
    background: #fff;
    z-index: 9999;
    overflow-y: auto;
    transition: transform 0.3s ease;
    box-shadow: 2px 0 10px rgba(0,0,0,0.1);
    display: flex;
    flex-direction: column;
}

.mobile-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.6);
    z-index: 9998;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s;
}

/* Drawer Types */
.mobile-type-drawer_left .mobile-menu-container {
    left: 0;
    transform: translateX(-100%);
}
.mobile-type-drawer_left.mobile-open .mobile-menu-container {
    transform: translateX(0);
}

.mobile-type-drawer_right .mobile-menu-container {
    right: 0;
    left: auto;
    transform: translateX(100%);
}
.mobile-type-drawer_right.mobile-open .mobile-menu-container {
    transform: translateX(0);
}

.mobile-type-dropdown .mobile-menu-container {
    top: 100%;
    left: 0;
    right: 0;
    width: 100%;
    max-height: 80vh;
    transform: translateY(-10px);
    opacity: 0;
    visibility: hidden;
    position: absolute;
}
.mobile-type-dropdown.mobile-open .mobile-menu-container {
    transform: translateY(0);
    opacity: 1;
    visibility: visible;
}

.mobile-type-fullscreen .mobile-menu-container {
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    transform: scale(0.95);
    opacity: 0;
    visibility: hidden;
}
.mobile-type-fullscreen.mobile-open .mobile-menu-container {
    transform: scale(1);
    opacity: 1;
    visibility: visible;
}

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

.mobile-menu-header {
    display: flex;
    justify-content: flex-end;
    padding: 20px;
    border-bottom: 1px solid rgba(0,0,0,0.05);
}

.mobile-close {
    background: none;
    border: none;
    cursor: pointer;
    padding: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.mobile-close svg {
    width: 24px;
    height: 24px;
    fill: currentColor;
}
.mobile-close i {
    font-size: 24px;
}

.mobile-menu-content-wrapper {
    padding: 20px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.custom-menu-mobile {
    list-style: none;
    padding: 0;
    margin: 0;
    flex-grow: 1;
}

.mobile-item-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid rgba(0,0,0,0.05);
}

.mobile-item-inner a {
    text-decoration: none;
    color: #333;
    font-weight: 500;
    flex-grow: 1;
}

.mobile-accordion-toggle {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mobile-submenu {
    list-style: none;
    padding-left: 15px;
    margin: 0;
    display: none;
}

.mobile-item.is-expanded > .mobile-submenu {
    display: block;
}

/* Mobile Button */
.mobile-custom-btn-wrapper {
    margin-top: 30px;
    text-align: center;
}
.mobile-custom-btn {
    display: inline-block;
    width: 100%;
    padding: 12px 20px;
    background: #0073aa;
    color: #fff;
    text-decoration: none;
    border-radius: 4px;
    font-weight: bold;
    text-align: center;
    transition: opacity 0.2s;
}
.mobile-custom-btn:hover {
    opacity: 0.9;
}

/* --- Breakpoints Logic --- */

/* Breakpoint: Mobile (< 768px) */
.menu-breakpoint-mobile .mobile-toggle,
.menu-breakpoint-mobile .mobile-menu-container {
    display: none;
}
@media (max-width: 767px) {
    .menu-breakpoint-mobile .custom-menu-desktop { display: none; }
    .menu-breakpoint-mobile .mobile-toggle { display: flex; }
    .menu-breakpoint-mobile .mobile-menu-container { display: flex; }
}

/* Breakpoint: Tablet (< 1025px) */
.menu-breakpoint-tablet .mobile-toggle,
.menu-breakpoint-tablet .mobile-menu-container {
    display: none;
}
@media (max-width: 1024px) {
    .menu-breakpoint-tablet .custom-menu-desktop { display: none; }
    .menu-breakpoint-tablet .mobile-toggle { display: flex; }
    .menu-breakpoint-tablet .mobile-menu-container { display: flex; }
}

/* Breakpoint: None (Always Desktop) */
.menu-breakpoint-none .mobile-toggle,
.menu-breakpoint-none .mobile-menu-container,
.menu-breakpoint-none .mobile-overlay {
    display: none !important;
}

/* Default Fallback just in case no class is applied */
@media (max-width: 1024px) {
    .custom-mega-menu-widget:not([class*="menu-breakpoint-"]) .custom-menu-desktop { display: none; }
    .custom-mega-menu-widget:not([class*="menu-breakpoint-"]) .mobile-toggle { display: flex; }
}
@media (min-width: 1025px) {
    .custom-mega-menu-widget:not([class*="menu-breakpoint-"]) .mobile-toggle,
    .custom-mega-menu-widget:not([class*="menu-breakpoint-"]) .mobile-menu-container,
    .custom-mega-menu-widget:not([class*="menu-breakpoint-"]) .mobile-overlay { display: none !important; }
}
