/*
 * Styles for TDN Modern Navigation Lite
 *
 * These rules style the "More" dropdown and search field injected into
 * the existing navigation. The design aims to blend with the site's
 * existing typography and spacing. Adjust margin, padding, and colors
 * as needed to better match your theme.
 */

/* Container for the dropdown: position relative so the submenu can be
 * absolutely positioned relative to it. */
.tdn-nav-lite-more {
    position: relative;
}

/* Style the dropdown toggle arrow via pseudo element. */
.tdn-nav-lite-more-toggle::after {
    content: '\25BC'; /* downward triangle */
    margin-left: 0.35rem;
    font-size: 0.6rem;
    display: inline-block;
    transition: transform 0.2s ease;
}

/* Rotate arrow when open */
.tdn-nav-lite-more.tdn-nav-lite-open > .tdn-nav-lite-more-toggle::after {
    transform: rotate(180deg);
}

/* Dropdown submenu styling */
/* Base styling for the submenu. Hidden by default. The !important flag
 * overrides theme styles that might otherwise force the sub-menu to display
 * or arrange it differently. Position absolutely relative to its parent.
 */
.tdn-nav-lite-sub-menu {
    display: none !important;
    position: absolute;
    left: 0;
    top: 100%;
    background: #ffffff; /* fallback background; adjust to match theme */
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
    min-width: 150px;
    z-index: 9999;
    list-style: none;
    margin: 0;
    padding: 0.5rem 0;
    border-radius: 0 0 4px 4px;
}

/* Show submenu when parent has open class or on hover for desktop */
/* Show the submenu on hover (desktop) or when the parent is toggled open
 * via JavaScript. Use !important to overcome competing theme styles. */
.tdn-nav-lite-more:hover > .tdn-nav-lite-sub-menu,
.tdn-nav-lite-more.tdn-nav-lite-open > .tdn-nav-lite-sub-menu {
    display: block !important;
}

/* Style submenu items */
.tdn-nav-lite-sub-menu li {
    padding: 0;
}

.tdn-nav-lite-sub-menu li a {
    display: block;
    padding: 0.4rem 1rem;
    white-space: nowrap;
}

.tdn-nav-lite-sub-menu li a:hover,
.tdn-nav-lite-sub-menu li a:focus {
    background-color: #f0f0f0;
    text-decoration: none;
}

/* Ensure dropdown appears above other elements and create a new stacking
 * context. Use !important to override any position declarations from
 * the theme. */
nav.main-navigation ul.menu li.tdn-nav-lite-more {
    position: relative !important;
    z-index: 10000;
}

/* Search form styling */
.tdn-nav-lite-search form {
    display: flex;
    align-items: center;
    margin: 0;
}

.tdn-nav-lite-search input[type="search"] {
    padding: 0.3rem 0.6rem;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 0.9rem;
    min-width: 140px;
}

.tdn-nav-lite-search input[type="submit"] {
    display: none;
}

/* Search icon button styling */
.tdn-nav-lite-search-toggle {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.3rem;
    display: flex;
    align-items: center;
    justify-content: center;
    color: inherit;
    font-size: 1rem;
}
.tdn-nav-lite-search-toggle .dashicons {
    font-size: 20px;
    line-height: 1;
}

/* Search overlay styles */
.tdn-nav-lite-search-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(255, 255, 255, 0.96);
    z-index: 100000;
    justify-content: center;
    align-items: center;
    overflow: auto;
    padding: 2rem;
    box-sizing: border-box;
}
.tdn-nav-lite-search-overlay.active {
    display: flex;
}

.tdn-nav-lite-search-wrapper {
    position: relative;
    width: 100%;
    max-width: 600px;
}

.tdn-nav-lite-search-wrapper form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin: 0;
}

.tdn-nav-lite-search-wrapper input[type="text"],
.tdn-nav-lite-search-wrapper input[type="search"] {
    width: 100%;
    padding: 0.6rem 1rem;
    font-size: 1.2rem;
    border: 1px solid #ccc;
    border-radius: 4px;
    box-sizing: border-box;
}

.tdn-nav-lite-search-wrapper input[type="submit"] {
    align-self: flex-start;
    padding: 0.5rem 1rem;
    font-size: 1rem;
    background-color: #d5001f; /* theme accent color */
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

.tdn-nav-lite-search-close {
    position: absolute;
    top: 0;
    right: 0;
    background: none;
    border: none;
    font-size: 2rem;
    line-height: 1;
    padding: 0.5rem;
    cursor: pointer;
    color: inherit;
}

/* Responsive adjustments: on small screens, ensure the dropdown expands
 * naturally rather than floating. */
@media (max-width: 768px) {
    .tdn-nav-lite-more {
        position: static;
    }
    .tdn-nav-lite-sub-menu {
        position: static;
        box-shadow: none;
        background: transparent;
        padding-left: 1rem;
    }
    .tdn-nav-lite-sub-menu li a {
        padding-left: 0;
    }
    .tdn-nav-lite-more-toggle::after {
        display: none; /* hide arrow icon on mobile for simplicity */
    }
}