/* Simple Top Navigation Styles */
#stn-top-nav {
    position: relative;
    width: 100%;
    background: white;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    margin: 0;
    padding: 0;
    min-height: 50px;
    box-sizing: border-box;
}

/* Main container for both groups */
#stn-menu-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    max-width: 100%;
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Left-aligned items group */
.stn-left-group {
    display: flex;
    flex: 0 0 auto;
    justify-content: flex-start;
    align-items: center;
    margin: 0;
    padding: 0;
}

/* Right-aligned items group */
.stn-right-group {
    display: flex;
    flex: 0 0 auto;
    justify-content: flex-end;
    align-items: center;
    margin: 0;
    padding: 0;
}

/* Menu Links - Sized to content */
.stn-menu-link {
    color: #333;
    text-decoration: none;
    padding: 15px 20px;
    margin: 0;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    line-height: 1.2;
    height: 50px;
    box-sizing: border-box;
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
    flex: 0 0 auto;
    min-width: 60px;
    text-align: center;
    background: white;
    position: relative;
    /* Only background-color transition for smooth hover */
    transition: background-color 0.2s ease;
}

/* Remove ALL other hover effects except background color */
.stn-menu-link:hover {
    background-color: #B5B5B5 !important; /* Dark grey */
    /* Keep everything else exactly the same */
    outline: none !important;
    border: none !important;
    box-shadow: none !important;
    color: #333 !important;
    padding: 15px 20px !important;
    margin: 0 !important;
    text-decoration: none !important;
    /* Ensure no size changes */
    width: auto !important;
    height: 50px !important;
    min-width: 60px !important;
    max-width: none !important;
    /* Ensure no position changes */
    position: relative !important;
    top: auto !important;
    left: auto !important;
    right: auto !important;
    bottom: auto !important;
    transform: none !important;
}

.stn-menu-link:focus,
.stn-menu-link:active {
    outline: none !important;
    border: none !important;
    box-shadow: none !important;
    background: white !important;
    color: #333 !important;
}

/* Remove any focus styles that might be added by theme or browser */
.stn-menu-link:focus-visible {
    outline: none !important;
    box-shadow: none !important;
}

/* NO borders between buttons or buttons and background */
.stn-left-item,
.stn-right-item {
    border: none !important;
}

/* Edge items can touch page edges */
.stn-edge-left {
    margin-left: 0 !important;
}

.stn-edge-right {
    margin-right: 0 !important;
}

/* Menu Toggle (Hamburger) - Mobile Only */
#stn-menu-toggle {
    display: none;
    background: #333;
    color: white;
    border: none;
    padding: 10px;
    cursor: pointer;
    width: 44px;
    height: 44px;
    line-height: 0;
    outline: none !important;
    position: absolute;
    top: 3px;
    right: 3px;
    z-index: 10;
    border-radius: 3px;
}

#stn-menu-toggle:hover {
    background: #555;
}

#stn-menu-toggle:focus {
    outline: none !important;
    box-shadow: none !important;
}

.stn-hamburger {
    display: block;
    width: 24px;
    height: 2px;
    background: white;
    position: relative;
    margin: 0 auto;
}

.stn-hamburger::before,
.stn-hamburger::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 2px;
    background: white;
    left: 0;
}

.stn-hamburger::before {
    top: -6px;
}

.stn-hamburger::after {
    bottom: -6px;
}

/* Desktop Styles */
@media screen and (min-width: 769px) {
    #stn-menu-container {
        height: 50px;
        padding: 0;
    }
    
    .stn-menu-link {
        font-size: 15px;
        padding: 15px 20px;
    }
    
    /* Ensure buttons don't stretch */
    .stn-left-group,
    .stn-right-group {
        flex-shrink: 0;
    }
    
    /* Left items: first item touches left edge, others align to previous */
    .stn-left-item:not(.stn-edge-left) {
        margin-left: 0;
    }
    
    /* Right items: last item touches right edge, others align to previous */
    .stn-right-item:not(.stn-edge-right) {
        margin-right: 0;
    }
}

/* Mobile Styles */
@media screen and (max-width: 768px) {
    #stn-top-nav {
        position: relative;
        height: auto;
        min-height: 50px;
        overflow: visible;
    }
    
    #stn-menu-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
        position: absolute;
        top: 3px;
        right: 3px;
    }
    
    #stn-menu-container {
        flex-direction: column;
        align-items: stretch;
        position: absolute;
        top: 50px;
        left: 0;
        right: 0;
        background: white;
        transform: translateY(-100%);
        transition: transform 0.3s ease;
        z-index: 5;
        box-shadow: 0 4px 6px rgba(0,0,0,0.1);
        opacity: 0;
        pointer-events: none;
        max-height: 0;
        overflow: hidden;
    }
    
    #stn-menu-container.active {
        transform: translateY(0);
        opacity: 1;
        pointer-events: all;
        max-height: 500px;
        overflow: visible;
    }
    
    .stn-left-group,
    .stn-right-group {
        flex-direction: column;
        width: 100%;
        flex: none;
    }
    
    .stn-menu-link {
        width: 100%;
        text-align: left;
        margin: 0 !important;
        padding: 15px 20px;
        height: auto;
        min-height: 50px;
        font-size: 16px;
        border: none !important;
        border-bottom: 1px solid #f0f0f0;
        display: block !important;
        justify-content: flex-start;
        min-width: auto;
        background: white;
    }
    
    /* Mobile hover - only background color changes */
    .stn-menu-link:hover {
        background-color: #B5B5B5 !important; /* Same dark grey */
        color: #333 !important;
        padding: 15px 20px !important;
        border-bottom: 1px solid #f0f0f0 !important;
    }
    
    .stn-menu-link:focus,
    .stn-menu-link:active {
        background: white !important;
        color: #333 !important;
    }
    
    .stn-menu-link:last-child {
        border-bottom: none !important;
    }
    
    /* Reset edge styles on mobile */
    .stn-edge-left,
    .stn-edge-right {
        border: none !important;
    }
    
    /* On mobile, show alignment indicator */
    .stn-left-item::before {
        content: '← ';
        color: #0369a1;
        margin-right: 8px;
        font-weight: bold;
    }
    
    .stn-right-item::before {
        content: '→ ';
        color: #92400e;
        margin-right: 8px;
        font-weight: bold;
    }
}

/* Print Styles */
@media print {
    #stn-top-nav {
        display: none;
    }
}

/* High Contrast Mode Support - Keep dark grey hover */
@media (prefers-contrast: high) {
    .stn-menu-link:hover {
        background-color: #424242 !important;
        color: #333 !important;
    }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    #stn-menu-container {
        transition: none;
    }
    
    .stn-menu-link {
        transition: none;
    }
}

/* Remove any default browser focus styles */
.stn-menu-link::-moz-focus-inner {
    border: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
}

/* Ensure no focus rings appear */
.stn-menu-link:focus {
    outline: 0 !important;
    outline-offset: 0 !important;
}

/* Ensure the menu doesn't interfere with other content */
body {
    margin-top: 0 !important;
    padding-top: 0 !important;
}

/* Add a small buffer if the theme has a fixed header */
.admin-bar #stn-top-nav {
    top: 0;
}

/* Ensure proper spacing with WordPress admin bar */
@media screen and (min-width: 769px) {
    .admin-bar #stn-top-nav {
        margin-top: 32px;
    }
}

@media screen and (max-width: 782px) {
    .admin-bar #stn-top-nav {
        margin-top: 46px;
    }
}

/* Prevent horizontal scrolling on very small screens */
@media screen and (max-width: 400px) {
    .stn-menu-link {
        padding: 15px 15px;
        font-size: 15px;
    }
    
    .stn-menu-link:hover {
        padding: 15px 15px !important;
    }
}