.search-popup-overlay {
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: rgba(0, 0, 0, 0.6);
backdrop-filter: blur(8px);
z-index: 1003;
display: none;
align-items: flex-start;
justify-content: center;
padding: 4rem 1rem 1rem;
opacity: 0;
transition: opacity 0.3s ease;
}

@media (max-width: 640px) {
.search-popup-overlay {
padding: 0;
align-items: flex-end;
}
}

.search-popup-overlay.show {
display: flex;
opacity: 1;
}

.search-popup-overlay.hiding {
display: flex;
opacity: 0;
}

.search-popup-content {
width: 100%;
max-width: 700px;
height: 80vh;
background: #1e2433;
border: 1px solid rgba(74, 158, 255, 0.1);
border-radius: 1.25rem;
box-shadow: 0 25px 50px rgba(0, 0, 0, 0.6);
position: relative;
display: flex;
flex-direction: column;
overflow: hidden;
transform: translateY(0);
transition: transform 0.3s ease-out, opacity 0.3s ease-out;
}

.search-popup-overlay.show .search-popup-content {
animation: searchPopupSlideIn 0.25s ease-out;
}

.search-popup-overlay.hiding .search-popup-content {
opacity: 0;
transform: translateY(10px);
}

@media (max-width: 640px) {
.search-popup-content {
width: 100%;
max-width: none;
height: 100vh;
max-height: 100vh;
border-radius: 0;
border: none;
box-shadow: none;
}

.search-popup-overlay.show .search-popup-content {
animation: searchPopupSlideUp 0.3s ease-out;
}

.search-popup-overlay.hiding .search-popup-content {
opacity: 0;
transform: translateY(100%);
}
}

@keyframes searchPopupSlideIn {
from {
opacity: 0;
transform: translateY(10px);
}
to {
opacity: 1;
transform: translateY(0);
}
}

@keyframes searchPopupSlideUp {
from {
opacity: 0;
transform: translateY(100%);
}
to {
opacity: 1;
transform: translateY(0);
}
}

.search-popup-top {
flex-shrink: 0;
padding: 1.5rem;
background: rgba(255, 255, 255, 0.02);
border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.search-popup-header {
display: flex;
align-items: center;
gap: 0.75rem;
background: rgba(255, 255, 255, 0.04);
border: 1px solid rgba(255, 255, 255, 0.1);
border-radius: 0.75rem;
padding: 0.875rem 1rem;
transition: all 0.2s ease;
margin-bottom: 1rem;
}

.search-popup-header:focus-within {
background: rgba(255, 255, 255, 0.06);
border-color: rgba(74, 158, 255, 0.5);
box-shadow: 0 0 0 3px rgba(74, 158, 255, 0.1);
}

.search-popup-icon {
width: 20px;
height: 20px;
color: #9ca3af;
transition: color 0.2s ease;
flex-shrink: 0;
}

.search-popup-header:focus-within .search-popup-icon {
color: #4a9eff;
}

.search-popup-input {
flex: 1;
background: none;
border: none;
outline: none;
color: white;
font-size: 16px;
}

.search-popup-input::placeholder {
color: #9ca3af;
}

.search-popup-close {
flex-shrink: 0;
width: 32px;
height: 32px;
display: flex;
align-items: center;
justify-content: center;
background: rgba(255, 255, 255, 0.05);
border: 1px solid rgba(255, 255, 255, 0.1);
border-radius: 0.5rem;
color: rgba(255, 255, 255, 0.7);
cursor: pointer;
transition: all 0.2s ease;
}

.search-popup-close:hover {
background: rgba(239, 68, 68, 0.2);
border-color: rgba(239, 68, 68, 0.3);
color: #ef4444;
}

.search-popup-tabs {
display: flex;
gap: 0.375rem;
padding: 0.25rem;
background: rgba(255, 255, 255, 0.02);
border-radius: 0.625rem;
border: 1px solid rgba(255, 255, 255, 0.06);
}

.search-tab {
flex: 1;
padding: 0.5rem 1rem;
background: transparent;
border: none;
color: rgba(255, 255, 255, 0.6);
font-size: 0.875rem;
font-weight: 500;
border-radius: 0.375rem;
cursor: pointer;
transition: all 0.2s ease;
}

.search-tab:hover {
color: rgba(255, 255, 255, 0.9);
background: rgba(255, 255, 255, 0.05);
}

.search-tab.active {
background: rgba(255, 255, 255, 0.1);
color: white;
}

.search-popup-results {
flex: 1;
overflow-y: scroll;
overflow-x: hidden;
padding: 1.5rem;
min-height: 0;
}

.search-popup-results::-webkit-scrollbar {
width: 10px;
}

.search-popup-results::-webkit-scrollbar-track {
background: rgba(255, 255, 255, 0.08);
border-radius: 5px;
margin: 4px 0;
}

.search-popup-results::-webkit-scrollbar-thumb {
background: rgba(255, 255, 255, 0.3);
border-radius: 5px;
border: 2px solid transparent;
background-clip: padding-box;
}

.search-popup-results::-webkit-scrollbar-thumb:hover {
background: rgba(255, 255, 255, 0.5);
border: 2px solid transparent;
background-clip: padding-box;
}

.search-empty-state {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
padding: 3rem 1rem;
color: rgba(255, 255, 255, 0.5);
}

.search-empty-icon {
width: 48px;
height: 48px;
margin-bottom: 1rem;
opacity: 0.5;
}

.search-empty-text {
font-size: 0.875rem;
margin: 0;
}

.search-loading {
display: flex;
align-items: center;
justify-content: center;
padding: 2rem;
color: rgba(255, 255, 255, 0.5);
}

.search-spinner {
width: 24px;
height: 24px;
border: 2px solid rgba(255, 255, 255, 0.1);
border-top-color: rgba(255, 255, 255, 0.5);
border-radius: 50%;
animation: spin 0.8s linear infinite;
}

@keyframes spin {
to {
transform: rotate(360deg);
}
}

.search-result-card {
display: flex;
gap: 1rem;
padding: 1rem;
background: rgba(255, 255, 255, 0.03);
border: 1px solid rgba(255, 255, 255, 0.08);
border-radius: 0.75rem;
transition: all 0.2s ease;
text-decoration: none;
color: inherit;
position: relative;
margin-bottom: 0.75rem;
}

.search-result-card:last-child {
margin-bottom: 0;
}

.search-result-card:hover {
background: rgba(255, 255, 255, 0.05);
border-color: rgba(255, 255, 255, 0.15);
transform: translateY(-1px);
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.search-result-avatar {
width: 48px;
height: 48px;
border-radius: 50%;
object-fit: cover;
flex-shrink: 0;
border: 2px solid rgba(255, 255, 255, 0.1);
}

.search-result-content {
flex: 1;
min-width: 0;
}

.search-result-header {
display: flex;
align-items: center;
gap: 0.5rem;
margin-bottom: 0.25rem;
}

.search-result-name {
font-weight: 600;
color: white;
font-size: 0.9375rem;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}

.search-result-username {
font-size: 0.875rem;
color: rgba(255, 255, 255, 0.5);
margin: 0 0 0.5rem 0;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}

.search-result-bio {
font-size: 0.875rem;
color: rgba(255, 255, 255, 0.7);
margin: 0 0 0.75rem 0;
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-line-clamp: 2;
line-clamp: 2;
-webkit-box-orient: vertical;
line-height: 1.4;
}

.search-result-text {
font-size: 0.9375rem;
color: rgba(255, 255, 255, 0.85);
margin: 0;
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-line-clamp: 2;
line-clamp: 2;
-webkit-box-orient: vertical;
line-height: 1.4;
}

.search-result-stats {
display: flex;
gap: 1rem;
margin-top: 0;
}

.search-stat {
display: flex;
align-items: center;
gap: 0.375rem;
font-size: 0.8125rem;
color: rgba(255, 255, 255, 0.6);
font-weight: 500;
}

.search-stat i {
font-size: 0.875rem;
color: rgba(255, 255, 255, 0.4);
}

.search-result-type-badge {
padding: 0.25rem 0.625rem;
border-radius: 0.375rem;
font-size: 0.6875rem;
font-weight: 700;
text-transform: uppercase;
letter-spacing: 0.5px;
flex-shrink: 0;
}

.profile-badge {
background: rgba(74, 158, 255, 0.15);
border: 1px solid rgba(74, 158, 255, 0.3);
color: rgba(74, 158, 255, 1);
}

.post-badge {
background: rgba(168, 85, 247, 0.15);
border: 1px solid rgba(168, 85, 247, 0.3);
color: rgba(168, 85, 247, 1);
}

.search-result-card.post-card {
flex-direction: column;
gap: 0.75rem;
}

.search-result-post-header {
display: flex;
align-items: center;
gap: 0.75rem;
}

.search-result-post-avatar {
width: 40px;
height: 40px;
border-radius: 50%;
object-fit: cover;
flex-shrink: 0;
border: 2px solid rgba(255, 255, 255, 0.15);
}

.search-result-post-user {
flex: 1;
min-width: 0;
}

.search-result-post-user .search-result-name {
display: block;
margin-bottom: 0.125rem;
}

.search-result-post-user .search-result-username {
margin: 0;
font-size: 0.8125rem;
}

.search-result-media {
width: 100%;
max-width: 100%;
border-radius: 0.75rem;
overflow: hidden;
border: 1px solid rgba(255, 255, 255, 0.08);
background: rgba(0, 0, 0, 0.2);
transition: all 0.2s ease;
position: relative;
}

.search-result-media:hover {
border-color: rgba(255, 255, 255, 0.15);
transform: translateY(-1px);
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.search-result-media img {
width: 100%;
height: auto;
max-height: 280px;
object-fit: cover;
display: block;
background: linear-gradient(
90deg,
rgba(255, 255, 255, 0.03) 0%,
rgba(255, 255, 255, 0.06) 50%,
rgba(255, 255, 255, 0.03) 100%
);
background-size: 200% 100%;
animation: shimmer 1.5s ease-in-out infinite;
}

.search-result-media img[src] {
animation: none;
background: rgba(0, 0, 0, 0.1);
}

@keyframes shimmer {
0% {
background-position: -200% 0;
}
100% {
background-position: 200% 0;
}
}

.search-result-media.video {
aspect-ratio: 16 / 9;
}

.search-media-video-wrapper {
position: relative;
width: 100%;
height: 100%;
}

.search-media-video-wrapper video {
width: 100%;
height: 100%;
object-fit: cover;
display: block;
}

.search-media-play-icon {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
width: 48px;
height: 48px;
background: rgba(0, 0, 0, 0.7);
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
color: white;
pointer-events: none;
backdrop-filter: blur(4px);
border: 2px solid rgba(255, 255, 255, 0.3);
transition: all 0.2s ease;
}

.search-result-media:hover .search-media-play-icon {
background: rgba(0, 0, 0, 0.85);
border-color: rgba(255, 255, 255, 0.5);
transform: translate(-50%, -50%) scale(1.1);
}

.search-media-play-icon svg {
width: 20px;
height: 20px;
margin-left: 2px;
}

.search-result-footer {
display: flex;
align-items: flex-end;
justify-content: space-between;
gap: 1rem;
margin-top: 0.5rem;
}

.search-result-post-body {
display: flex;
gap: 0.75rem;
align-items: flex-start;
}

.post-card.has-media .search-result-media {
margin-top: 0.75rem;
}

.post-card.no-media .search-result-content {
padding-top: 0;
}

.post-card.no-media .search-result-text {
margin-bottom: 0.5rem;
}

.post-card.no-media .search-result-footer {
margin-top: 0.25rem;
}

.search-result-reactions {
display: flex;
gap: 0.5rem;
flex-wrap: wrap;
}

.search-reaction {
display: inline-flex;
align-items: center;
gap: 0.25rem;
padding: 0.25rem 0.5rem;
background: rgba(255, 255, 255, 0.05);
border: 1px solid rgba(255, 255, 255, 0.1);
border-radius: 0.375rem;
font-size: 0.8125rem;
color: rgba(255, 255, 255, 0.8);
}

.search-result-action-btn {
display: inline-flex;
align-items: center;
gap: 0.5rem;
padding: 0.5rem 1rem;
background: rgba(74, 158, 255, 0.15);
border: 1px solid rgba(74, 158, 255, 0.3);
border-radius: 0.5rem;
color: rgba(74, 158, 255, 1);
font-size: 0.8125rem;
font-weight: 600;
text-decoration: none;
transition: all 0.2s ease;
margin-top: 0.5rem;
}

.search-result-action-btn:hover {
background: rgba(74, 158, 255, 0.25);
border-color: rgba(74, 158, 255, 0.5);
transform: translateY(-1px);
}

.search-result-action-btn i {
font-size: 0.875rem;
}

.search-no-results {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
padding: 3rem 1rem;
color: rgba(255, 255, 255, 0.5);
}

.search-no-results-icon {
width: 48px;
height: 48px;
margin-bottom: 1rem;
opacity: 0.5;
}

.search-no-results-text {
font-size: 0.875rem;
margin: 0;
}

/* Tablet devices */
@media (max-width: 768px) {
.search-result-media img {
max-height: 240px;
}

.search-media-play-icon {
width: 44px;
height: 44px;
}

.search-media-play-icon svg {
width: 18px;
height: 18px;
}
}

/* Mobile devices */
@media (max-width: 640px) {
.search-popup-header {
padding: 1rem 1.25rem;
}

.search-popup-input {
font-size: 16px;
}

.search-result-card {
padding: 1rem;
}

.search-result-avatar {
width: 44px;
height: 44px;
}

.search-result-post-avatar {
width: 36px;
height: 36px;
}

.search-result-media img {
max-height: 200px;
}

.search-result-media {
border-radius: 0.625rem;
}

.search-media-play-icon {
width: 40px;
height: 40px;
}

.search-media-play-icon svg {
width: 16px;
height: 16px;
}

.search-popup-tabs {
gap: 0.375rem;
}

.search-tab {
font-size: 0.8125rem;
padding: 0.5rem 0.75rem;
}

.search-result-footer {
flex-direction: column;
align-items: flex-start;
gap: 0.75rem;
}

.search-result-action-btn {
width: 100%;
justify-content: center;
}

.search-popup-close {
top: 1rem;
right: 1rem;
width: 32px;
height: 32px;
}

.post-card.has-media .search-result-media {
margin-top: 0.625rem;
}
}
