/* ============================================
   MODAL SEARCH STYLES
   ============================================ */

.modal-search-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgb(0 0 0 / 10%);
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    visibility: hidden;
    opacity: 0;
    transition: visibility 0.25s ease, opacity 0.25s ease;
}

.modal-search-overlay.active {
    visibility: visible;
    opacity: 1;
}

.modal-search-container {
    max-width: 1300px;
    width: 90%;
    background: #ffffff;
    border-radius: 0px;
    box-shadow: -1px 0px 50px 20px rgb(0 0 0 / 44%);
    transform: scale(0.96) translateY(10px);
    transition: transform 0.3s cubic-bezier(0.2, 0.9, 0.4, 1.1);
    overflow: hidden;
    height: 70%;
    justify-content: center;
    align-items: center;
    display: flex;
    border: 1px solid;
}

.modal-search-overlay.active .modal-search-container {
    transform: scale(1) translateY(0);
}

.modal-search-content {
    padding: 5rem 2rem 5rem;
    max-width: 800px;
    margin: 0 auto;
    width: 100%;
}

/* Заголовок */
.modal-search-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 1.75rem;
    position: relative;
}

.modal-search-title {
    font-size: 22px;
    font-weight: 500;
    letter-spacing: 0.3px;
    color: #000;
    margin: 0;
    opacity: 0.7;
}

.modal-search-close {
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px;
    display: flex;
    align-items: center;
    border: 1px solid;
    justify-content: center;
    color: #000000;
    transition: color 0.2s;
    border-radius: 50%;
    position: absolute;
    right: 10px;
    top: 10px;
}

.modal-search-close:hover {
    color: #000;
    background: #f0f0f0;
}

/* Поле поиска */
.modal-search-field {
    position: relative;
    margin-bottom: 2.5rem;
}

/* Обертка для инпута */
.modal-search-input-wrapper {
    position: relative;
    width: 100%;
    display: flex;
    align-items: center;
}

/* Основное поле ввода */
.modal-search-input {
    width: 100%;
    padding: 0rem 0rem 0rem 0rem !important;
    font-size: 8rem !important;
    border: none !important;
    border-bottom: 0px solid #eaeaea !important;
    background: transparent;
    outline: none !important;
    line-height: 1.2 !important;
    font-family: inherit;
    transition: border-color 0.2s;
    color: #111 !important;
    position: relative;
    z-index: 2;
    background-color: transparent !important;
}

.modal-search-input:focus {
    border-bottom-color: #000;
    outline: none;
}

.modal-search-input.has-category {
    color: #111 !important;
    background: transparent !important;
    padding-right: 100px !important;
}

/* Спан для серой категории */
.modal-search-category-suffix {
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    color: #999;
    font-size: 8rem !important;
    font-family: inherit;
    pointer-events: none;
    z-index: 1;
    white-space: nowrap;
    line-height: 1.2;
    display: none;
}

.modal-search-category-suffix.visible {
    display: block;
    animation: categoryFadeIn 0.2s ease forwards;
}

/* Placeholder */
.modal-search-input::placeholder {
    color: #ccc;
    font-weight: 400;
    font-size: 1.3rem;
    font-style: italic;
    opacity: 0.7;
}

.modal-search-input:focus::placeholder {
    opacity: 0.5;
}

/* Кнопка submit */
.modal-search-submit {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    color: #aaa;
    transition: color 0.2s;
    border-radius: 50%;
    display: none;
}

.modal-search-submit:hover {
    color: #000;
    background: #f5f5f5;
}

/* Теги (категории) */
.modal-search-tags {
    margin: -2rem 0 1rem;
}

.tags-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: left;
}

.tag-item {
    background: #fff;
    padding: 10px 22px;
    border-radius: 0px;
    font-size: 1.3em;
    font-weight: 500;
    color: #1e1e1e;
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
    letter-spacing: -0.2px;
    border: 1px solid;
}

.tag-item:hover {
    background: #e8e8ec;
    border-color: #1e1e1e;
}

.tag-item:active {
    transform: translateY(1px);
}

.tag-item.active {
    background: #000;
    color: #fff;
    border-color: #000;
}

/* Подсказка */
.modal-search-hint {
    text-align: center;
    font-size: 0.7rem;
    color: #aaa;
    margin-top: 1.5rem;
    letter-spacing: 0.3px;
    display: none;
}

/* Анимация */
@keyframes categoryFadeIn {
    from {
        opacity: 0;
        transform: translateY(-50%) translateX(10px);
    }

    to {
        opacity: 1;
        transform: translateY(-50%) translateX(0);
    }
}

/* Body при открытой модалке */
body.modal-search-open {
    overflow: hidden;
}

/* Выделение текста */
.modal-search-input::selection {
    background: #000;
    color: #fff;
}

/* ============================================
   NEWSLETTER MODAL STYLES
   ============================================ */

#modal-newsletter-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    visibility: hidden;
    opacity: 0;
    transition: visibility 0.3s ease, opacity 0.3s ease;
}

#modal-newsletter-overlay.active {
    visibility: visible;
    opacity: 1;
}

#modal-newsletter-overlay .modal-search-container {
    max-width: 700px;
    width: 90%;
    background: #ffffff;
    border-radius: 0;
    padding: 50px 40px;
    position: relative;
    transform: scale(0.95) translateY(20px);
    transition: transform 0.3s cubic-bezier(0.2, 0.9, 0.4, 1.1);
    max-height: 90vh;
    overflow-y: auto;
    display: block;
    height: auto;
    box-shadow: -1px 0px 50px 20px rgba(0, 0, 0, 0.44);
    border: 1px solid #000;
}

#modal-newsletter-overlay.active .modal-search-container {
    transform: scale(1) translateY(0);
}

#modal-newsletter-overlay .modal-search-close {
    position: absolute;
    top: 15px;
    right: 15px;
    background: none;
    border: 1px solid #000;
    cursor: pointer;
    padding: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    color: #000;
    transition: all 0.2s;
    z-index: 10;
}

#modal-newsletter-overlay .modal-search-close:hover {
    background: #f0f0f0;
}

#modal-newsletter-overlay .modal-search-close svg {
    width: 20px;
    height: 20px;
    stroke: #000;
    stroke-width: 2;
}

#modal-newsletter-overlay .newsletter-content {
    text-align: center;
}

#modal-newsletter-overlay .newsletter-subtitle {
    font-size: 14px;
    letter-spacing: 3px;
    color: #999;
    margin-bottom: 20px;
    text-transform: uppercase;
}

#modal-newsletter-overlay .newsletter-title {
    font-size: 2.2rem;
    font-weight: 300;
    line-height: 1.3;
    margin-bottom: 30px;
    color: #000;
}

#modal-newsletter-overlay .newsletter-form {
    max-width: 500px;
    margin: 0 auto;
}

/* Обход правила panel-opened */
html.panel-opened #modal-newsletter-overlay {
    z-index: 999999 !important;
}

html.panel-opened #modal-newsletter-overlay.active {
    z-index: 999999 !important;
    visibility: visible !important;
    opacity: 1 !important;
}

/* ============================================
   MEDIA QUERIES
   ============================================ */

/* Для поисковой модалки */
@media (max-width: 768px) {
    #modal-newsletter-overlay .newsletter-subtitle {
        font-size: 12px;
        letter-spacing: 3px;
        color: #999;
        margin-bottom: 15px;
        text-transform: uppercase;
    }

    .modal-search-content {
        padding: 3rem 1.5rem;
    }

    .modal-search-input {
        font-size: 3rem !important;
    }

    .modal-search-category-suffix {
        font-size: 3rem !important;
    }

    .tag-item {
        padding: 8px 18px;
        font-size: 1rem;
    }

    .modal-search-container {
        height: 500px;
    }

    .tags-grid {
        gap: 10px;
        justify-content: flex-start;
    }
}

@media (max-width: 600px) {
    .modal-search-content {
        padding: 2rem 1rem;
    }

    .modal-search-input {
        font-size: 2rem !important;
    }

    .modal-search-category-suffix {
        font-size: 2rem !important;
    }

    .modal-search-input::placeholder {
        font-size: 1rem;
    }

    .tag-item {
        padding: 6px 16px;
        font-size: 0.8rem;
    }

    .tags-grid {
        gap: 8px;
    }

    .modal-search-title {
        font-size: 18px;
    }
}

@media (max-width: 480px) {
    .modal-search-input {
        font-size: 1.5rem !important;
    }

    .modal-search-category-suffix {
        font-size: 1.5rem !important;
    }
}

/* Для модалки новостей */
@media (max-width: 768px) {
    #modal-newsletter-overlay .modal-search-container {
        padding: 40px 25px;
        width: 95%;
    }

    #modal-newsletter-overlay .newsletter-title {
        font-size: 1.5rem;
    }
}