/* Search Modal Styles */
.search-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: color-mix(in srgb, var(--surface-900, #050505) 50%, transparent);
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding-top: 5vh;
    backdrop-filter: blur(8px);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

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

html.modal-open,
body.modal-open {
    overflow: hidden !important;
    overscroll-behavior: none;
}

body.modal-open .mobile-bottom-nav {
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
}

@keyframes smIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.sm-box {
    width: 660px;
    max-width: 100%;
    max-height: 80vh;
    background: var(--surface-800);
    border: 1px solid var(--surface-700);
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.6);
    animation: smIn .22s ease;
}

.search-modal-header {
    padding: 10px;
    background: var(--surface-800);
}

.search-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    background: var(--surface-800);
    border: 1px solid var(--surface-700);
    border-radius: 50px;
    padding: 0 15px;
    height: 48px;
    transition: border-color 0.2s;
}

.search-input-wrapper:focus-within {
    border-color: var(--brand-red);
}

.search-input-wrapper i.ph-magnifying-glass {
    color: var(--text-secondary);
    font-size: 20px;
    position: absolute;
    left: 20px;
}

.search-input-wrapper input {
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 14px;
    width: 100%;
    padding: 0 45px;
    outline: none;
    font-family: inherit;
    text-align: center;
}

.search-input-wrapper input::placeholder {
    color: var(--text-secondary);
    text-align: center;
}

.search-modal-close {
    background: var(--surface-700);
    border: none;
    color: var(--text-secondary);
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 16px;
    transition: all 0.2s;
    position: absolute;
    right: 10px;
}

.search-modal-close:hover {
    background: var(--brand-red);
    color: var(--text-light);
}

.search-modal-body {
    padding: 0 20px 20px;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y;
    display: flex;
    flex-direction: column;
    gap: 20px;
    background: var(--surface-800);
    min-height: 0;
    flex: 1 1 auto;
}

/* Custom Scrollbar for Modal Body */
.search-modal-body::-webkit-scrollbar {
    width: 6px;
    display: block !important;
}

.search-modal-body::-webkit-scrollbar-track {
    background: var(--surface-900);
}

.search-modal-body::-webkit-scrollbar-thumb {
    background: var(--surface-700);
    border-radius: 3px;
}

.sm-section {
    display: flex;
    flex-direction: column;
}

.sm-section-title {
    font-size: 10px;
    font-weight: 800;
    color: var(--section-title-color, #6b7280);
    text-transform: uppercase;
    margin-bottom: 5px;
    letter-spacing: 0.5px;
}

.sm-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
}

.sm-item {
    background: var(--surface-800);
    border: 1px solid var(--surface-700);
    border-radius: 8px;
    padding: 16px 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    text-decoration: none;
    transition: all 0.2s ease;
}

.sm-item:hover {
    background: rgba(var(--primary, 245, 158, 11), 0.1);
    border-color: rgba(var(--primary, 245, 158, 11), 0.2);
    box-shadow: 0 4px 12px rgba(var(--primary, 245, 158, 11), 0.1);
    transform: translateY(-2px);
}

.sm-item i {
    font-size: 24px;
    color: var(--text-muted);
    transition: color 0.2s;
}

.sm-item:hover i {
    color: var(--brand-red, #f59e0b);
}

.sm-item span {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    text-align: center;
    line-height: 1.2;
    transition: color 0.2s;
}

.sm-item:hover span {
    color: var(--text-light);
}

@media (max-width: 768px) {
    .search-modal-overlay {
        padding-top: 0;
        align-items: stretch;
        height: 100%;
        height: 100dvh;
        overflow: hidden;
    }

    .sm-box {
        width: 100%;
        max-width: 100%;
        height: 100%;
        height: 100dvh;
        max-height: 100dvh;
        border-radius: 0;
        border: none;
        overflow: hidden;
    }

    .search-modal-header {
        flex-shrink: 0;
    }

    .search-modal-body {
        flex: 1 1 auto;
        min-height: 0;
        max-height: none;
        padding-bottom: calc(20px + env(safe-area-inset-bottom, 0px));
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        touch-action: pan-y;
    }

    .sm-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 480px) {
    .sm-item {
        padding: 12px 4px;
        gap: 6px;
    }

    .sm-item i {
        font-size: 20px;
    }

    .sm-item span {
        font-size: 10px;
    }
}