/* === Toggle-кнопка поиска (стилистика night toggle) === */

#nxp-search-toggle {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--c-white);
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    transition: color 0.25s ease, transform 0.25s ease;
}

#nxp-search-toggle:hover {
    transform: scale(1.15);
}

.menu-item-search {
    position: relative;
    display: flex;
    align-items: center;
    list-style: none;
}

/* === Dropdown-форма === */

.searchform-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    z-index: 9998;
    width: 280px;
    opacity: 0;
    transform: translateY(-8px);
    pointer-events: none;
    transition: opacity 0.25s ease-out, transform 0.25s ease-out;
}

.menu-item-search.search-open .searchform-dropdown {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.searchform-dropdown input[type="text"] {
    width: 100%;
    padding: 10px 40px 10px 14px;
    border: none;
    border-radius: var(--r-md);
    background: var(--c-surface);
    color: var(--c-text);
    font: inherit;
    font-size: 14px;
    box-shadow: var(--shadow-md);
    transition: box-shadow 0.2s ease;
}

.searchform-dropdown input[type="text"]:focus {
    outline: none;
    box-shadow: var(--shadow-md), 0 0 0 2px var(--c-primary);
}

.searchform-dropdown input[type="text"].error {
    box-shadow: var(--shadow-md), 0 0 0 2px #e74c3c;
}

.searchform-dropdown input[type="hidden"] {
    display: none;
}

#searchsubmit {
    position: absolute;
    right: 4px;
    top: 50%;
    transform: translateY(-50%);
    border: none;
    cursor: pointer;
    padding: 0;
    height: 32px;
    width: 32px;
    border-radius: var(--r-md);
    background: none;
    color: var(--c-text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s ease;
}

#searchsubmit:hover {
    color: var(--c-primary);
}

#searchsubmit svg {
    width: 16px;
    height: 16px;
}

/* === Тема-оверрайды === */

body.theme-graphite #nxp-search-toggle {
    color: var(--c-white);
}

body.theme-graphite .searchform-dropdown input[type="text"] {
    background: var(--c-input-bg);
    color: var(--c-text);
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.4);
}

body.theme-graphite .searchform-dropdown input[type="text"]:focus {
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.4), 0 0 0 2px var(--c-primary);
}

body.theme-graphite #searchsubmit {
    color: var(--c-text-muted);
}

body.theme-light #nxp-search-toggle,
body.theme-dusklight #nxp-search-toggle {
    color: var(--c-dark);
}

body.theme-terracotta #nxp-search-toggle {
    color: var(--c-primary);
}

/* === Мобильные стили (≤768px) === */

@media screen and (max-width: 768px) {
    #nxp-search-toggle {
        display: none;
    }

    .menu-item-search {
        margin-bottom: 12px;
        margin-top: 16px;
    }

    .menu-item-search.search-open .searchform-dropdown {
        position: relative;
        top: 0;
        right: auto;
        width: 100%;
        opacity: 1;
        transform: none;
        pointer-events: auto;
        margin-top: 0;
    }

    .searchform-dropdown {
        position: relative;
        top: 0;
        right: auto;
        width: 100%;
        opacity: 1;
        transform: none;
        pointer-events: auto;
        margin-top: 0;
    }

    .searchform-dropdown input[type="text"] {
        width: 100%;
        padding: 10px 40px 10px 14px;
        font-size: 16px;
    }

    #searchsubmit {
        height: 100%;
        width: 40px;
        top: 0;
        transform: none;
        right: 0;
    }
}
