:root { 
    --black: #000; 
    --white: #fff; 
    --gray: #f8f8f8; 
    --dark-gray: #666; 
    --red: #ff4d4d; 
    --blue: #007aff; 
}

* { 
    margin: 0; 
    padding: 0; 
    box-sizing: border-box; 
    font-family: 'Inter', sans-serif; 
    -webkit-tap-highlight-color: transparent; 
}

body { 
    background: var(--white); 
    color: var(--black); 
    line-height: 1.5; 
    overflow-x: hidden; 
}

/* Navbar */
nav {
    position: fixed; 
    top: 0; 
    width: 100%; 
    height: 65px; 
    background: rgba(255,255,255,0.8);
    backdrop-filter: blur(15px); 
    -webkit-backdrop-filter: blur(15px);
    display: flex; 
    align-items: center; 
    justify-content: space-between;
    padding: 0 5%; 
    border-bottom: 1px solid #f0f0f0; 
    z-index: 1000;
}

.logo { 
    font-family: 'Space Grotesk', sans-serif; 
    font-size: 1.3rem; 
    letter-spacing: -1px; 
    font-weight: 700; 
    text-decoration: none; 
    color: #000; 
}

.nav-links { 
    display: flex; 
    align-items: center; 
    gap: 20px; 
}

.nav-links a, .nav-icon-btn { 
    text-decoration: none; 
    color: var(--black); 
    display: flex; 
    align-items: center; 
    position: relative; 
    transition: 0.2s;
    background: none;
    border: none;
    cursor: pointer;
}

.nav-links i { 
    width: 22px; 
    height: 22px; 
    stroke-width: 2px; 
}

/* Search Overlay */
.search-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 2000;
    align-items: flex-start;
    justify-content: center;
    padding-top: 80px;
}

.search-container {
    width: 100%;
    max-width: 600px;
    margin: 0 20px;
}

.search-header {
    background: var(--white);
    border-radius: 12px;
    padding: 15px 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

.close-search {
    background: none;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    color: var(--black);
    padding: 5px;
}

.close-search i {
    width: 24px;
    height: 24px;
}

.search-form {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 10px;
}

.search-form i {
    width: 20px;
    height: 20px;
    color: var(--dark-gray);
}

.search-form input {
    flex: 1;
    border: none;
    outline: none;
    font-size: 1rem;
    color: var(--black);
}

.search-form input::placeholder {
    color: var(--dark-gray);
}

/* Dropdown Styling */
.user-dropdown, .sort-dropdown { 
    position: relative; 
    display: inline-block; 
}

.avatar-btn { 
    width: 35px; 
    height: 35px; 
    border-radius: 50%; 
    object-fit: cover; 
    cursor: pointer; 
    border: 1.5px solid #eee; 
    transition: 0.2s;
}

.avatar-btn:hover { 
    border-color: var(--black); 
}

.dropdown-content {
    display: none; 
    position: absolute; 
    right: 0; 
    top: 45px;
    background-color: var(--white); 
    min-width: 180px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1); 
    border-radius: 12px;
    overflow: hidden; 
    border: 1px solid #f0f0f0; 
    z-index: 1001;
    padding: 8px 0;
}

.dropdown-content a, .dropdown-content button {
    padding: 12px 16px; 
    text-decoration: none; 
    display: flex;
    align-items: center; 
    gap: 10px; 
    color: var(--black); 
    font-size: 0.9rem;
    width: 100%; 
    border: none; 
    background: none; 
    cursor: pointer; 
    text-align: left;
}

.dropdown-content a:hover, .dropdown-content button:hover { 
    background-color: var(--gray); 
}

.dropdown-content i { 
    width: 18px !important; 
    height: 18px !important; 
}

.show { 
    display: block; 
    animation: fadeIn 0.2s ease; 
}

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

.btn-login { 
    background: var(--black); 
    color: var(--white) !important; 
    padding: 8px 18px; 
    border-radius: 20px; 
    font-size: 0.85rem; 
    font-weight: 600; 
}

.notif-badge { 
    background: var(--red); 
    color: white; 
    font-size: 0.6rem; 
    padding: 2px 5px; 
    border-radius: 10px; 
    position: absolute; 
    top: -8px; 
    right: -10px; 
    min-width: 15px; 
    text-align: center; 
}

/* Header */
header { 
    margin-top: 100px; 
    padding: 0 5% 30px 5%; 
    display: flex; 
    justify-content: space-between; 
    align-items: flex-end; 
}

header h1 { 
    font-family: 'Space Grotesk', sans-serif; 
    font-size: clamp(2.5rem, 10vw, 4rem); 
    letter-spacing: -2px; 
    line-height: 0.9; 
}

header p { 
    color: var(--dark-gray); 
    margin-top: 10px; 
    font-size: 1rem; 
}

.sort-trigger { 
    display: flex; 
    align-items: center; 
    gap: 8px; 
    cursor: pointer; 
    font-weight: 600; 
    font-size: 0.9rem; 
    padding: 8px 15px; 
    background: var(--gray); 
    border-radius: 20px; 
}

/* Feed Grid */
.feed { 
    display: grid; 
    grid-template-columns: repeat(4, 1fr);
    gap: 20px; 
    padding: 0 5% 20px 5%; 
}

.photo-card { 
    position: relative; 
    overflow: hidden; 
    border-radius: 15px; 
    background: var(--gray); 
    cursor: pointer;
    aspect-ratio: 16/10;
}

.skeleton {
    position: absolute; 
    inset: 0;
    background: linear-gradient(90deg, #f0f0f0 25%, #e8e8e8 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite linear;
    z-index: 1;
}

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

.photo-card img, .photo-card video { 
    width: 100%; 
    height: 100%; 
    object-fit: cover; 
    display: block; 
    transition: transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
    opacity: 0; 
}

.media-loaded { 
    opacity: 1 !important; 
}

.media-badge {
    position: absolute; 
    top: 12px; 
    right: 12px;
    background: rgba(0, 0, 0, 0.7); 
    color: #fff;
    padding: 4px 8px; 
    border-radius: 6px; 
    font-size: 0.7rem;
    font-weight: 600; 
    z-index: 5; 
    backdrop-filter: blur(5px);
    display: flex; 
    align-items: center; 
    gap: 4px;
    pointer-events: none;
}

.photo-info {
    position: absolute; 
    bottom: 0; 
    left: 0; 
    right: 0; 
    padding: 20px;
    background: linear-gradient(transparent, rgba(0,0,0,0.8));
    color: var(--white); 
    opacity: 0; 
    transition: 0.3s; 
    z-index: 2;
}

.photo-card:hover .photo-info { 
    opacity: 1; 
}

.photo-card:hover img, .photo-card:hover video { 
    transform: scale(1.05); 
}

/* Loader */
.loader-container { 
    width: 100%; 
    text-align: center; 
    padding: 40px 0; 
    display: none; 
}

.spinner { 
    width: 30px; 
    height: 30px; 
    border: 3px solid #eee; 
    border-top: 3px solid #000; 
    border-radius: 50%; 
    animation: spin 0.8s linear infinite; 
    display: inline-block;
}

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

/* FAB */
.fab {
    position: fixed; 
    bottom: 30px; 
    right: 25px; 
    background: var(--black);
    color: var(--white); 
    width: 55px; 
    height: 55px; 
    border-radius: 50%;
    display: flex; 
    align-items: center; 
    justify-content: center;
    font-size: 1.8rem; 
    text-decoration: none; 
    box-shadow: 0 8px 25px rgba(0,0,0,0.3);
    z-index: 999; 
    transition: 0.3s;
}

/* Sort Overlay */
#sort-overlay {
    display: none; 
    position: fixed; 
    inset: 0; 
    background: rgba(255,255,255,0.7);
    z-index: 2000; 
    align-items: center; 
    justify-content: center; 
    backdrop-filter: blur(5px);
}

/* Search Results Page */
.search-page-header {
    margin-top: 100px;
    padding: 30px 5%;
    border-bottom: 1px solid #f0f0f0;
}

.search-page-header h1 {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 2rem;
    margin-bottom: 10px;
}

.search-page-header p {
    color: var(--dark-gray);
    font-size: 1rem;
}

.search-results-container {
    padding: 30px 5%;
}

.search-section {
    margin-bottom: 50px;
}

.search-section h2 {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1.5rem;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.search-section h2 i {
    width: 24px;
    height: 24px;
}

/* Users Grid */
.users-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.user-card {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px;
    background: var(--gray);
    border-radius: 12px;
    text-decoration: none;
    color: var(--black);
    transition: 0.2s;
}

.user-card:hover {
    background: #f0f0f0;
    transform: translateY(-2px);
}

.user-card img {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    object-fit: cover;
}

.user-info h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 2px;
}

.user-info p {
    font-size: 0.85rem;
    color: var(--dark-gray);
}

/* Load More Button */
.load-more-btn {
    display: block;
    margin: 20px auto;
    padding: 12px 30px;
    background: var(--black);
    color: var(--white);
    border: none;
    border-radius: 25px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: 0.2s;
}

.load-more-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

/* No Results */
.no-results {
    text-align: center;
    padding: 80px 20px;
}

.no-results h2 {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1.8rem;
    margin: 20px 0 10px 0;
}

.no-results p {
    color: var(--dark-gray);
    font-size: 1rem;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    header { 
        flex-direction: column; 
        align-items: flex-start; 
        gap: 20px; 
    }
    
    .feed { 
        grid-template-columns: 1fr; 
        gap: 15px; 
        padding: 0 15px; 
    }
    
    .photo-info { 
        opacity: 1; 
    }

    .search-container {
        margin: 0 15px;
    }

    .users-grid {
        grid-template-columns: 1fr;
    }
}