/*
 * This file is part of the UX SDC Bundle
 *
 * (c) Jozef Môstka <https://github.com/tito10047/ux-sdc>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

/* Styles for Search component */
@layer components {
    .search {
        position: relative;
        width: min(100%, 700px);

        & .search__glow {
            position: absolute;
            inset: -10px;
            background: linear-gradient(90deg, #3b82f6, #a855f7);
            filter: blur(25px);
            opacity: 0.2;
            border-radius: var(--radius-xl);
            z-index: 0;
        }

        & .search__box {
            position: relative;
            z-index: 1;
            background: var(--color-surface);
            border-radius: 2rem;
            display: flex;
            align-items: center;
            padding: 0.25rem 0.75rem 0.25rem 1.25rem;
            box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.05);
            border: 1px solid var(--color-border);
            gap: 0.5rem;

            @media (max-width: 640px) {
                flex-direction: column;
                align-items: stretch;
                border-radius: 1rem;
                padding: 0.75rem;
            }
        }

        & .search__select-wrapper {
            display: flex;
            align-items: center;
            gap: 0.5rem;
            padding-right: 0.75rem;
            border-right: 1px solid var(--color-border);
            height: 1.5rem;
            flex-shrink: 0;

            @media (max-width: 640px) {
                border-right: none;
                border-bottom: 1px solid var(--color-border);
                height: auto;
                padding-right: 0;
                padding-bottom: 0.5rem;
                width: 100%;
            }

            & .search__select-icon {
                color: #94a3b8;
                display: flex;
                align-items: center;
            }

            & .ts-wrapper {
                min-width: 120px;

                & .ts-control {
                    border: none;
                    background: transparent;
                    padding: 0;
                    box-shadow: none;
                    font-size: 0.95rem;
                    color: var(--color-text);
                    display: flex;
                    align-items: center;
                    min-height: unset;

                    & .item {
                        color: var(--color-text);
                    }
                }

                &.focus .ts-control {
                    box-shadow: none;
                }

                & .ts-dropdown {
                    margin-top: 0.75rem;
                }
            }
        }

        & .search__input {
            flex: 1;
            border: none;
            background: transparent;
            font-size: 1.1rem;
            color: var(--color-text);
            outline: none;
            padding-block: 0.5rem;

            @media (max-width: 640px) {
                width: 100%;
                padding-left: 0.5rem;
            }

            &::placeholder {
                color: #94a3b8;
            }
        }

        & .search__icon {
            color: #94a3b8;
            display: flex;
            align-items: center;

            @media (max-width: 640px) {
                position: absolute;
                right: 1.5rem;
                bottom: 1.25rem;
            }
        }
    }
}

@media (prefers-color-scheme: dark) {
    .search {
        & .search__box {
            background: var(--color-surface);
            border-color: var(--color-border);
        }

        & .search__input {
            color: var(--color-text);
        }
    }
}
