:root {
    --bg-main: #0B0F19;
    --bg-secondary: #151B2B;
    --text-primary: #F8FAFC;
    --text-secondary: #94A3B8;
    --accent-glow: rgba(139, 92, 246, 0.5);
    --accent-gradient: linear-gradient(135deg, #8B5CF6, #3B82F6, #10B981);
    --glass-bg: rgba(21, 27, 43, 0.6);
    --glass-border: rgba(255, 255, 255, 0.08);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --card-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.5);
}

body.light-mode {
    --bg-main: #F8FAFC;
    --bg-secondary: #FFFFFF;
    --text-primary: #0F172A;
    --text-secondary: #475569;
    --glass-bg: rgba(255, 255, 255, 0.7);
    --glass-border: rgba(0, 0, 0, 0.1);
    --card-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.1);
}

body.light-mode .logo i {
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

body.light-mode .input-group input {
    background: rgba(0, 0, 0, 0.05);
    color: var(--text-primary);
}

body.light-mode .search-bar input {
    background: rgba(0, 0, 0, 0.05);
    color: var(--text-primary);
}

body.light-mode .filter-btn {
    background: var(--bg-secondary);
    color: var(--text-secondary);
}

body.light-mode .filter-btn:hover {
    color: var(--text-primary);
    border-color: rgba(0, 0, 0, 0.2);
}

body.light-mode .filter-btn.active {
    background: var(--text-primary);
    color: var(--bg-secondary);
    border-color: var(--text-primary);
}

body.light-mode .wallpaper-author {
    color: #fff; /* Keep author text white as it has dark overlay */
}

body.light-mode .close-btn {
    color: white; /* Close btn on full image should stay white as modal is dark */
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-main);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
}

/* Animations */
@keyframes slideUpFade {
    0% { opacity: 0; transform: translateY(30px); }
    100% { opacity: 1; transform: translateY(0); }
}

@keyframes floatText {
    0% { transform: translateY(0); }
    50% { transform: translateY(-12px); }
    100% { transform: translateY(0); }
}

@keyframes gradientShift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* Typography & Accents */
.gradient-text {
    background: var(--accent-gradient);
    background-size: 200% auto;
    animation: gradientShift 4s ease infinite;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.glass-effect {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
}

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(11, 15, 25, 0.85);
    backdrop-filter: blur(8px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    transition: var(--transition);
}

.modal-overlay.hidden {
    opacity: 0;
    pointer-events: none;
    visibility: hidden;
}

.modal-content {
    padding: 3rem;
    border-radius: 24px;
    width: 90%;
    max-width: 450px;
    text-align: center;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    transform: translateY(0);
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.modal-overlay.hidden .modal-content {
    transform: translateY(30px);
}

.modal-content h2 {
    font-size: 2rem;
    margin-bottom: 1rem;
    font-weight: 600;
}

.modal-content p {
    color: var(--text-secondary);
    margin-bottom: 2rem;
    font-size: 1rem;
    line-height: 1.5;
}

.modal-content a {
    color: #3B82F6;
    text-decoration: none;
}

.modal-content a:hover {
    text-decoration: underline;
}

.input-group {
    position: relative;
    margin-bottom: 1.5rem;
}

.input-group i {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
    font-size: 1.2rem;
}

.input-group input {
    width: 100%;
    padding: 1rem 1rem 1rem 3rem;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 1rem;
    transition: var(--transition);
}

.input-group input:focus {
    outline: none;
    border-color: #8B5CF6;
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.2);
}

.modal-note {
    margin-top: 1.5rem;
    font-size: 0.85rem !important;
    margin-bottom: 0 !important;
    opacity: 0.7;
}

/* Buttons */
.primary-btn {
    width: 100%;
    padding: 1rem;
    background: var(--accent-gradient);
    border: none;
    border-radius: 12px;
    color: white;
    font-family: inherit;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: 0 10px 20px -10px var(--accent-glow);
}

.primary-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 15px 25px -10px var(--accent-glow);
}

.secondary-btn {
    padding: 0.8rem 2rem;
    background: transparent;
    border: 1px solid var(--glass-border);
    border-radius: 100px;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 1rem;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.secondary-btn:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.2);
}

.icon-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
    transition: var(--transition);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.icon-btn:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 0.5rem;
    min-width: 180px;
    border-radius: 12px;
    padding: 0.5rem 0;
    display: flex;
    flex-direction: column;
    box-shadow: 0 10px 25px rgba(0,0,0,0.5);
    z-index: 1000;
}

.dropdown-item {
    padding: 0.8rem 1.5rem;
    color: var(--text-primary);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.8rem;
    font-weight: 500;
    transition: var(--transition);
}

.dropdown-item:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--accent-primary);
}

/* Navbar */
.navbar {
    position: fixed;
    top: 0;
    width: 100%;
    z-index: 100;
    border-bottom: 1px solid var(--glass-border);
}

.nav-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 1rem 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 2rem;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.5rem;
    font-weight: 700;
    color: white;
}

.logo i {
    font-size: 1.8rem;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.search-bar {
    flex: 1;
    max-width: 600px;
    position: relative;
}

.search-bar i {
    position: absolute;
    left: 1.2rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
    font-size: 1.2rem;
}

.search-bar input {
    width: 100%;
    padding: 0.8rem 1rem 0.8rem 3rem;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--glass-border);
    border-radius: 100px;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 1rem;
    transition: var(--transition);
}

.search-bar input:focus {
    outline: none;
    background: rgba(0, 0, 0, 0.4);
    border-color: rgba(255, 255, 255, 0.2);
}

/* Hero Section */
.hero {
    padding: 8rem 2rem 4rem;
    text-align: center;
    max-width: 1400px;
    margin: 0 auto;
}

.hero h1 {
    font-size: clamp(3rem, 5vw, 5rem);
    font-weight: 700;
    letter-spacing: -1px;
    margin-bottom: 1rem;
    opacity: 0; /* Initial state for animation */
    animation: slideUpFade 1s cubic-bezier(0.4, 0, 0.2, 1) forwards 0.2s, floatText 4s ease-in-out infinite 1.2s;
}

.hero p {
    font-size: 1.2rem;
    color: var(--text-secondary);
    margin-bottom: 3rem;
}

.filters {
    display: flex;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.horizontal-scroll {
    display: flex;
    gap: 1rem;
    overflow-x: auto;
    padding-bottom: 0.5rem;
    -ms-overflow-style: none; /* IE and Edge */
    scrollbar-width: none; /* Firefox */
    width: 100%;
    justify-content: flex-start;
}
.horizontal-scroll > * {
    flex-shrink: 0;
}
.horizontal-scroll::-webkit-scrollbar {
    display: none; /* Chrome, Safari and Opera */
}
@media (min-width: 640px) {
    .horizontal-scroll {
        justify-content: center;
    }
}

.filter-btn {
    padding: 0.8rem 1.5rem;
    background: var(--bg-secondary);
    border: 1px solid var(--glass-border);
    border-radius: 100px;
    color: var(--text-secondary);
    font-family: inherit;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.filter-btn:hover {
    color: var(--text-primary);
    border-color: rgba(255, 255, 255, 0.2);
}

.filter-btn.active {
    background: var(--text-primary);
    color: var(--bg-main);
    border-color: var(--text-primary);
}

/* Gallery Section */
.gallery-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 2rem 4rem;
}

/* Responsive Masonry Layout approach using columns */
.gallery {
    columns: 1;
    column-gap: 1.5rem;
}

@media (min-width: 640px) {
    .gallery { columns: 2; }
}

@media (min-width: 1024px) {
    .gallery { columns: 3; }
}

@media (min-width: 1280px) {
    .gallery { columns: 4; }
}

.wallpaper-card {
    break-inside: avoid;
    margin-bottom: 1.5rem;
    position: relative;
    border-radius: 16px;
    overflow: hidden;
    background: var(--bg-secondary);
    cursor: zoom-in;
    box-shadow: var(--card-shadow);
    transform: translateZ(0);
}

.wallpaper-img {
    width: 100%;
    display: block;
    transition: transform 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    background-color: var(--bg-secondary);
    min-height: 200px;
}

.wallpaper-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.8) 0%, transparent 50%);
    opacity: 0;
    transition: opacity 0.3s ease;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 1.5rem;
    pointer-events: none;
}

.wallpaper-card:hover .wallpaper-img {
    transform: scale(1.05);
}

.wallpaper-card:hover .wallpaper-overlay {
    opacity: 1;
}

.wallpaper-info {
    transform: translateY(10px);
    transition: transform 0.3s ease;
}

.wallpaper-card:hover .wallpaper-info {
    transform: translateY(0);
}

.wallpaper-author {
    color: white;
    font-weight: 500;
    font-size: 1rem;
    margin-bottom: 0.25rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Skeleton Loading */
.skeleton {
    animation: pulse 1.5s infinite ease-in-out;
    background: linear-gradient(90deg, var(--bg-secondary) 25%, rgba(255,255,255,0.05) 50%, var(--bg-secondary) 75%);
    background-size: 200% 100%;
}

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

.loading-indicator {
    text-align: center;
    padding: 4rem 0;
    color: var(--text-secondary);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255,255,255,0.1);
    border-radius: 50%;
    border-top-color: #8B5CF6;
    animation: spin 1s ease-in-out infinite;
}

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

.load-more-container {
    text-align: center;
    margin-top: 3rem;
}

/* Fullscreen Modal */
#imageModal {
    background: rgba(0, 0, 0, 0.95);
}

.close-btn {
    position: absolute;
    top: 2rem;
    right: 2rem;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: white;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    font-size: 2rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1010;
    transition: var(--transition);
}

.close-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: rotate(90deg);
}

.full-image-container {
    max-width: 90vw;
    max-height: 90vh;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
}

#fullImage, #fullVideo {
    max-width: 100%;
    max-height: 80vh;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 1);
}

.image-actions {
    margin-top: 1.5rem;
    padding: 1rem 2rem;
    border-radius: 100px;
    display: flex;
    align-items: center;
    gap: 2rem;
    width: max-content;
}

.photographer-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 500;
}

.download-btn {
    padding: 0.6rem 1.5rem;
    border-radius: 100px;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    font-size: 1rem;
}

/* Eye Comfort Mode */
.eye-comfort-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(255, 166, 0, 0.12); /* Warm amber */
    mix-blend-mode: multiply;
    pointer-events: none;
    z-index: 9999;
    transition: opacity 0.5s ease;
}

.eye-comfort-overlay.hidden {
    opacity: 0;
    visibility: hidden;
}

body.light-mode .eye-comfort-overlay {
    background-color: rgba(255, 153, 0, 0.15); /* Slightly stronger in light mode */
}

/* Responsive */
@media (max-width: 768px) {
    .nav-container {
        flex-direction: column;
        gap: 0.8rem;
        padding: 1rem;
    }
    
    .nav-links {
        flex-wrap: wrap;
        justify-content: center;
        gap: 1rem !important;
        font-size: 0.9rem;
    }

    .search-bar {
        width: 100%;
        order: 3;
    }
    
    .nav-actions {
        position: absolute;
        right: 1rem;
        top: 1rem;
    }
    
    .hero {
        padding-top: 15rem; /* Increased padding to ensure categories clear the mobile navbar */
        display: flex;
        flex-direction: column;
    }
    
    .scroll-wrapper {
        order: -1;
        margin-top: 0 !important; /* Restored margin-top to avoid overlapping the fixed navbar */
        margin-bottom: 2rem !important;
        width: calc(100% + 4rem) !important; /* Negate the 2rem left/right padding of hero */
        margin-left: -2rem; 
        margin-right: -2rem;
    }

    .scroll-arrow {
        display: none !important; /* Hide arrows on mobile, users can swipe */
    }

    .horizontal-scroll {
        padding: 0 2rem; /* Add padding matching screen edge so first item isn't clipped */
        justify-content: flex-start;
    }
    
    .hero h1 {
        font-size: 2.5rem;
        margin-top: 1rem;
    }
    
    .hero p {
        font-size: 1rem;
        padding: 0 1rem;
    }

    .image-actions {
        flex-direction: column;
        border-radius: 16px;
        gap: 1rem;
        text-align: center;
        padding: 1.5rem;
    }
    
    .close-btn {
        top: 1rem;
        right: 1rem;
        width: 40px;
        height: 40px;
    }
    
    .splash-logo {
        height: 90px;
        width: 90px;
    }
    
    .splash-text {
        font-size: 1.6rem;
    }
    
    .gallery {
        columns: 2;
        column-gap: 1rem;
        padding: 0 1rem;
    }
    
    .dropdown-menu {
        right: -1rem; /* Adjust so it doesn't clip off the right edge */
    }

    .auth-container {
        width: 90%;
        max-width: 400px;
        margin: 6rem auto 3rem;
        padding: 2rem 1.5rem;
        border-radius: 20px;
    }
    
    .auth-container h1 {
        font-size: 1.8rem;
        margin-bottom: 1.5rem;
    }
}

/* Nav Links & Auth */
.nav-links {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.nav-links a {
    color: var(--text-primary);
    text-decoration: none;
    font-weight: 500;
    transition: var(--transition);
}

.nav-links a:hover {
    color: #8B5CF6;
}

.hidden {
    display: none !important;
}

.auth-container {
    max-width: 450px;
    margin: 8rem auto 4rem;
    padding: 3rem;
    border-radius: 24px;
    text-align: center;
}

.auth-container h1 {
    margin-bottom: 2rem;
    font-size: 2.5rem;
}

.auth-error {
    color: #EF4444;
    margin-bottom: 1rem;
    font-size: 0.9rem;
    display: none;
}

/* Favorites Button */
.favorite-btn {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: rgba(0, 0, 0, 0.5);
    border: none;
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 1.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: var(--transition);
    z-index: 10;
}

.wallpaper-card:hover .favorite-btn {
    opacity: 1;
}

.favorite-btn:hover {
    background: rgba(139, 92, 246, 0.8);
    transform: scale(1.1);
}

.favorite-btn.saved {
    color: #EF4444;
    opacity: 1;
}

@keyframes heartPopAnim {
    0% { transform: scale(1); }
    50% { transform: scale(1.6); }
    100% { transform: scale(1); }
}

.favorite-btn.saved i {
    animation: heartPopAnim 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* Floating Heart Bubble Animation */
.floating-heart {
    position: fixed;
    font-size: 1.5rem;
    pointer-events: none;
    z-index: 9999;
    animation: floatUp ease-in forwards;
}

@keyframes floatUp {
    0% {
        transform: translateY(0) scale(0.5);
        opacity: 1;
    }
    50% {
        transform: translateY(-50px) scale(1.2) translateX(15px);
        opacity: 0.8;
    }
    100% {
        transform: translateY(-120px) scale(1) translateX(-15px);
        opacity: 0;
    }
}

/* Splash Screen Animation */
.splash-screen {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    z-index: 999999;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: opacity 0.8s ease, visibility 0.8s ease;
}

.splash-screen.hidden-splash {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.splash-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
    animation: splashZoomIn 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

.splash-logo {
    height: 120px;
    width: 120px;
    object-fit: contain;
    filter: drop-shadow(0 0 20px rgba(255, 255, 255, 0.3));
    animation: splashFloat 3s ease-in-out infinite;
}

.splash-text {
    font-size: 2.2rem;
    font-weight: 700;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: 2px;
    opacity: 0;
    animation: splashFadeInUp 0.8s ease forwards 0.5s;
    text-align: center;
}

@keyframes splashZoomIn {
    0% { transform: scale(0.5); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

@keyframes splashFloat {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-15px); }
}

@keyframes splashFadeInUp {
    0% { transform: translateY(30px); opacity: 0; }
    100% { transform: translateY(0); opacity: 1; }
}
