// ==========================================================================
// PressZone Theme - Search Modal Styles
// ==========================================================================
// Entry point - compiles to search-modal.css
// Uses Sass variables with body.dark-mode & nesting pattern.
// ==========================================================================

@import 'abstracts/variables';
@import 'abstracts/mixins';

// --------------------------------------------------------------------------
// Search Toggle Button
// --------------------------------------------------------------------------
.search-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    padding: 0;
    border: none;
    border-radius: 0.5rem;
    background: transparent;
    color: $light-text-secondary;
    cursor: pointer;
    transition: all $transition-base;

    &:hover {
        background: $light-bg-tertiary;
        color: $light-text-primary;
    }

    body.dark-mode & {
        color: $dark-text-secondary;

        &:hover {
            background: $dark-bg-tertiary;
            color: $dark-text-primary;
        }
    }

    i {
        font-size: 1.125rem;
    }
}

// --------------------------------------------------------------------------
// Search Modal
// --------------------------------------------------------------------------
.search-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 9999;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 10vh;
    visibility: hidden;
    opacity: 0;
    transition: visibility 0s linear 0.3s, opacity 0.3s ease;

    &.is-open {
        visibility: visible;
        opacity: 1;
        transition-delay: 0s;

        .search-modal-container {
            transform: translateY(0);
        }
    }
}

.search-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.search-modal-container {
    position: relative;
    width: 100%;
    max-width: 640px;
    margin: 0 1rem;
    transform: translateY(-20px);
    transition: transform 0.3s ease;
}

.search-modal-content {
    background: $light-bg-card;
    border: 1px solid $light-border-color;
    border-radius: 1rem;
    overflow: hidden;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);

    body.dark-mode & {
        background: $dark-bg-card;
        border-color: $dark-border-color;
    }
}

// --------------------------------------------------------------------------
// Search Input
// --------------------------------------------------------------------------
.search-modal-header {
    padding: 1.25rem;
    border-bottom: 1px solid $light-border-color;

    body.dark-mode & {
        border-bottom-color: $dark-border-color;
    }
}

.search-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.75rem;

    .search-icon {
        color: $light-text-muted;
        font-size: 1.25rem;

        body.dark-mode & {
            color: $dark-text-muted;
        }
    }

    @include rtl {
        flex-direction: row-reverse;
    }
}

.search-input {
    flex: 1;
    padding: 0.5rem 0;
    border: none;
    background: transparent;
    color: $light-text-primary;
    font-size: 1.125rem;
    outline: none;

    &::placeholder {
        color: $light-text-muted;
    }

    body.dark-mode & {
        color: $dark-text-primary;

        &::placeholder {
            color: $dark-text-muted;
        }
    }

    @include rtl {
        text-align: right;
    }
}

.search-close-btn {
    display: flex;
    align-items: center;
    padding: 0.375rem 0.625rem;
    border: 1px solid $light-border-color;
    border-radius: 0.375rem;
    background: $light-bg-secondary;
    color: $light-text-muted;
    font-size: 0.75rem;
    cursor: pointer;
    transition: all $transition-base;

    &:hover {
        background: $light-bg-tertiary;
        color: $light-text-primary;
    }

    body.dark-mode & {
        border-color: $dark-border-color;
        background: $dark-bg-secondary;
        color: $dark-text-muted;

        &:hover {
            background: $dark-bg-tertiary;
            color: $dark-text-primary;
        }
    }
}

// --------------------------------------------------------------------------
// Search Body
// --------------------------------------------------------------------------
.search-modal-body {
    padding: 1.25rem;
}

.search-section {
    margin-bottom: 1.5rem;

    &:last-of-type {
        margin-bottom: 1rem;
    }
}

.search-section-title {
    display: flex;
    align-items: center;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: $light-text-muted;
    margin-bottom: 0.75rem;

    body.dark-mode & {
        color: $dark-text-muted;
    }

    @include rtl {
        flex-direction: row-reverse;

        .me-2 {
            margin-right: 0 !important;
            margin-left: 0.5rem !important;
        }
    }
}

// --------------------------------------------------------------------------
// Search Suggestions
// --------------------------------------------------------------------------
.search-suggestions {
    list-style: none;
    padding: 0;
    margin: 0;

    li {
        margin-bottom: 0.25rem;
    }
}

.search-suggestion-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 0.75rem;
    border-radius: 0.5rem;
    color: $light-text-secondary;
    text-decoration: none;
    transition: all $transition-base;

    &:hover {
        background: $light-bg-secondary;
        color: $light-text-primary;

        i {
            transform: translateX(4px);
            color: $color-primary;
        }
    }

    i {
        color: $light-text-muted;
        transition: transform $transition-base;
    }

    body.dark-mode & {
        color: $dark-text-secondary;

        i {
            color: $dark-text-muted;
        }

        &:hover {
            background: $dark-bg-secondary;
            color: $dark-text-primary;
        }
    }

    @include rtl {
        flex-direction: row-reverse;

        i {
            transform: scaleX(-1);
        }

        &:hover i {
            transform: scaleX(-1) translateX(4px);
        }
    }
}

// --------------------------------------------------------------------------
// Search Tags
// --------------------------------------------------------------------------
.search-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.search-tag {
    display: inline-flex;
    align-items: center;
    padding: 0.5rem 1rem;
    border: 1px solid $light-border-color;
    border-radius: 50px;
    background: $light-bg-secondary;
    color: $light-text-secondary;
    font-size: 0.875rem;
    text-decoration: none;
    transition: all $transition-base;

    &:hover {
        border-color: $color-primary;
        background: rgba($color-primary, 0.1);
        color: $color-primary;
    }

    body.dark-mode & {
        border-color: $dark-border-color;
        background: $dark-bg-secondary;
        color: $dark-text-secondary;

        &:hover {
            border-color: $color-primary;
            color: $color-primary;
        }
    }
}

// --------------------------------------------------------------------------
// Keyboard Shortcuts
// --------------------------------------------------------------------------
.search-shortcuts {
    display: flex;
    gap: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid $light-border-color;

    body.dark-mode & {
        border-top-color: $dark-border-color;
    }

    @include rtl {
        flex-direction: row-reverse;
    }
}

.search-shortcut {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.75rem;
    color: $light-text-muted;

    kbd {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        min-width: 24px;
        height: 24px;
        padding: 0 0.5rem;
        border: 1px solid $light-border-color;
        border-radius: 0.25rem;
        background: $light-bg-secondary;
        color: $light-text-secondary;
        font-family: inherit;
        font-size: 0.6875rem;
    }

    body.dark-mode & {
        color: $dark-text-muted;

        kbd {
            border-color: $dark-border-color;
            background: $dark-bg-secondary;
            color: $dark-text-secondary;
        }
    }
}
