:root {
    --primary: #0a84ff;
    --primary-dark: #007aff;
    --bg-gradient: #000000;
    --surface: rgba(30, 30, 30, 0.65);
    --muted: #98989d;
    --radius: 18px;
    --ease: cubic-bezier(.2, .8, .2, 1);
    --glass-border: rgba(255, 255, 255, 0);

    /* Theme Variables (Dark Default) */
    --bg-body: #0c0f16;
    --bg-surface: #161618;
    --bg-sidebar: #0c0f16;
    --text-primary: #ffffff;
    --text-secondary: #98989d;
    --border-color: rgba(255, 255, 255, 0.1);
    --hover-bg: rgba(255, 255, 255, 0.05);
    --input-bg: rgba(0, 0, 0, 0.2);
    --bg-surface-darker: #101010;
    --bg-surface-lighter: #202020;
}

[data-theme="light"] {
    --bg-body: #f2f2f7;
    --bg-surface: #ffffff;
    --bg-sidebar: #ffffff;
    --text-primary: #1d1d1f;
    --text-secondary: #86868b;
    --border-color: rgba(0, 0, 0, 0.1);
    --hover-bg: rgba(0, 0, 0, 0.05);
    --input-bg: rgba(0, 0, 0, 0.05);
    --bg-surface-darker: #e0e0e0;
    --bg-surface-lighter: #f0f0f0;
}

/* RESET */
* {
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    margin: 0;
    min-height: 100vh;
    background-color: var(--bg-body);

    background-attachment: fixed;
    padding: 120px 24px 24px 100px;
    color: var(--text-primary);
    -webkit-user-select: none;
    user-select: none;

}

/* Truncate text in viewer details */
.description-box p {
    display: flex;
    align-items: center;
    max-width: 100%;
}

.description-box p strong {
    flex-shrink: 0;
    margin-right: 5px;
}

#viewerTitle,
#viewerDescription {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    min-width: 0;
    /* Required for flexbox truncation */
}

.similar-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    padding: 10px;
    margin-top: 20px;
}

.viewer-scroll-view {
    width: 100%;
}

/* Mobile Layout Fixes */
@media (max-width: 768px) {
    .profile-header-banner {
        padding: 20px 10px !important;
        margin-bottom: 20px !important;
    }

    .profile-avatar-large {
        width: 100px !important;
        height: 100px !important;
    }

    #publicProfileName {
        font-size: 1.8rem !important;
    }

    /* Ensure sections don't break layout */
    .content-section {
        width: 100%;
        overflow-x: hidden;
    }
}

/* Pexels-like Simple Banner Styles */
.welcome-banner {
    background: transparent !important;
    box-shadow: none !important;
    padding: 40px 20px 20px !important;
    min-height: auto !important;
    height: auto !important;
    position: relative;
    overflow: hidden;
    border-radius: 20px;
    margin-bottom: 20px;
}

@media (max-width: 768px) {
    .welcome-banner {
        background: transparent !important;
    }
}

@media (min-width: 769px) {
    .welcome-banner {
        background-image: url('/static/hero.webp') !important;
        background-size: cover !important;
        background-position: center !important;
        height: 400px !important;
        justify-content: center;
    }

    .welcome-banner::before {
        content: '';
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.5);
        z-index: 0;
    }

    .welcome-title,
    .welcome-text,
    .welcome-search-box,
    .welcome-license {
        position: relative;
        z-index: 1;
    }

    .welcome-title {
        color: #fff !important;
    }

    .welcome-text {
        color: rgba(255, 255, 255, 0.9) !important;
    }
}

.welcome-title {
    font-size: 2rem !important;
    font-weight: 700 !important;
    margin-bottom: 8px !important;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.welcome-text {
    font-size: 1rem !important;
    opacity: 0.9;
    max-width: 500px;
    margin-bottom: 25px !important;
}

.welcome-search-box {
    background: #fff !important;
    border: 1px solid rgba(0, 0, 0, 0.1) !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1) !important;
    max-width: 550px !important;
    padding: 6px 12px !important;
    border-radius: 8px !important;
    /* Less rounded, more clean */
}

.welcome-search-input {
    color: #333 !important;
    font-size: 0.95rem !important;
    /* Smaller font */
}

.welcome-search-input::placeholder {
    color: #888 !important;
}

.welcome-search-icon {
    filter: brightness(0) opacity(0.5) !important;
    /* Dark icon */
    width: 18px !important;
    height: 18px !important;
}

/* Library Section Empty State */
.library-empty-msg {
    color: #888;
    padding: 20px;
    text-align: center;
    font-size: 1.1rem;
    width: 100%;
}

@media (max-width: 768px) {
    .library-empty-msg {
        font-size: 0.9rem;
    }
}

/* Mobile Hero Search Bar Improvements */
@media (max-width: 768px) {
    .hero-search-wrapper {
        background: #ffffff !important;
        border: 1px solid rgba(0, 0, 0, 0.1) !important;
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25) !important;
        padding: 12px 15px !important;
        border-radius: 14px !important;
    }

    .hero-search-wrapper input {
        color: #222 !important;
        font-size: 1rem !important;
    }

    .hero-search-wrapper input::placeholder {
        color: #777 !important;
    }

    .hero-search-icon {
        width: 28px !important;
        height: 28px !important;
        stroke: #444 !important;
        min-width: 28px !important;
    }

    .hero-search-actions .hero-icon-btn:not(.ai-gen-btn) img,
    .hero-search-actions .hero-icon-btn:not(.ai-gen-btn) svg {
        filter: brightness(0.2) !important;
    }

    .hero-search-actions .hero-icon-btn:not(.ai-gen-btn) svg path {
        fill: #444 !important;
    }
}

/* Mobile Logged-in Navbar Styles */
.mobile-nav-profile {
    display: none;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    overflow: hidden;
    border: 2px solid var(--primary);
    cursor: pointer;
    margin-left: 10px;
}

.mobile-nav-profile img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.mobile-brand-title {
    display: none;
    position: absolute;
    left: 50%;
    font-family: sans-serif;
    transform: translateX(-50%);
    font-size: 1.3rem;
    font-weight: 800;
    color: var(--text-primary);
    text-decoration: none;
    letter-spacing: -0.5px;
}

.mobile-brand-title span {
    color: var(--primary);
}

@media (max-width: 768px) {
    .mobile-nav-profile {
        display: block;
    }

    .mobile-brand-title {
        display: block;
        font-size: large;
    }

    /* Ensure desktop logo is hidden on mobile when logged in */
    .logo.desktop-view {
        display: none !important;
    }
}

@media (min-width: 769px) {
    .mobile-nav-profile {
        display: none !important;
    }

    .mobile-brand-title {
        display: none !important;
    }
}

/* GLOBAL BUTTON BLUR SETTING */

/* ================= NAVBAR ================= */

/* Allow text selection for inputs and content areas */
input,
textarea,
select,
[contenteditable],
.description-box,
.hero-subtitle-box {
    -webkit-user-select: text;
    user-select: text;
}

.navbar {
    position: fixed;
    top: 0;
    left: 78px;
    right: 24px;
    height: 64px;
    background: var(--bg-body);

    border: none;
    border-radius: 0px 0px 18px 0px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 28px;
    box-shadow: none;
    z-index: 900;
    transition: all .6s var(--ease);
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    background: transparent;
    padding: 4px 8px;
    text-decoration: none;
}

.nav-logo-img {
    height: 38px;
    width: auto;
    border-radius: 8px;
    object-fit: contain;
    content: url('/static/wallpeperspheredark.jpg');
}

[data-theme="light"] .nav-logo-img {
    content: url('/static/wallpepersphere.jpg');
}

.brand-text {
    font-family: 'Outfit', sans-serif;
    font-weight: 800;
    font-size: 1.6rem;
    background: linear-gradient(to right, #ffffff 20%, #3d85ff 50%, #ffffff 80%);
    background-size: 200% auto;
    color: #fff;
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

[data-theme="light"] .brand-text {
    background: linear-gradient(to right, #000000 20%, #3d85ff 50%, #000000 80%);
    background-size: 200% auto;
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.nav-btn {
    background: var(--hover-bg);

    border: none;
    color: var(--text-primary);
    padding: 10px 22px;
    border-radius: 999px;
    text-decoration: none;
    font-weight: 500;
    transition: all .3s var(--ease);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.nav-btn:hover {
    background: var(--primary);
    color: #fff;
    transform: translateY(-2px);
}

.icon-nav-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--hover-bg);

    color: var(--text-primary);
    border: none;
    cursor: pointer;
    transition: all .3s var(--ease);
    text-decoration: none;
}

.icon-nav-btn:hover {
    background: var(--hover-bg);
    color: #fff;
}

/* ================= NAV TABS ================= */
.nav-tabs-container {
    position: fixed;
    top: 64px;
    left: 78px;
    right: 80px;
    /* Space for plus button */
    height: 48px;
    display: flex;
    align-items: center;
    gap: 10px;
    border-radius: 0px 0px 18px 18px;
    padding: 0 10px;
    z-index: 899;
    /* Below navbar */
    transition: all .6s var(--ease);
    overflow-x: auto;
    -ms-overflow-style: none;
    background: var(--bg-body);

    box-shadow: none;
    scrollbar-width: none;
}

.nav-tabs-container::-webkit-scrollbar {
    display: none;
}

.nav-tab {
    padding: 8px 16px;
    border-radius: 10px;
    background: transparent;
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.9rem;
    white-space: nowrap;
    transition: all 0.3s ease;
}

.nav-tab:hover {
    background: var(--hover-bg);
    color: var(--text-primary);
}

.nav-tab.active {
    background: var(--hover-bg);
    color: var(--text-primary);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.nav-tab-plus-btn {
    position: fixed;
    top: 69px;
    right: 24px;
    height: 40px;
    width: 40px;
    border-radius: 50%;
    background: var(--hover-bg);

    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-primary);
    cursor: pointer;
    z-index: 899;
    transition: all 0.3s ease;
}

.nav-tab-plus-btn:hover {
    background: var(--hover-bg);
}

.nav-tab-dropdown {
    position: fixed;
    top: 130px;
    right: 24px;
    width: 320px;
    max-height: 60vh;
    background: var(--bg-surface);

    border-radius: 16px;
    border: 1px solid var(--border-color);
    padding: 12px;
    display: none;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    overflow-y: auto;
    z-index: 901;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    opacity: 0;
    transform: translateY(-10px);
    transition: all 0.3s ease;
}

.nav-tab-dropdown.active {
    display: grid;
    opacity: 1;
    transform: translateY(0);
}

.nav-tab-dropdown .category-item {
    padding: 8px;
    font-size: 0.85rem;
    border-radius: 8px;
    text-align: center;
    cursor: pointer;
    background: var(--hover-bg);
    transition: all 0.2s;
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

.nav-tab-dropdown .category-item:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

/* MOBILE SEARCH TRIGGER */
.mobile-search-btn {
    display: none;
    background: transparent;
    border: none;
    padding: 8px;
    color: var(--text-primary);
    cursor: pointer;
    border-radius: 50%;
    transition: background 0.2s;
}

.mobile-search-btn:hover {
    background: rgba(0, 0, 0, 0.05);
}

/* SEARCH BAR */
.nav-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

.search-wrapper {
    display: flex;
    align-items: center;
    position: relative;
    margin-right: 24px;
    background: var(--input-bg);

    border-radius: 20px;
    padding: 8px 16px;
    transition: all .4s var(--ease);
    border: none;
    box-shadow: none;
    width: 650px;
    height: 58px;
}

.search-wrapper:focus-within {
    background: var(--input-bg);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
    border: none;
    transform: translateY(-1px);
}

.search-icon {
    width: 20px;
    height: 20px;
    margin-right: 10px;
    filter: brightness(0) invert(1);
    opacity: 0.5;
}

[data-theme="light"] .search-icon {
    filter: brightness(0);
}

.search-input {
    flex: 1;
    width: auto;
    min-width: 0;
    opacity: 1;
    border: none;
    background: transparent;
    outline: none;
    font-size: 0.95rem;
    color: var(--text-primary);
    transition: all .4s var(--ease);
    padding: 0;
}

.search-action-btn {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    cursor: pointer;
    transition: .2s;
    background: transparent;
    border: none;
    margin-left: 8px;
}

.search-action-btn:hover {
    background: var(--hover-bg);
    color: var(--text-primary);
}

[data-theme="light"] .search-action-btn img {
    filter: brightness(0);
}

/* SEARCH CATEGORY DROPDOWN */
.search-category-wrapper {
    position: relative;
    margin-right: 12px;
}

.search-category-btn {
    display: flex;
    align-items: center;
    gap: 4px;
    background: var(--hover-bg);
    border: none;
    padding: 6px 10px;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.search-category-btn:hover {
    background: var(--hover-bg);
    color: var(--text-primary);
}

.search-category-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    background: var(--bg-surface);

    border: none;
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    width: 140px;
    padding: 6px;
    display: none;
    flex-direction: column;
    z-index: 100;
    animation: fadeInDropdown 0.2s ease;
}

.search-category-dropdown.active {
    display: flex;
}

@keyframes fadeInDropdown {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.cat-option {
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 0.85rem;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
}

.cat-option:hover {
    background: var(--hover-bg);
    color: var(--text-primary);
}

/* SHARE SEARCH BUTTON */
#shareSearchResultsContainer {
    position: relative;
}

.share-dropdown {
    position: absolute;
    top: calc(100% + 12px);
    right: 0;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 5px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    width: 160px;
    z-index: 100;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px) scale(0.95);
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    cursor: pointer;
    pointer-events: none;
}

#shareSearchResultsContainer:hover .share-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

.share-dropdown.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

#shareSearchDropdownAction {
    padding: 8px 10px;
    border-radius: 8px;
    font-weight: 500;
    font-size: 0.85rem;
    color: var(--text-primary);
    transition: background 0.2s;
    text-align: center;
}

#shareSearchDropdownAction:hover {
    background: var(--hover-bg);
}

/* Flashy Button Animation */
@keyframes pulse-share-btn {
    0% {
        box-shadow: 0 0 0 0 rgba(10, 132, 255, 0.7);
        transform: scale(1);
    }

    50% {
        transform: scale(1.05);
    }

    70% {
        box-shadow: 0 0 0 10px rgba(10, 132, 255, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(10, 132, 255, 0);
        transform: scale(1);
    }
}

#shareSearchResultsBtn {
    background: var(--primary);
    color: white;
    border: none;
    animation: pulse-share-btn 2s infinite;
}

/* ================= SIDEBAR ================= */

.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 64px;
    height: 100vh;
    background: var(--bg-sidebar);

    box-shadow: 0 20px 40px rgba(0, 0, 0, .4);
    border-right: none;
    border-radius: 0px 8px 8px 0px;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 14px 0;
    transition: width .6s var(--ease);
    z-index: 1000;
}

.sidebar:hover {
    width: 163px;
    border-radius: 0px 5px 5px 0px;
    transition-delay: 0s;

}

/* Sidebar shifts layout smoothly */
.sidebar:hover~.navbar {
    left: 170px;
    top: 0;
    background: var(--bg-body);

    box-shadow: 0 25px 50px rgba(0, 0, 0, .5);
}

.sidebar:hover~.nav-tabs-container {
    left: 170px;
}

/* ================= SIDEBAR BUTTONS ================= */

.sidebar-btn {
    width: calc(100% - 16px);
    margin: 6px auto;
    padding: 10px;
    display: flex;
    align-items: center;
    border-radius: 12px;
    background: transparent;
    border: none;
    color: var(--text-primary);
    text-decoration: none;
    transition: all .3s var(--ease);
    overflow: hidden;
}

.sidebar-btn:hover {
    background: var(--hover-bg);
    border: none;
}

.sidebar-btn.top {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    justify-content: center;
    margin-bottom: auto;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    box-shadow: 0 8px 20px rgba(37, 99, 235, .35);
    padding: 0;
}

/* ================= ICON PLACEHOLDER ================= */

.icon-placeholder {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    background: linear-gradient(135deg, #48484a, #2c2c2e);
    flex-shrink: 0;
}

.sidebar-icon {
    width: 24px;
    height: 24px;
    object-fit: contain;
    flex-shrink: 0;
    filter: brightness(0) invert(1);
}

[data-theme="light"] .sidebar-icon {
    filter: brightness(0);
}

/* ================= TEXT ANIMATION ================= */

.sidebar-text {
    opacity: 0;
    transform: translateX(-8px);
    white-space: nowrap;
    transition: all .5s var(--ease);
    color: var(--text-secondary);
    font-size: .95rem;
    max-width: 0;
    margin-left: 0;
}

.sidebar:hover .sidebar-text {
    opacity: 1;
    transform: translateX(0);
    max-width: 120px;
    margin-left: 14px;
}

/* ================= CONTENT ================= */

.layout-wrapper {
    max-width: 100%;
    margin: 0 auto;
    transition: padding-left .4s var(--ease);
}

.gallery-grid {
    display: flex;
    gap: 7px;
    align-items: flex-start;
}

.gallery-col {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.empty-state {
    margin-top: 24px;
    padding: 70px 30px;
    background: var(--bg-surface);
    width: 95%;
    border-radius: 18px;
    text-align: center;
    box-shadow: 0 20px 40px rgba(0, 0, 0, .2);
}

.empty-state h2 {
    margin: 0 0 10px;
}

/* ================= IMAGE CARDS ================= */

.image-card {
    position: relative;
    border-radius: 7px;
    overflow: hidden;
    margin-bottom: 4px;
    break-inside: avoid;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    transition: transform 0.3s var(--ease), box-shadow 0.3s var(--ease);
}

.image-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 30px rgba(0, 0, 0, 0.1);
}

.card-img-wrapper {
    width: 100%;
    height: auto;
    position: relative;
    background-repeat: no-repeat;
    background-position: center;
    background-image: linear-gradient(135deg, rgba(245, 193, 156, 0.821), rgba(159, 108, 80, 0.81));
    overflow: hidden;
    transition: transform 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    /* Aspect ratio is set inline by JS */
}

[data-theme="light"] .card-img-wrapper {
    background-color: #f0f0f0;
}

.image-card:hover .card-img-wrapper {
    transform: scale(1.1);
}

.card-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 20px;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.9) 0%, rgba(0, 0, 0, 0) 100%);
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.3s ease;
}

.image-card:hover .card-overlay {
    opacity: 1;
    transform: translateY(0);
}

/* REPORT BUTTON (Small & Unobtrusive) */
.report-btn {
    position: absolute;
    bottom: 10px;
    right: 10px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    z-index: 5;
    opacity: 0;
    /* Hidden by default, shown on hover */
    color: rgba(255, 255, 255, 0.6);
}

.image-card:hover .report-btn {
    opacity: 1;
}

.report-btn:hover {
    background: rgba(255, 69, 58, 0.2);
    color: #ff453a;
    border-color: #ff453a;
}

.report-btn svg {
    width: 14px;
    height: 14px;
}

/* Card Top Actions */
.card-action-btn {
    position: absolute;
    top: 12px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.3);

    border: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    z-index: 5;
    opacity: 0;
    transform: translateY(-10px);
}

.image-card:hover .card-action-btn {
    opacity: 1;
    transform: translateY(0);
}

.card-action-btn.top-left {
    left: 12px;
}

.card-action-btn.top-right {
    right: 12px;
}

.card-action-btn:hover,
.card-action-btn.active {
    background: rgba(0, 0, 0, 0.6);
    transform: scale(1.1);
}

/* Icon handling via pseudo-elements */
.card-action-btn::after {
    content: '';
    display: block;
    width: 20px;
    height: 20px;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    filter: brightness(0) invert(1);
    /* White icons */
    transition: all 0.2s;
}

.like-btn::after {
    background-image: url('/static/icons/heart2.png');
}

.like-btn:hover::after,
.like-btn.active::after {
    background-image: url('/static/icons/heart.png');
}

.save-btn::after {
    background-image: url('/static/icons/bookmark2.png');
}

.save-btn:hover::after,
.save-btn.active::after {
    background-image: url('/static/icons/bookmark.png');
}

.card-title {
    color: #fff;
    font-size: 1.1rem;
    font-weight: 600;
    margin: 0;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.download-icon-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);

    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    margin-left: 15px;
    transition: all 0.2s ease;
}

.download-icon-btn:hover {
    background: #fff;
    color: #000;
    transform: scale(1.1);
}

/* ================= MOBILE CARD FOOTER ================= */
.mobile-card-footer {
    display: none;
    padding: 10px 16px;
    background: transparent;

    border-top: 1px solid rgba(255, 255, 255, 0.05);
    align-items: center;
    justify-content: space-between;
}

.mobile-user-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.mobile-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.mobile-username {
    font-size: 0.9rem;
    color: #e0e0e0;
    font-weight: 500;
}

.mobile-download-btn {
    width: 36px;
    height: 36px;
    padding: 0;
    border-radius: 50%;
    background: #fff;
    color: #000;
    border: none;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    transition: transform 0.2s;
}

.mobile-download-btn:active {
    transform: scale(0.9);
}

[data-theme="light"] .mobile-download-btn {
    background: #000;
    color: #fff;
}

[data-theme="light"] .mobile-download-btn img {
    filter: brightness(0) invert(1);
}

[data-theme="light"] .mobile-username {
    color: #000;
}

/* ================= MOBILE ================= */

/* ================= SIDEBAR LAYOUT ================= */

.sidebar {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.sidebar-fixed {
    flex-shrink: 0;
    padding: 8px 0;
    width: 100%;
}

.sidebar-scroll {
    flex: 1;
    overflow-y: auto;
    padding: 6px 2px 20px;
    width: 100%;

}

/* Clean scrollbar */
.sidebar-scroll::-webkit-scrollbar {
    width: 6px;
}

.sidebar-scroll::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, .15);
    border-radius: 10px;
}

/* ================= SECTIONS ================= */

.sidebar-section {
    margin-bottom: 26px;
}

.section-title {
    font-size: x-small;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--text-secondary);
    margin: 10px 8px;
    letter-spacing: .6px;
    transition: all .3s var(--ease);
    white-space: nowrap;
    overflow: hidden;
}

.sidebar:not(:hover) .section-title {
    height: 0;
    margin: 0;
    opacity: 0;
}

/* ================= BUTTON SYSTEM ================= */

.btn-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(70px, 1fr));
    gap: 10px;
    transition: all .5s var(--ease);
}

.sidebar:not(:hover) .btn-grid {
    grid-template-columns: 1fr;
    gap: 0;
}

.filter-btn {
    background: var(--hover-bg);

    border: none;
    border-radius: 10px;
    padding: 10px 6px;
    font-size: .85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all .4s var(--ease);
    overflow: hidden;
    max-height: 100px;
    color: var(--text-secondary);
}

.filter-btn:hover {
    background: var(--hover-bg);
    transform: translateY(-1px);
}

.filter-btn:active {
    transform: scale(.97);
}

/* Collapsed State: Hide all but first button */
.sidebar:not(:hover) .filter-btn:not(:first-child) {
    max-height: 0;
    padding: 0;
    margin: 0;
    opacity: 0;
    transform: translateY(-10px) scale(0.9);
    pointer-events: none;
    border: 0;
}

/* Collapsed State: Adjust first button to fit */
.sidebar:not(:hover) .filter-btn {
    min-width: 0;
    width: 100%;
}

/* ================= ICON BUTTONS ================= */

.btn-grid.icons {
    grid-template-columns: repeat(3, 1fr);
}

.icon-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

.icon-btn span {
    font-size: .7rem;
    color: var(--text-secondary);
    text-align: center;
    transition: all .4s var(--ease);
    max-height: 40px;
    position: relative;
    z-index: 5;
}

.sidebar:not(:hover) .icon-btn span {
    max-height: 0;


    transform: translateY(-5px);
    margin: 0;
}

/* Related Searches in Viewer (Global) */
.related-searches-container {
    display: flex;
    flex-wrap: nowrap;
    gap: 12px;
    padding: 15px 0;
    justify-content: flex-start;
    width: 100%;
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
    mask-image: linear-gradient(to right, transparent, black 10%, black 90%, transparent);
    -webkit-mask-image: linear-gradient(to right, transparent, black 10%, black 90%, transparent);
}

.related-searches-container::-webkit-scrollbar {
    display: none;
}

/* Auto-scroll animation */
.related-searches-container .search-chip:first-child {
    margin-left: 15px;
    animation: scroll-chips 90s linear infinite;
}

.related-searches-container:hover .search-chip:first-child {
    animation-play-state: paused;
}

@keyframes scroll-chips {
    0% {
        margin-left: 15px;
    }

    100% {
        margin-left: -150%;
    }
}

.search-chip {
    flex-shrink: 0;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 100px;
    padding: 10px 20px;
    color: #fff;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
    text-align: center;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

.search-chip:hover {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
    transform: scale(1.05);
    box-shadow: 0 6px 15px rgba(10, 132, 255, 0.4);
}

/* ================= MOBILE FIX ================= */

/* Tablet adaptations */
@media (max-width: 1150px) {
    .search-wrapper {
        width: 300px;
        /* Adjust search bar width for tablets */
    }

    .search-action-btn {
        display: none;
        /* Hide filter button to prevent crowding */
    }

    .navbar {
        padding: 0 16px;
        /* Reduce padding on the navbar */
    }

    /* Sidebar Tablet Optimization */
    .sidebar:hover {
        width: 64px;
        /* Stop width transformation */
    }

    .sidebar:hover~.navbar {
        left: 78px;
        /* Stop navbar shift */
    }

    .sidebar:hover~.nav-tabs-container {
        left: 78px;
        /* Stop nav tabs shift */
    }

    /* Convert standard sidebar buttons (Filter, Settings) to vertical layout */
    .sidebar .sidebar-btn:not(.top) {
        flex-direction: column;
        height: auto;
        padding: 10px 2px;
        gap: 4px;
    }

    .sidebar .sidebar-text {
        display: block !important;
        opacity: 1 !important;
        transform: none !important;
        margin: 0 !important;
        font-size: 0.65rem;
        max-width: 100%;
        text-align: center;
    }

    /* Show all buttons in overflow box */
    .sidebar .filter-btn:not(:first-child) {
        max-height: 100px !important;
        padding: 10px 6px !important;
        margin: 0 !important;
        opacity: 1 !important;
        transform: none !important;
        pointer-events: auto !important;
    }

    .sidebar .btn-grid {
        grid-template-columns: 1fr !important;
        /* Stack buttons vertically */
        gap: 8px !important;
    }

    .sidebar .icon-btn span {
        display: block !important;
        /* Show icon labels */
        max-height: 20px !important;
        opacity: 1 !important;
        transform: none !important;
        margin-top: 4px !important;
    }
}

@media (max-width: 768px) {
    body {
        padding: 125px 3px 24px;
        background-attachment: scroll;
        /* Performance: prevents lag on mobile scroll */
        overflow-x: hidden;
    }

    /* Mobile Grid Optimization */
    .gallery-grid {
        display: flex;
        flex-direction: row;
        align-items: flex-start;
        gap: 8px;

    }

    .gallery-col {
        gap: 8px;
    }

    /* Mobile Grid Mode (CSS Grid) */
    .gallery-grid.mobile-grid {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
        align-items: start;
    }

    .image-card {
        margin-bottom: 0;
        width: 100%;
        border-radius: 12px;
        overflow: hidden;
    }

    /* Wide images span full width on mobile */
    .image-card.wide-span {
        grid-column: 1 / -1;
    }

    #section-search .section-header {
        display: none !important;
    }

    .feed-header {
        display: none !important;
    }

    .welcome-license {
        font-size: 0.75rem !important;
    }

    /* Match skeleton to image card on mobile */
    .skeleton-card {
        margin-bottom: 0;
        border-radius: 12px;
        width: 100%;
        min-height: 200px;
    }

    /* Disable hover effects on mobile */
    .image-card:hover {
        transform: none;
        box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    }

    .image-card:hover .card-img-wrapper {
        transform: none;
    }

    .image-card:hover .card-overlay,
    .image-card:hover .card-action-btn {
        display: none;
    }

    /* Remove blur effect on mobile for instant clarity */
    .blur-load {
        filter: none !important;
        transform: none !important;
    }

    .mobile-card-footer {
        display: none;
        display: flex;
        /* Performance: Remove blur on repeated items to prevent scroll lag */
        backdrop-filter: none;
        background: transparent;
    }

    .card-overlay .download-icon-btn {
        display: none;
    }

    .navbar {
        top: 0;
        left: 0;
        right: 0;
        width: auto;
        border-radius: 0;
        height: auto;
        min-height: 70px;
        /* Increased height for mobile */
        padding: 8px 16px;
        /* Better padding */
        gap: 12px;
        /* Performance: Reduce blur radius and increase opacity */

        background: var(--bg-body);
        box-shadow: none;
    }

    /* Hide the "Home" button from the sidebar nav on mobile */
    .sidebar .sidebar-nav-btn[data-target="section-home"] {
        display: none;
    }

    .logo {
        display: flex;
        /* Show logo on mobile */
    }

    .menu-toggle {
        display: flex;
        margin-right: 0;
    }

    .nav-actions {
        flex: 1;
        /* Take available space */
        width: auto;
        gap: 12px;
        justify-content: flex-end;
        /* Align buttons to the right */
    }

    /* Hide the 2 buttons (Login/Signup) */
    .nav-actions .nav-btn {
        display: none !important;
    }

    .nav-actions .icon-nav-btn {
        display: none;
    }

    /* But show the right menu toggle button */
    .nav-actions .right-menu-btn {
        display: flex;
    }

    /* Adjust Search to fit */
    .search-wrapper {
        display: none;
        /* Hidden by default on mobile */
        margin-right: 0;
        /* Reset margin */
        height: 42px;
        width: auto;
        flex: 1;
        padding: 0 14px;
        gap: 0px;
        animation: fadeIn 0.3s ease;
    }

    .search-input {
        font-size: 16px;
        /* Prevent zoom on iOS and better readability */
    }

    .search-category-wrapper {
        display: none;
    }

    .navbar.search-active .search-category-wrapper {
        display: block;
    }

    /* Mobile Search Button */
    .mobile-search-btn {
        display: flex;
    }

    /* Search Active State (Transformation) */
    .navbar.search-active {
        padding-bottom: 62px;
        transition: padding-bottom 0.3s var(--ease);
    }

    .navbar.search-active .logo {
        display: flex;
    }

    .navbar.search-active .mobile-search-btn {
        display: flex;
        background: var(--hover-bg);
        color: var(--primary);
    }

    .navbar.search-active .search-wrapper {
        display: flex;
        position: absolute;
        bottom: 10px;
        left: 16px;
        right: 16px;
        width: auto;
        margin: 0;
        z-index: 10;
        animation: slideDownSearch 0.3s var(--ease);
    }

    /* Move search icon to right on mobile */
    .navbar.search-active .search-icon {
        order: 2;
        margin-right: 0;
        margin-left: 10px;
        cursor: pointer;
        pointer-events: auto;
        z-index: 20;
    }

    .navbar.search-active .search-input {
        order: 1;
    }

    @keyframes slideDownSearch {
        from {
            opacity: 0;
            transform: translateY(-10px);
        }

        to {
            opacity: 1;
            transform: translateY(0);
        }
    }

    .navbar.search-active~.nav-tabs-container {
        transform: translateY(72px);
        top: 38px;
    }

    .navbar.search-active~.layout-wrapper {
        margin-top: 72px;
        transition: margin-top 0.3s var(--ease);
    }

    /* Show nav tabs on mobile */
    .nav-tabs-container {
        display: flex;
        top: 70px;
        left: 0;
        right: 0;
        border-radius: 0;
        padding: 0 16px;
        /* Performance: Match navbar optimization */
        background: var(--bg-body);

    }

    .nav-tab-plus-btn {
        display: none;
    }

    /* Sidebar as Drawer */
    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        height: 100vh;
        width: 260px;
        transform: translateX(-100%);
        flex-direction: column;
        justify-content: flex-start;
        background: transparent;
        z-index: 1000;
        top: 0;
        /* Ensure it sticks to the top */
        transition: transform 0.3s var(--ease);
        box-shadow: 4px 0 30px rgba(0, 0, 0, 0.1);
        border-radius: 0 16px 16px 0;
        padding-top: 20px;
        /* Performance: Solid background for large drawer */
        background: var(--bg-sidebar);
        backdrop-filter: none;
    }

    .sidebar.active {
        transform: translateX(0);
    }

    /* Force Sidebar Content Visible when Active */
    .sidebar.active .sidebar-text,
    .sidebar .sidebar-text {
        transform: none;
        max-width: none;
        margin-left: 14px;
        display: block;
    }

    .sidebar.active .section-title,
    .sidebar .section-title {
        height: auto;
        margin: 10px 8px;
        opacity: 1;
    }

    .sidebar.active .btn-grid,
    .sidebar .btn-grid {
        grid-template-columns: repeat(auto-fill, minmax(70px, 1fr));
        gap: 10px;
    }

    .sidebar.active .filter-btn,
    .sidebar .filter-btn {
        max-height: 100px;
        opacity: 1;
        transform: none;
        pointer-events: auto;
        min-width: 0;
        width: auto;
        padding: 10px 6px;
        margin: 0;
    }

    .sidebar.active .icon-btn span,
    .sidebar .icon-btn span {
        max-height: 40px;
        transform: none;
    }

    /* Disable hover effects that shift layout */
    .sidebar:hover~.navbar {
        left: 8px;
        top: 8px;
    }

    .sidebar:hover~.layout-wrapper {
        transform: none;
    }

    .sidebar:hover {
        width: 260px;
    }
}

/* Smallest screen adaptations */
@media (max-width: 390px) {
    .navbar {
        padding: 6px 4px;
        gap: 4px;
        min-height: 56px;
    }

    .nav-tabs-container {
        top: 56px;
    }

    .logo {
        font-size: 0.9rem;
        padding: 4px 8px;
    }

    .nav-actions {
        gap: 4px;
    }

    .search-wrapper {
        padding: 0 8px;
        height: 36px;
    }

    .search-input {
        font-size: 0.85rem;
    }

    .search-icon {
        width: 16px;
        height: 16px;
        margin-right: 6px;
    }

    .search-action-btn {
        display: none;
    }

    /* Stability for ultra-narrow screens (down to 50px) */
    .navbar.search-active .search-wrapper {
        left: 4px;
        right: 4px;
    }

    .nav-tabs-container {
        padding: 0 4px;
    }

    .brand-text {
        font-size: 1.2rem;
        /* Smaller text on very small screens */
    }

    .nav-logo-img {
        height: 32px;
        min-width: 0;
    }

    /* Hide category dropdown on very small screens to prevent overflow */
    .navbar.search-active .search-category-wrapper {
        display: none !important;
    }

    /* Hide Share button on mobile */
    #shareSearchResultsContainer {
        display: none !important;
    }

    /* Adjust expanded state for small screens to prevent gaps */
    .navbar.search-active {
        padding-bottom: 54px;
    }

    .navbar.search-active~.nav-tabs-container {
        transform: translateY(40px);
        top: 57px;
    }

    .navbar.search-active~.layout-wrapper {
        margin-top: 40px;
    }

}

/* Scroll Continuous Animation */
@keyframes scroll-continuous {

    0%,
    20% {
        margin-left: 0;
    }

    100% {
        margin-left: -100%;
    }
}

@media (max-width: 768px) {
    .nav-tabs-container .nav-tab:first-child {
        animation: scroll-continuous 15s linear infinite;
    }
}


/* ================= HERO SECTION (Integrated) ================= */
.hero-section {
    --hero-bg: var(--bg-body);
    --hero-panel: rgba(255, 255, 255, 0.06);
    --hero-border: rgba(255, 255, 255, 0.12);
    --hero-text: #ffffff;
    --hero-muted: var(--text-secondary);
    --hero-accent: #4f7cff;
    --hero-radius: 18px;

    width: 100%;
    background: transparent;
    background-position: center;
    background-repeat: no-repeat;
    background-size: cover;
    border: none;
    border-radius: 22px;
    padding: 36px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 32px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0);
    margin-bottom: 40px;
    color: var(--hero-text);
    position: relative;
    overflow: hidden;
    font-family: 'Inter', sans-serif;
}

[data-theme="light"] .hero-section {
    --hero-panel: rgba(0, 0, 0, 0.05);
    --hero-border: rgba(0, 0, 0, 0.1);
}

.hero-left {
    display: flex;
    flex-direction: column;
    gap: 26px;
    position: relative;
    z-index: 2;
}

.hero-title-box {
    background: transparent;

    border: none;
    border-radius: var(--hero-radius);
    padding: 0px 10px;
    font-size: 60px;
    font-weight: 700;
    color: var(--hero-text);
    margin: 0 0 15px 0;
    line-height: 1.2;
}

.hero-subtitle-box {
    background-color: rgba(22, 22, 22, 0.85);
    backdrop-filter: blur(5px);
    border: none;
    border-radius: var(--hero-radius);
    padding: 22px;
    font-size: 15px;
    font-weight: 500;
    color: var(--hero-text);
    line-height: 1.6;
    min-height: 88px;
}

.hero-search-wrapper {
    background-color: #16161690;
    backdrop-filter: blur(5px);
    border-radius: 30px;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    width: 100%;
    box-shadow: 0 12px 42px rgba(0, 0, 0, 0);
    transition: .3s ease;
    position: relative;
    z-index: 2;
}

.hero-search-wrapper input {
    flex: 1;
    border: none;
    outline: none;
    height: 45px;
    font-size: 16px;
    font-family: 'Inter', sans-serif;
    color: var(--text-primary);
    background: transparent;
}

.hero-search-icon {
    width: 30px;
    height: 30px;
    margin-left: 6px;
    filter: brightness(0) invert(1);
}

.hero-search-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.hero-icon-btn {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-primary);
    cursor: pointer;
    transition: .25s ease;
}

.hero-icon-btn:hover {
    background: var(--hover-bg);
    transform: scale(1.1);
}

.hero-image-placeholder {
    background: linear-gradient(135deg, #ff2a2a, #ff5252);
    border-radius: var(--hero-radius);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 20px;
    font-weight: 600;
    text-align: center;
    padding: 24px;
    height: 100%;
    box-shadow: inset 0 0 0 4px rgba(255, 255, 255, .25);
}

.hero-right {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 12px;
    align-content: center;
    width: 100%;
    height: 100%;
    min-height: 400px;
    position: relative;
    z-index: 2;
}

.hero-img-box {
    background: var(--hero-panel);
    border-radius: 6px;
    overflow: hidden;
    position: relative;
    cursor: pointer;
    transition: all 0.3s ease;
    aspect-ratio: 1/1;
}

.hero-img-box:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
    border-color: var(--text-primary);
}

.hero-img-box img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
    display: block;
    background-color: #000000ac;
    backdrop-filter: blur(5px);
}

.hero-img-box:hover img {
    transform: scale(1.1);
}

@media (max-width: 900px) {
    .hero-section {
        grid-template-columns: 1fr;
    }
}

.hero-bg-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 0;
}

@media (min-width: 769px) {}

/* ================= HERO ANIMATION SHAPES ================= */
.hero-floating-shapes {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 10;
    /* Above search bar and content as requested */
    overflow: hidden;
}

.hero-shape {
    position: absolute;
    will-change: transform;
    opacity: 0.8;
    filter: drop-shadow(0 0 15px rgba(0, 0, 0, 0.3));
}

/* Shape 1: Glowing Orb */
.shape-orb {
    width: 80px;
    height: 80px;
    background: radial-gradient(circle at 30% 30%, #0a84ff, #003366);
    border-radius: 50%;
    box-shadow: 0 0 30px rgba(10, 132, 255, 0.6);
    top: 10%;
    left: 10%;
    animation: heroBounce1 25s infinite linear alternate;
}

/* Shape 2: Floating Diamond */
.shape-diamond {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #ff00cc, #333399);
    transform: rotate(45deg);
    border-radius: 12px;
    top: 60%;
    left: 80%;
    border: 2px solid rgba(255, 255, 255, 0.4);
    animation: heroBounce2 30s infinite linear alternate;
}

/* Shape 3: Neon Ring */
.shape-ring {
    width: 100px;
    height: 100px;
    border: 6px solid #00ffcc;
    border-radius: 50%;
    top: 40%;
    left: 40%;
    box-shadow: 0 0 20px rgba(0, 255, 204, 0.4), inset 0 0 20px rgba(0, 255, 204, 0.4);
    animation: heroBounce3 28s infinite linear alternate;
}

@keyframes heroBounce1 {
    0% {
        transform: translate(0, 0) scale(1);
    }

    33% {
        transform: translate(300px, 150px) scale(1.2);
    }

    66% {
        transform: translate(100px, 300px) scale(0.9);
    }

    100% {
        transform: translate(500px, 50px) scale(1.1);
    }
}

@keyframes heroBounce2 {
    0% {
        transform: translate(0, 0) rotate(45deg);
    }

    50% {
        transform: translate(-400px, -200px) rotate(225deg);
    }

    100% {
        transform: translate(-200px, 100px) rotate(405deg);
    }
}

@keyframes heroBounce3 {
    0% {
        transform: translate(0, 0) rotate(0deg) scale(1);
    }

    50% {
        transform: translate(300px, -150px) rotate(180deg) scale(1.1);
    }

    100% {
        transform: translate(-100px, 200px) rotate(360deg) scale(0.9);
    }
}


/* ================= LOADING BAR ================= */
.page-loader {
    position: fixed;
    top: 0;
    left: 0;
    height: 3px;
    width: 0;
    background: linear-gradient(90deg, var(--primary), #60a5fa);
    z-index: 2000;
    transition: width 0.4s ease, opacity 0.3s ease;
    box-shadow: 0 2px 10px rgba(37, 99, 235, 0.3);
}

/* ================= MOBILE MENU TOGGLE ================= */
.menu-toggle {
    display: none;
    background: transparent;
    border: none;
    padding: 8px;
    color: var(--text-primary);
    cursor: pointer;
    margin-right: 8px;
}

/* ================= SIDEBAR OVERLAY ================= */
.sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);

    z-index: 950;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s var(--ease);
}

.sidebar-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

/* ================= RIGHT SIDEBAR ================= */
.right-sidebar {
    position: fixed;
    top: 0;
    right: 0;
    border-radius: 5px 0px 0px 5px;
    width: 280px;
    height: 100vh;
    background: var(--bg-sidebar);

    border-left: none;
    z-index: 1100;
    transform: translateX(100%);
    transition: transform 0.4s var(--ease);
    box-shadow: -4px 0 30px rgba(0, 0, 0, 0.5);
    padding: 24px;
    display: flex;
    flex-direction: column;
}

.right-sidebar.active {
    transform: translateX(0);
}

.right-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

.right-content {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.right-link {
    display: block;
    padding: 12px;
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    border-radius: 10px;
    transition: all .3s var(--ease);
    border: none;
}

.right-link:hover {
    background: var(--hover-bg);
    color: var(--text-primary);
    border: none;
}

.right-footer {
    margin-top: auto;
    padding-top: 20px;
    border-top: 1px solid #f3f4f6;
}

.right-sidebar .nav-btn {
    display: block;
    text-align: center;
    width: 100%;
}

.right-sidebar .nav-btn:first-child {
    margin-bottom: 12px;
}

.right-sidebar .nav-btn.secondary {
    background: var(--hover-bg);
    color: var(--text-primary);
    box-shadow: none;
}

.right-sidebar .nav-btn.secondary:hover {
    background: var(--hover-bg);
}

/* ================= SECTIONS ANIMATION ================= */
.content-section {
    animation: fadeInSection 0.5s var(--ease);
}

@keyframes fadeInSection {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ================= UPLOAD MODAL ================= */
.upload-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);

    z-index: 2000;
    display: none;
    justify-content: center;
    align-items: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.upload-overlay.active {
    display: flex;
    opacity: 1;
}

.upload-card {
    max-width: 800px;
    width: 90%;
    background: var(--bg-surface);
    color: var(--text-primary);
    padding: 25px;
    border-radius: 16px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.2);
    text-align: center;
    position: relative;
    transform: translateY(20px);
    transition: transform 0.3s ease;
    max-height: 90vh;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 transparent;
}

.upload-card::-webkit-scrollbar {
    width: 6px;
}

.upload-card::-webkit-scrollbar-thumb {
    background-color: #cbd5e1;
    border-radius: 20px;
}

.upload-overlay.active .upload-card {
    transform: translateY(0);
}

.upload-close-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--hover-bg);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-primary);
    font-size: 1.2rem;
    transition: all 0.2s;
    z-index: 10;
}

.upload-close-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
}

/* ================= PROGRESSIVE LOADING ================= */
.card-img-wrapper img {
    width: 100%;
    height: auto;
    display: block;
    transition: filter 0.4s ease-out;
}

.blur-load {
    filter: blur(10px);
    transform: scale(1.05);
    /* Slight scale to hide blurred edges */
}

.blur-loaded {
    filter: blur(0);
    transform: scale(1);
}

/* ================= IMAGE VIEWER POPUP ================= */
/* 1. OVERLAY & BLUR */
.popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(10px);
    display: none;
    /* Hidden by default */
    justify-content: center;
    align-items: center;
    z-index: 9999;
    font-family: 'Inter', -apple-system, sans-serif;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.popup-overlay.active {
    display: flex;
    opacity: 1;
}

/* 2. THE MAIN CARD */
.viewer-card {
    background: rgb(0, 0, 0);
    will-change: transform;
    width: 95%;
    max-width: 100%;
    height: 100%;
    min-height: 100%;
    border-radius: 0;
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 40px;
    position: relative;
    display: flex;
    gap: 40px;
    color: #fff;
    box-shadow: 0 40px 80px rgba(0, 0, 0, 0.6);
    transform: scale(0.95);
    transition: transform 0.3s ease;
}

.popup-overlay.active .viewer-card {
    transform: scale(1);
}

.exit-btn {
    position: absolute;
    top: 25px;
    right: 25px;
    width: 36px;
    height: 36px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: 0.2s;
    color: #fff;
    z-index: 10;
}

.exit-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    color: #ff5f56;
}

.viewer-left {
    flex: 3;
    height: 100%;
    position: relative;
    background: transparent;
    border-radius: 12px;
    overflow: hidden;
    border: none;
}

.main-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 12px;
}

.expand-btn {
    position: absolute;
    bottom: 20px;
    right: 20px;
    width: 40px;
    height: 40px;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    transition: all 0.2s;
}

.expand-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.05);
}

.expand-btn img {
    filter: brightness(0) invert(1);
}

.similar-btn {
    position: absolute;
    bottom: 19px;
    right: 68px;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(10px);
    height: 40px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 8px 16px;
    color: white;
    cursor: pointer;
    z-index: 10;
    transition: all 0.2s;
    font-size: 14px;
}

.similar-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

/* SIMILAR IMAGES GRID (PC ONLY) */
.similar-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 12px;
    padding: 20px;
    width: 100%;
    margin-top: 20px;
}

.similar-card {
    aspect-ratio: 1/1;
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: transform 0.2s ease;
    background: rgba(255, 255, 255, 0.05);
}

.similar-card:hover {
    transform: scale(1.05);
    border-color: rgba(255, 255, 255, 0.4);
}

.similar-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

@media (min-width: 769px) {}

.viewer-right {
    flex: 1;
    max-width: 350px;
    display: flex;
    flex-direction: column;
    padding: 10px 0;
    gap: 20px;
}

.viewer-header {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 10px;
}

.nav-controls {
    display: flex;
    gap: 12px;
}

.nav-btn {
    width: 71px;
    height: 42px;
    background: rgba(255, 255, 255, 0.05);
    border: none;
    border-radius: 28px;
    cursor: pointer;
    color: white;
    font-size: 18px;
    transition: 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.nav-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

.nav-btn img {
    filter: brightness(0) invert(1);
}

.account-circle {
    width: 50px;
    height: 50px;
    background: #333;
    border-radius: 50%;
    border: 2px solid #3d85ff;
    overflow: hidden;
}

.account-circle img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.user-info-group {
    display: flex;
    flex-direction: column;
}

.user-name {
    font-weight: 600;
    font-size: 1rem;
    color: #fff;
}



/* ================= LOADING BAR ================= */
.page-loader {
    position: fixed;
    top: 0;
    left: 0;
    height: 3px;
    width: 0;
    background: linear-gradient(90deg, var(--primary), #60a5fa);
    z-index: 2000;
    transition: width 0.4s ease, opacity 0.3s ease;
    box-shadow: 0 2px 10px rgba(37, 99, 235, 0.3);
}

/* ================= MOBILE MENU TOGGLE ================= */
.menu-toggle {
    display: none;
    background: transparent;
    border: none;
    padding: 8px;
    color: var(--text-primary);
    cursor: pointer;
    margin-right: 8px;
}

/* ================= SIDEBAR OVERLAY ================= */
.sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);

    z-index: 950;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s var(--ease);
}

.sidebar-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

/* ================= RIGHT SIDEBAR ================= */
.right-sidebar {
    position: fixed;
    top: 0;
    right: 0;
    border-radius: 5px 0px 0px 5px;
    width: 280px;
    height: 100vh;
    background: var(--bg-sidebar);

    border-left: none;
    z-index: 1100;
    transform: translateX(100%);
    transition: transform 0.4s var(--ease);
    box-shadow: -4px 0 30px rgba(0, 0, 0, 0.5);
    padding: 24px;
    display: flex;
    flex-direction: column;
}

.right-sidebar.active {
    transform: translateX(0);
}

.right-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

.right-content {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.right-link {
    display: block;
    padding: 12px;
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    border-radius: 10px;
    transition: all .3s var(--ease);
    border: none;
}

.right-link:hover {
    background: var(--hover-bg);
    color: var(--text-primary);
    border: none;
}

.right-footer {
    margin-top: auto;
    padding-top: 20px;
    border-top: 1px solid #f3f4f6;
}

.right-sidebar .nav-btn {
    display: block;
    text-align: center;
    width: 100%;
}

.right-sidebar .nav-btn:first-child {
    margin-bottom: 12px;
}

.right-sidebar .nav-btn.secondary {
    background: var(--hover-bg);
    color: var(--text-primary);
    box-shadow: none;
}

.right-sidebar .nav-btn.secondary:hover {
    background: var(--hover-bg);
}

/* ================= SECTIONS ANIMATION ================= */
.content-section {
    animation: fadeInSection 0.5s var(--ease);
}

@keyframes fadeInSection {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ================= UPLOAD MODAL ================= */
.upload-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);

    z-index: 2000;
    display: none;
    justify-content: center;
    align-items: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.upload-overlay.active {
    display: flex;
    opacity: 1;
}

.upload-card {
    max-width: 800px;
    width: 90%;
    background: var(--bg-surface);
    color: var(--text-primary);
    padding: 25px;
    border-radius: 16px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.2);
    text-align: center;
    position: relative;
    transform: translateY(20px);
    transition: transform 0.3s ease;
    max-height: 90vh;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 transparent;
}

.upload-card::-webkit-scrollbar {
    width: 6px;
}

.upload-card::-webkit-scrollbar-thumb {
    background-color: #cbd5e1;
    border-radius: 20px;
}

.upload-overlay.active .upload-card {
    transform: translateY(0);
}

.upload-close-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--hover-bg);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-primary);
    font-size: 1.2rem;
    transition: all 0.2s;
    z-index: 10;
}

.upload-close-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
}

/* ================= PROGRESSIVE LOADING ================= */
.card-img-wrapper img {
    width: 100%;
    height: auto;
    display: block;
    transition: filter 0.4s ease-out;
}

.blur-load {
    filter: blur(10px);
    transform: scale(1.05);
    /* Slight scale to hide blurred edges */
}

.blur-loaded {
    filter: blur(0);
    transform: scale(1);
}

/* ================= IMAGE VIEWER POPUP ================= */
/* 1. OVERLAY & BLUR */
.popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(10px);
    display: none;
    /* Hidden by default */
    justify-content: center;
    align-items: center;
    z-index: 9999;
    font-family: 'Inter', -apple-system, sans-serif;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.popup-overlay.active {
    display: flex;
    opacity: 1;
}



.popup-overlay.active .viewer-card {
    transform: scale(1);
}

.exit-btn {
    position: absolute;
    top: 25px;
    right: 25px;
    width: 36px;
    height: 36px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: 0.2s;
    color: #fff;
    z-index: 10;
}

.exit-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    color: #ff5f56;
}

.viewer-left {
    flex: 3;
    height: 100%;
    position: relative;
    background: transparent;
    border-radius: 12px;
    overflow-y: auto;
    scrollbar-width: none;
    border: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    scroll-behavior: smooth;
}

.viewer-left::-webkit-scrollbar {
    display: none;
}

.main-image {
    width: 100%;
    height: auto;
    max-height: 85vh;
    object-fit: contain;
    border-radius: 12px;
    flex-shrink: 0;
    margin-bottom: 10px;
}

.expand-btn {
    position: absolute;
    bottom: 20px;
    right: 20px;
    width: 40px;
    height: 40px;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    transition: all 0.2s;
}

.expand-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.05);
}

.expand-btn img {
    filter: brightness(0) invert(1);
}

.similar-btn {
    display: none;
}

.similar-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

/* SIMILAR IMAGES GRID (PC ONLY) */
.similar-grid {
    display: block;
    column-width: 240px;
    column-gap: 15px;
    width: 100%;
    padding: 0 10px 40px;
}

.similar-card {
    break-inside: avoid;
    margin-bottom: 15px;
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: transform 0.2s ease;
    background: rgba(255, 255, 255, 0.05);
    width: 100%;
}

.similar-card:hover {
    transform: scale(1.05);
    border-color: rgba(255, 255, 255, 0.4);
}

.similar-card img {
    width: 100%;
    height: auto;
    display: block;
}

@media (min-width: 769px) {
    .similar-grid {
        column-width: 240px;
    }
}

.viewer-right {
    flex: 1;
    max-width: 350px;
    display: flex;
    flex-direction: column;
    padding: 10px 0;
    gap: 20px;
}

.viewer-header {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 10px;
}

.nav-controls {
    display: flex;
    gap: 12px;
}

.nav-btn {
    width: 71px;
    height: 42px;
    background: rgba(255, 255, 255, 0.05);
    border: none;
    border-radius: 28px;
    cursor: pointer;
    color: white;
    font-size: 18px;
    transition: 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.nav-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

.nav-btn img {
    filter: brightness(0) invert(1);
}

.account-circle {
    width: 50px;
    height: 50px;
    background: #333;
    border-radius: 50%;
    border: 2px solid #3d85ff;
    overflow: hidden;
}

.account-circle img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.user-info-group {
    display: flex;
    flex-direction: column;
}

.user-name {
    font-weight: 600;
    font-size: 1rem;
    color: #fff;
}

.user-status {
    font-size: 0.8rem;
    color: #ccc;
}

.details-container {
    flex-grow: 1;
}

.description-box {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 20px;
    margin-bottom: 15px;
}

.description-box h3 {
    margin-top: 0;
    color: #aaa;
    font-size: 14px;
    text-transform: uppercase;
}

.description-box p {
    margin: 10px 0;
    color: #ddd;
    font-size: 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    padding-bottom: 8px;
}

.download-wrapper {
    margin-top: auto;
    display: grid;
    grid-template-columns: 1fr 50px 50px;
    gap: 10px;
}

.btn-download {
    width: 100%;
    height: 50px;
    background: #fff;
    color: #000;
    border: none;
    border-radius: 14px;
    font-size: 15px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    cursor: pointer;
    transition: all 0.3s;
    letter-spacing: 0.5px;
    box-shadow: none;
}

.btn-download:hover {
    transform: translateY(-2px);
    background: #f0f0f0;
}

.btn-download.secondary {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.1);
    margin-bottom: 0;
}

.btn-download.secondary:hover {
    background: rgba(255, 255, 255, 0.2);
}

.btn-download:not(.secondary) {
    grid-column: 1 / -1;
}

@media (max-width: 768px) {
    .viewer-card {
        display: block;
        position: relative;
        height: 100%;
        width: 100%;
        min-height: 100%;
        padding: 0;
        overflow: hidden;
        max-height: 100%;
        border-radius: 0;
        border: none;
    }

    .viewer-left {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: #000;
        z-index: 1;
        border-radius: 0;
        overflow-y: auto;
        display: flex;
        flex-direction: column;
    }

    .main-image {
        border-radius: 0;
        object-fit: contain;
        height: auto;
        max-height: 70vh;
        width: 100%;
        margin-top: 80px;
        margin-bottom: 100px;
        flex-shrink: 0;
    }

    .viewer-right {
        position: absolute;
        bottom: 0;
        left: 0;
        width: 100vw;
        max-width: none;
        z-index: 10;
        background: linear-gradient(to top, rgba(0, 0, 0, 0.95) 0%, rgba(0, 0, 0, 0.6) 60%, transparent 100%);
        padding: 10px 20px 20px;
        border-top: none;
        display: flex;
        flex-direction: column;
        gap: 16px;
        box-sizing: border-box;
        justify-content: flex-end;
    }

    .exit-btn {
        top: 16px;
        right: 16px;
        background: rgba(0, 0, 0, 0.6);
        z-index: 20;
    }

    .description-box {
        display: none;
    }

    .nav-controls {
        display: none;
    }

    /* Hide nav buttons to clean up overlay */

    /* Mobile Owner Info & Buttons */
    .viewer-header {
        margin-bottom: 0;
        gap: 12px;
        width: 100%;
    }

    .account-circle {
        width: 40px;
        height: 40px;
        border-color: #fff;
    }

    .user-name {
        font-size: 1rem;
        text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
    }

    .user-status {
        font-size: 0.8rem;
        color: rgba(255, 255, 255, 0.8);
    }

    .download-wrapper {
        display: grid;
        grid-template-columns: 1fr 50px 50px;
        gap: 10px;
        width: 100%;
    }

    .btn-download {
        height: 36px;
        font-size: 0.9rem;
        margin: 0;
        width: 100%;
        border-radius: 12px;
    }

    /* Secondary Buttons (Edit & Share) - Top Row */
    .btn-download.secondary {
        margin-bottom: 0;
        background: rgba(255, 255, 255, 0.15);
        backdrop-filter: blur(10px);
        border: 1px solid rgba(255, 255, 255, 0.2);
        color: #fff;
        justify-content: center;
        padding: 0;
    }

    .btn-download.secondary .btn-text {
        display: none;
    }

    /* Hide text on mobile */

    /* Mobile Button Layout */
    #editImageBtn {
        display: none;
    }

    #reportImageBtn {
        display: none;
    }

    .btn-download:not(.secondary) {
        grid-column: 1 / 2;
        grid-row: 1;
    }

    #shareImageBtn {
        grid-column: 2 / 3;
        grid-row: 1;
    }

    #expandViewerBtnMobile {
        grid-column: 3 / 4;
        grid-row: 1;
    }

    /* Quality text mobile adjustment */
    .quality-text {
        position: static;
        transform: none;
        width: 100%;
        padding: 10px 20px;
        text-align: center;
        font-size: 11px;
        z-index: 5;
        margin: 70px 0 10px 0;
        /* Push down below absolute header */
    }

    .similar-grid {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        align-items: start;
        gap: 12px;
        padding: 0 12px 220px 12px;
        width: 100%;
    }

    /* PERFORMANCE: Hide background content when modal is open to prevent lag */
    body.mobile-modal-open {
        overflow: hidden !important;
        position: fixed !important;
        /* Hard lock for iOS */
        width: 100%;
        height: 100%;
    }

    body.mobile-modal-open .layout-wrapper,
    body.mobile-modal-open .navbar,
    body.mobile-modal-open .sidebar,
    body.mobile-modal-open .nav-tabs-container,
    body.mobile-modal-open .nav-tab-plus-btn {
        display: none !important;
    }

    /* PERFORMANCE: Remove expensive blur and shadows on mobile */
    .popup-overlay,
    .modal-overlay,
    .editor-overlay,
    .upload-overlay {
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
        background: rgba(0, 0, 0, 0.95) !important;
        /* Opaque background to hide clutter */
    }

    .viewer-card,
    .asset-viewer-card,
    .auth-card,
    .editor-card,
    .upload-card {
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
    }

    /* Skeletons for Mobile Viewers */
    .viewer-left.skeleton .main-image,
    .main-preview-box.skeleton {
        background: linear-gradient(90deg, #2c2c2e 25%, #3a3a3c 50%, #2c2c2e 75%);
        background-size: 200% 100%;
        animation: skeleton-loading 1.5s infinite;
    }

    .viewer-left.skeleton .main-image,
    .main-preview-box.skeleton img {
        visibility: hidden;
    }
}

.quality-text {
    position: relative;
    bottom: auto;
    left: auto;
    transform: none;
    color: rgba(255, 255, 255, 0.85);
    font-size: 12px;
    pointer-events: none;
    margin: 10px 0;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.9);
    text-align: center;
    width: 100%;
}

/* ================= AUTH MODAL STYLES ================= */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(15px);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.modal-overlay.active {
    display: flex;
    opacity: 1;
}

.close-trigger {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-primary);
    font-size: 14px;
    transition: 0.2s;
}

.close-trigger:hover {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
    border-color: #fff;
}

.auth-card {
    background: var(--bg-surface);

    border: 1px solid var(--border-color);
    border-radius: 24px;
    padding: 40px;
    width: 100%;
    max-width: 400px;
    color: var(--text-primary);
    text-align: center;
    position: relative;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
}

.input-group {
    text-align: left;
    margin-bottom: 20px;
}

.input-group label {
    display: block;
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin-bottom: 8px;
    font-weight: 500;
}

.input-group input {
    width: 100%;
    background: var(--input-bg);
    border: 1px solid var(--border-color);
    padding: 12px 16px;
    border-radius: 12px;
    color: var(--text-primary);
    outline: none;
    transition: all 0.3s ease;
    font-size: 1rem;
}

.input-group input:focus {
    border-color: var(--primary);
    background: rgba(255, 255, 255, 0.1);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
}

.auth-btn {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    border: none;
    border-radius: 12px;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 10px;
    box-shadow: 0 4px 15px rgba(37, 99, 235, 0.3);
}

.auth-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(37, 99, 235, 0.4);
}

/* ================= CATEGORY MODAL ================= */
.category-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    z-index: 3000;
    display: none;
    justify-content: center;
    align-items: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.category-modal.active {
    display: flex;
    opacity: 1;
}

.category-content {
    width: 90%;
    max-width: 1000px;
    max-height: 85vh;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 24px;
    padding: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    position: relative;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.category-content::-webkit-scrollbar {
    display: none;
}

.category-scroll {
    flex: 1;
    overflow-y: auto;
    padding: 30px;
}

.category-footer {
    padding: 20px 30px;
    background: var(--bg-surface);
    border-top: 1px solid var(--border-color);
    flex-shrink: 0;
}

.apply-btn {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    border: none;
    border-radius: 12px;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(37, 99, 235, 0.3);
}

.apply-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(37, 99, 235, 0.4);
}

.filter-btn.selected {
    background: var(--primary);
    color: white;
    box-shadow: 0 4px 15px rgba(37, 99, 235, 0.3);
}

.filter-btn.selected img {
    filter: brightness(0) invert(1);
}

.filter-btn.selected span {
    color: white;
}

.category-item.selected {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
    box-shadow: 0 4px 15px rgba(37, 99, 235, 0.3);
}

.category-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 12px;
    margin-top: 20px;
}

.category-item {
    background: var(--hover-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 15px 10px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 0.9rem;
    user-select: none;
}

.category-item:hover {
    background: var(--primary);
    color: white;
    transform: translateY(-3px);
    border-color: var(--primary);
    box-shadow: 0 4px 15px rgba(37, 99, 235, 0.3);
}

@media (max-width: 600px) {
    .category-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .category-content {
        padding: 20px;
        width: 95%;
    }
}

/* ================= SKELETON LOADING ================= */
@keyframes skeleton-loading {
    0% {
        background-position: 200% 0;
    }

    100% {
        background-position: -200% 0;
    }
}

.skeleton-card {
    position: relative;
    background: #c8c8c8;
    border-radius: 20px;
    overflow: hidden;
    margin-bottom: 24px;
    min-height: 250px;
    break-inside: avoid;
    display: flex;
    align-items: center;
    justify-content: center;
}

.skeleton-img {
    width: 120px;
    height: 140px;

    background-image: url('/static/wallpepersphere.jpg');
    background-position: center;
    background-size: cover;
    background-repeat: no-repeat;
    animation: skeleton-pulse 1.5s ease-in-out infinite;
}

[data-theme="light"] .skeleton-img {
    background-image: url('/static/wallpepersphere.jpg');
}

.hero-img-box.skeleton {
    background-image: url('/static/wallpeperspheredark.jpg');
    background-position: center;
    background-size: cover;
    background-repeat: no-repeat;
    animation: skeleton-pulse 1.5s ease-in-out infinite;
    border: none;
}

.grid-box.skeleton {
    background-image: url('/static/wallpeperspheredark.jpg');
    background-position: center;
    background-size: cover;
    background-repeat: no-repeat;
    animation: skeleton-pulse 1.5s ease-in-out infinite;
    min-height: 200px;
    border-radius: 12px;
}

[data-theme="light"] .hero-img-box.skeleton {
    background-image: url('/static/wallpepersphere.jpg');
}

@keyframes skeleton-pulse {
    0% {
        opacity: 0.5;
    }

    50% {
        opacity: 1;
    }

    100% {
        opacity: 0.5;
    }
}

/* Mobile Skeleton Footer Structure */
.skeleton-footer {
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    background: #1c1c1e;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.skeleton-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
}

.skeleton-text {
    height: 12px;
    width: 50%;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.1);
}


/* Ensure images fill the aspect-ratio wrapper */
.card-img-wrapper img {
    position: relative;
    width: 100%;
    height: auto;
    display: block;
}

/* Animation for sequential loading */
.fade-in {
    animation: fadeInScale 0.4s ease-out forwards;
    opacity: 0;
}

@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: scale(0.98) translateY(10px);
    }

    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* ================= CONNECTION TOAST ================= */
.connection-toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: rgba(28, 28, 30, 0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: #fff;
    padding: 12px 20px;
    border-radius: 50px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
    display: flex;
    align-items: center;
    gap: 12px;
    z-index: 10000;
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275), background 0.3s;
    border: 1px solid rgba(255, 255, 255, 0.1);
    font-weight: 500;
    font-size: 0.9rem;
    min-width: 280px;
    justify-content: center;
}

.connection-toast.active {
    transform: translateX(-50%) translateY(0);
}

.connection-toast.online {
    background: rgba(46, 125, 50, 0.9);
    border-color: rgba(76, 175, 80, 0.3);
}

.connection-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ff5f56;
}

.connection-toast.online .connection-icon {
    color: #fff;
}

.connection-retry-btn {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: #fff;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.8rem;
    cursor: pointer;
    margin-left: auto;
    transition: background 0.2s;
    font-weight: 600;
}

.connection-retry-btn:hover {
    background: rgba(255, 255, 255, 0.25);
}

@keyframes shake {

    0%,
    100% {
        transform: translateX(-50%);
    }

    25% {
        transform: translateX(calc(-50% - 5px));
    }

    75% {
        transform: translateX(calc(-50% + 5px));
    }
}

.connection-toast.shake {
    animation: shake 0.4s ease-in-out;
}

/* ================= ERROR STATE CARD ================= */
.error-state-card {
    grid-column: 1 / -1;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    background: rgba(28, 28, 30, 0.6);
    border: 1px solid rgba(255, 69, 58, 0.3);
    border-radius: 18px;
    text-align: center;
    margin: 20px 0;
    animation: fadeIn 0.5s ease;
}

.error-state-card .error-icon {
    color: #ff453a;
    margin-bottom: 16px;
    background: rgba(255, 69, 58, 0.1);
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.error-state-card h3 {
    color: #fff;
    margin: 0 0 8px 0;
    font-size: 1.2rem;
}

.error-state-card p {
    color: #98989d;
    margin: 0 0 24px 0;
    font-size: 0.95rem;
    max-width: 300px;
    line-height: 1.5;
}

.error-state-card .retry-btn {
    background: #ff453a;
    color: white;
    border: none;
    padding: 12px 28px;
    border-radius: 99px;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 4px 12px rgba(255, 69, 58, 0.3);
}

.error-state-card .retry-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(255, 69, 58, 0.4);
    background: #ff5f56;
}

/* ================= SETTINGS MODAL ================= */
.settings-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    z-index: 4000;
    display: none;
    justify-content: center;
    align-items: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.settings-overlay.active {
    display: flex;
    opacity: 1;
}

.settings-card {
    width: 90%;
    max-width: 900px;
    height: 80vh;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 24px;
    display: flex;
    overflow: hidden;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.5);
}

/* Settings Sidebar */
.settings-sidebar {
    width: 240px;
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    padding: 24px 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.settings-nav-item {
    padding: 12px 16px;
    border-radius: 12px;
    color: var(--text-secondary);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.95rem;
    text-decoration: none;
    border: none;
    background: transparent;
    width: 100%;
    text-align: left;
}

.settings-nav-item:hover {
    background: var(--hover-bg);
    color: var(--text-primary);
}

.settings-nav-item.active {
    background: var(--primary);
    color: #fff;
    box-shadow: 0 4px 12px rgba(10, 132, 255, 0.3);
}

/* Settings Content */
.settings-content {
    flex: 1;
    padding: 32px;
    overflow-y: auto;
    position: relative;
}

.settings-section {
    display: none;
    animation: fadeIn 0.3s ease;
}

.settings-section.active {
    display: block;
}

.settings-header {
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.settings-header h2 {
    margin: 0;
    font-size: 1.5rem;
    color: var(--text-primary);
}

.settings-header p {
    margin: 8px 0 0;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.settings-close-btn {
    background: var(--hover-bg);
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: 0.2s;
}

.settings-close-btn:hover {
    background: var(--hover-bg);
    color: #ff453a;
}

/* Form Groups */
.setting-group {
    margin-bottom: 28px;
}

.setting-label {
    display: block;
    color: var(--text-primary);
    font-weight: 500;
    margin-bottom: 8px;
    font-size: 1rem;
}

.setting-desc {
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin-bottom: 12px;
    line-height: 1.5;
}

/* Theme Selector */
.theme-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(50px, 1fr));
    gap: 16px;
    margin-top: 16px;
}

.theme-swatch {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid var(--border-color);
    transition: transform 0.2s, border-color 0.2s;
    position: relative;
}

.theme-swatch:hover {
    transform: scale(1.1);
    border-color: var(--text-primary);
}

.theme-swatch.active {
    border-color: #fff;
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.15);
}

.theme-swatch.active::after {
    content: '';
    position: absolute;
    inset: 0;
    margin: auto;
    width: 12px;
    height: 6px;
    border-left: 2px solid #fff;
    border-bottom: 2px solid #fff;
    transform: rotate(-45deg) translate(1px, -1px);
}

/* Toggle Switch */
.toggle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    background: var(--hover-bg);
    border-radius: 12px;
    margin-bottom: 12px;
    border: 1px solid var(--border-color);
    transition: background 0.2s;
}

.toggle-row:hover {
    background: var(--hover-bg);
}

.toggle-info h4 {
    margin: 0 0 4px;
    color: var(--text-primary);
    font-size: 0.95rem;
}

.toggle-info p {
    margin: 0;
    color: var(--text-secondary);
    font-size: 0.8rem;
}

.switch {
    position: relative;
    display: inline-block;
    width: 46px;
    height: 26px;
    flex-shrink: 0;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--input-bg);
    transition: .3s cubic-bezier(0.4, 0.0, 0.2, 1);
    border-radius: 34px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .3s cubic-bezier(0.4, 0.0, 0.2, 1);
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

input:checked+.slider {
    background-color: var(--primary);
}

input:checked+.slider:before {
    transform: translateX(20px);
}

/* Profile Edit */
.profile-edit-section {
    background: var(--hover-bg);
    border-radius: 16px;
    padding: 20px;
    border: 1px solid var(--border-color);
}

.profile-header {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 24px;
}

.profile-avatar-large {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--primary);
    background: #2c2c2e;
}

.profile-actions {
    display: flex;
    gap: 10px;
}

.btn-secondary {
    background: var(--hover-bg);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 8px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    transition: 0.2s;
}

.btn-secondary:hover {
    background: var(--hover-bg);
}

.btn-danger {
    background: rgba(255, 69, 58, 0.1);
    border: 1px solid rgba(255, 69, 58, 0.2);
    color: #ff453a;
    padding: 8px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    transition: 0.2s;
}

.btn-danger:hover {
    background: rgba(255, 69, 58, 0.2);
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.input-wrapper {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.input-wrapper label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.settings-input {
    width: 100%;
    background: var(--input-bg);
    border: 1px solid var(--border-color);
    padding: 12px 16px;
    border-radius: 10px;
    color: var(--text-primary);
    font-size: 0.95rem;
    transition: 0.2s;
}

.settings-input:focus {
    outline: none;
    border-color: var(--primary);
    background: var(--input-bg);
}

/* Mobile Adaptation */
@media (max-width: 768px) {
    .settings-card {
        flex-direction: column;
        width: 100%;
        height: 100%;
        max-height: 100%;
        border-radius: 0;
        border: none;
    }

    .settings-sidebar {
        width: 100%;
        flex-direction: row;
        overflow-x: auto;
        padding: 12px;
        background: var(--bg-surface);
        border-bottom: 1px solid var(--border-color);
        border-right: none;
        flex-shrink: 0;
        gap: 8px;
    }

    .settings-sidebar::-webkit-scrollbar {
        display: none;
    }

    .settings-nav-item {
        white-space: nowrap;
        padding: 8px 16px;
        font-size: 0.85rem;
        background: var(--hover-bg);
        border-radius: 20px;
        width: auto;
    }

    .settings-nav-item.active {
        background: var(--primary);
    }

    .settings-content {
        padding: 20px;
    }

    .form-grid {
        grid-template-columns: 1fr;
    }

    .settings-header {
        margin-bottom: 20px;
    }
}


@media (max-width: 768px) {
    .desktop-view {
        display: none !important;
    }
}

@media (min-width: 769px) {
    .mobile-view {
        display: none !important;
    }
}

.sidebar-btn.top {
    position: relative;
    overflow: visible !important;
}

.notification-dot {
    position: absolute;
    top: -2px;
    right: -2px;
    width: 16px;
    height: 16px;
    background-color: #ff0000;
    border: 2px solid #ffffff7d;
    border-radius: 50%;
    z-index: 10;
}

/* Filter Active Animation */
@keyframes glowGreen {
    0% {
        box-shadow: 0 0 0 0 rgba(76, 175, 80, 0.4);
    }

    70% {
        box-shadow: 0 0 0 10px rgba(76, 175, 80, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(76, 175, 80, 0);
    }
}

.filter-trigger.active-filters {
    animation: glowGreen 2s infinite;
    border-color: #4caf50 !important;
    color: #4caf50 !important;
}

.filter-trigger.active-filters img {
    filter: sepia(100%) hue-rotate(80deg) saturate(400%) brightness(1.2) !important;
}

/* Welcome Banner Styles */
.welcome-banner {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    background-position: center;
    background-repeat: no-repeat;
    background-size: cover;
    position: relative;
    height: 440px;
    padding: 40px 20px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
    overflow: hidden;
    margin-bottom: 8px;
}

@media (min-width: 769px) {
    .welcome-banner {
        background-image: url(hero.webp);
    }
}

.welcome-banner::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle at center, rgba(61, 133, 255, 0.06) 0%, transparent 60%);
    pointer-events: none;
}

.welcome-title {
    font-family: 'Inter', sans-serif;
    font-size: 3.2rem;
    font-weight: 800;
    margin: 0 0 12px 0;
    color: #fff;
    letter-spacing: -0.03em;
    position: relative;
    z-index: 1;
}

.welcome-brand {
    background: linear-gradient(135deg, #fff 30%, #70a1ff 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 10px 30px rgba(61, 133, 255, 0.3);
}

.welcome-text {
    font-size: 1.25rem;
    color: #dedede;
    max-width: 600px;
    margin: 0 auto;
    line-height: 1.6;
    position: relative;
    z-index: 1;

}

/* Desktop Welcome Search Box */
.welcome-search-box {
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 30px;
    padding: 8px 16px;
    margin-top: 30px;
    width: 100%;
    max-width: 600px;
    transition: all 0.3s ease;
    position: relative;
    z-index: 2;
}

.welcome-search-box:focus-within {
    background: rgba(255, 255, 255, 0.15);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.welcome-search-icon {
    width: 20px;
    height: 20px;
    opacity: 0.7;
    margin-right: 10px;
}

.welcome-search-input {
    flex: 1;
    background: transparent;
    border: none;
    color: #fff;
    font-size: 1rem;
    outline: none;
}

.welcome-search-btn {
    background: var(--primary);
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.2s;
}

.welcome-search-btn:hover {
    transform: scale(1.05);
}

.welcome-search-btn img {
    width: 18px;
    height: 18px;
    filter: brightness(0) invert(1);
}

/* ================= BACKGROUND SHAPES (PC) ================= */
.background-shapes {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    pointer-events: none;
    overflow: hidden;
}

.shape {
    position: absolute;
    will-change: transform;
}

.shape-triangle {
    top: 15%;
    left: 8%;
    animation: floatShape 6s ease-in-out infinite;
}

.shape-circle {
    top: 55%;
    right: 12%;
    animation: floatShape 8s ease-in-out infinite reverse;
}

.shape-cross {
    bottom: 15%;
    left: 18%;
    animation: spinShape 12s linear infinite;
}

.shape-squiggle {
    top: 25%;
    right: 25%;
    animation: floatShape 7s ease-in-out infinite 1s;
}

/* Driving Animation */
.shape-driver {
    top: 85%;
    left: -100px;
    opacity: 0.15;
    animation: driveAcross 25s linear infinite;
}

@keyframes floatShape {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-20px);
    }
}

@keyframes spinShape {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

@keyframes driveAcross {
    0% {
        transform: translateX(-100px) rotate(0deg);
    }

    100% {
        transform: translateX(110vw) rotate(360deg);
    }
}

/* ================= MOBILE BANNER DECO ================= */
.banner-deco {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    overflow: hidden;
}

.deco-shape {
    position: absolute;
}

.deco-1 {
    top: -20px;
    right: -20px;
    opacity: 1;
}

.deco-2 {
    bottom: 10px;
    left: -10px;
    opacity: 1;
}

@media (max-width: 768px) {
    .welcome-title {
        font-size: 2.5rem;
        color: var(--text-primary);
    }

    .hero-section {
        background-image: none;
        --hero-text: var(--text-primary);
    }

    .welcome-text {
        font-size: 1.1rem;
        color: var(--text-secondary);
    }

    .welcome-banner {
        display: flex;
        padding: 30px 20px;
        border-radius: 2px;
        background-image: none;
        background-color: var(--bg-surface);
        height: auto;
    }

    /* Mobile Welcome Search Bar Design */
    .welcome-search-box {
        display: flex;
        align-items: center;
        background-color: rgba(22, 22, 22, 0.85);
        backdrop-filter: blur(12px);
        -webkit-backdrop-filter: blur(12px);
        border: 1px solid rgba(255, 255, 255, 0.1);
        border-radius: 30px;
        padding: 8px 8px 8px 20px;
        margin-top: 25px;
        box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
        width: 100%;
        transition: transform 0.3s ease, box-shadow 0.3s ease;
    }

    .welcome-search-box:focus-within {
        transform: translateY(-2px);
        box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
        border-color: rgba(255, 255, 255, 0.2);
    }

    .welcome-search-icon {
        width: 22px;
        height: 22px;
        opacity: 0.7;
        filter: brightness(0) invert(1);
        margin-right: 12px;
        flex-shrink: 0;
    }

    .welcome-search-input {
        flex: 1;
        background: transparent;
        border: none;
        color: #fff;
        font-size: 16px;
        font-weight: 500;
        outline: none;
        min-width: 0;
        height: 40px;
    }

    .welcome-search-input::placeholder {
        color: rgba(255, 255, 255, 0.5);
    }

    .welcome-search-btn {
        width: 44px;
        height: 44px;
        border-radius: 50%;
        border: none;
        background-color: rgba(0, 0, 0, 0.608);
        color: #fff;
        display: flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        flex-shrink: 0;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
        transition: transform 0.2s;
    }

    .welcome-search-btn:active {
        transform: scale(0.95);
    }

    .welcome-search-btn img {
        width: 20px;
        height: 20px;
        filter: brightness(0) invert(1);
    }

    /* Hide User Profile Name on Mobile Cards */
    .mobile-username {
        display: none !important;
    }

    /* Hide Hero Right (Images) on Mobile to save data */
    .hero-right {
        display: none !important;
    }

    .hero-left {
        align-items: center;
        justify-content: center;
        width: 100%;
    }

    /* Mobile Hero Section Optimization */
    .hero-section {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        padding: 24px 16px;
        margin-bottom: 24px;
        background: radial-gradient(circle at 100% 0%, rgba(61, 133, 255, 0.08) 0%, transparent 40%);
        border: 1px solid rgba(255, 255, 255, 0.05);
    }

    .hero-title-box {
        font-size: 2.2rem;
        text-align: center;
        padding: 0;
    }

    .hero-subtitle-box {
        text-align: center;
        padding: 16px;
        font-size: 0.95rem;
        background: rgba(255, 255, 255, 0.03);
    }

    .hero-search-wrapper {
        padding: 8px 12px;
    }

    .hero-search-icon {
        width: 22px;
        height: 22px;
    }

    .hero-icon-btn {
        width: 34px;
        height: 34px;
    }
}

@media (max-width: 480px) {
    .hero-section {
        padding: 16px 12px;
    }

    .hero-title-box {
        font-size: 1.75rem;
        margin-bottom: 10px;
    }

    .hero-subtitle-box {
        font-size: 0.85rem;
        padding: 12px;
        line-height: 1.4;
    }

    .hero-search-wrapper {
        padding: 6px 10px;
        gap: 8px;
    }

    .hero-search-input {
        font-size: 14px;
        height: 38px;
    }

    .hero-icon-btn {
        width: 30px;
        height: 30px;
    }

    .hero-search-icon {
        width: 18px;
        height: 18px;
    }
}

@media (max-width: 360px) {
    .hero-section {
        padding: 10px 4px;
        border-radius: 12px;
    }

    .hero-title-box {
        font-size: 1.3rem;
        margin-bottom: 6px;
        word-wrap: break-word;
    }

    .hero-subtitle-box {
        font-size: 0.7rem;
        padding: 6px;
        min-height: auto;
        line-height: 1.3;
    }

    .hero-search-wrapper {
        padding: 3px 5px;
        gap: 4px;
    }

    .hero-search-input {
        font-size: 12px;
        height: 30px;
    }

    .hero-icon-btn {
        width: 24px;
        height: 24px;
    }

    .hero-icon-btn img {
        width: 14px !important;
        height: 14px !important;
    }

    .hero-search-actions {
        gap: 2px;
    }
}

@media (max-width: 768px) {
    .viewer-left {
        display: flex !important;
        flex-direction: column;
        height: 100% !important;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch;
        min-height: 200px;
        /* Hide scrollbar for mobile viewer */
        scrollbar-width: none;
        /* Firefox */
        -ms-overflow-style: none;
        /* IE/Edge */
    }

    .viewer-left::-webkit-scrollbar {
        display: none;
        /* Chrome/Safari */
    }

    .main-image {
        height: auto !important;
        max-height: 85vh !important;
        /* Allow vertical images to be taller/wider */
        margin-top: 10px !important;
        /* Reduced margin */
        margin-bottom: 20px !important;
        /* Reduced margin */
    }

    .quality-text {
        position: static !important;
        transform: none !important;
        text-align: center;
        margin-top: 70px !important;
        /* Clear the absolute header */
        margin-bottom: 5px !important;
        width: 100%;
    }
}

/* Mobile Loading Animation */
.mobile-surface-loader {
    position: absolute;
    top: 40%;
    left: 50%;
    transform: translateX(-50%) scale(0.8);
    z-index: 9999;
    background: #161616;
    padding: 12px;
    border-radius: 50%;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.1);
    display: none;
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.mobile-surface-loader.active {
    display: flex;
    opacity: 1;
    transform: translateX(-50%) scale(1);
}

.surface-spinner {
    width: 28px;
    height: 28px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    border-top-color: #3d85ff;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Light Theme Button Overrides */
[data-theme="light"] .sidebar-btn,
[data-theme="light"] .nav-btn,
[data-theme="light"] .view-all,
[data-theme="light"] .card-action-btn {
    background-color: #000 !important;
    color: #fff !important;
    border-color: #000 !important;
}

[data-theme="light"] .sidebar-btn:hover,
[data-theme="light"] .nav-btn:hover {
    background-color: #333 !important;
}

[data-theme="light"] .sidebar-btn .sidebar-icon,
[data-theme="light"] .nav-btn img {
    filter: brightness(0) invert(1) !important;
}

/* Remove default browser search icons */
input[type="search"]::-webkit-search-decoration,
input[type="search"]::-webkit-search-cancel-button,
input[type="search"]::-webkit-search-results-button,
input[type="search"]::-webkit-search-results-decoration {
    display: none;
}

@media (max-width: 768px) {
    .search-category-btn {
        max-width: 90px;
        display: flex !important;
        align-items: center;
        justify-content: space-between;
    }

    .search-category-text {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        flex: 1;
    }

    .search-category-btn .material-icons {
        flex-shrink: 0;
    }
}

/* Mobile Filter Popup Updates */
@media (max-width: 768px) {
    .category-content {
        width: 90% !important;
        max-height: 80vh !important;
        padding: 0 !important;
        border-radius: 16px !important;
    }

    .category-scroll {
        padding: 20px 15px !important;
        scrollbar-width: none;
        /* Firefox */
        -ms-overflow-style: none;
        /* IE 10+ */
    }

    .category-scroll::-webkit-scrollbar {
        display: none;
        /* Chrome/Safari/Webkit */
    }

    .category-scroll h2 {
        font-size: 1.3rem !important;
        margin-bottom: 8px !important;
    }

    .category-scroll p {
        font-size: 0.9rem !important;
        margin-bottom: 20px !important;
    }

    .category-scroll .section-title {
        font-size: 0.9rem !important;
        margin-bottom: 10px !important;
        height: auto !important;
        opacity: 1 !important;
        margin-left: 0 !important;
    }

    /* Reduce gaps between sections */
    .category-scroll>div {
        margin-bottom: 20px !important;
        padding-bottom: 15px !important;
        border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    }

    .category-scroll>div>div {
        gap: 12px !important;
    }

    .category-scroll>div>div>div {
        min-width: 100% !important;
        flex: none !important;
    }

    /* Button adjustments */
    .category-scroll .filter-btn {
        font-size: 0.85rem !important;
        padding: 10px 12px !important;
        height: auto !important;
        min-height: 38px !important;
        max-height: none !important;
        opacity: 1 !important;
        transform: none !important;
        pointer-events: auto !important;
        width: auto !important;
    }

    .category-scroll .btn-grid {
        gap: 8px !important;
    }

    #modalResGrid {
        grid-template-columns: repeat(4, 1fr) !important;
    }

    #modalSizeGrid {
        grid-template-columns: repeat(3, 1fr) !important;
    }

    #modalSortGrid {
        grid-template-columns: repeat(3, 1fr) !important;
    }

    .category-grid {
        gap: 8px !important;
        grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)) !important;
        margin-top: 15px !important;
    }

    .category-item {
        font-size: 0.9rem !important;
        padding: 10px !important;
    }

    .apply-btn {
        padding: 14px !important;
        font-size: 1rem !important;
        margin-top: 0 !important;
    }

    .category-footer {
        padding: 15px 20px !important;
    }

    #closeCategoryBtn {
        top: 15px !important;
        right: 15px !important;
    }
}

/* Fix for Search & Filter Icons in Light Mode */
[data-theme="light"] .search-action-btn img,
[data-theme="light"] .mobile-search-btn img {
    filter: brightness(0) !important;
}

[data-theme="light"] .hero-icon-btn img {
    filter: brightness(0) invert(1) !important;
}

[data-theme="light"] .search-category-btn {
    color: #000 !important;
}

/* Global Scrollbar Customization */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: var(--bg-body);
}

::-webkit-scrollbar-thumb {
    background: #333;
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* REPORT MODAL STYLES */
.report-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
    z-index: 11000;
    display: none;
    justify-content: center;
    align-items: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.report-overlay.active {
    display: flex;
    opacity: 1;
}

.report-card {
    background: var(--bg-surface);
    width: 90%;
    max-width: 400px;
    border-radius: 16px;
    border: 1px solid var(--border-color);
    padding: 24px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    transform: scale(0.95);
    transition: transform 0.3s ease;
}

.report-overlay.active .report-card {
    transform: scale(1);
}

.report-header {
    margin-bottom: 20px;
    text-align: center;
}

.report-header h2 {
    margin: 0;
    color: var(--text-primary);
    font-size: 1.2rem;
}

.report-header p {
    margin: 5px 0 0;
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.report-options {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 20px;
}

.report-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    background: var(--input-bg);
    border-radius: 8px;
    cursor: pointer;
    transition: 0.2s;
    border: 1px solid transparent;
}

.report-option:hover {
    background: var(--hover-bg);
}

.report-option input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: #ff453a;
}

.report-option label {
    color: var(--text-primary);
    font-size: 0.9rem;
    cursor: pointer;
    flex: 1;
}

.report-text {
    width: 100%;
    background: var(--input-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 12px;
    color: var(--text-primary);
    font-family: inherit;
    resize: vertical;
    min-height: 80px;
    margin-bottom: 20px;
    outline: none;
}

.report-text:focus {
    border-color: var(--primary);
}

.report-actions {
    display: flex;
    gap: 10px;
}

.report-btn-submit {
    flex: 1;
    background: #ff453a;
    color: white;
    border: none;
    padding: 12px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: 0.2s;
}

.report-btn-submit:hover {
    background: #ff5f56;
}

.report-btn-cancel {
    flex: 1;
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 12px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: 0.2s;
}

.report-btn-cancel:hover {
    background: var(--hover-bg);
}


@media (max-width: 768px) {
    .similar-grid {
        grid-template-columns: 1fr;
    }

    .welcome-title {
        font-size: 2.6rem !important;
        line-height: 1.3 !important;
        text-align: center;
    }

    .welcome-text {
        font-size: 1rem !important;
        line-height: 1.5 !important;
        text-align: center;
    }

    .welcome-banner {
        padding: 25px 15px !important;
        margin-bottom: 25px;
    }

    .welcome-search-box {
        width: 95% !important;
        min-width: 280px;
        padding: 8px 15px !important;
    }

    .welcome-search-icon,
    .welcome-search-btn img {
        width: 20px !important;
        height: 20px !important;
    }

    .mobile-card-footer {
        display: none !important;
    }
}

/* Splash Screen Loader */
#app-splash {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #000000;
    z-index: 9999999;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.6s ease-out, visibility 0.6s;
}

#app-splash.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.splash-brand {
    font-family: 'Outfit', sans-serif;
    font-size: 3.5rem;
    font-weight: 800;
    letter-spacing: -2px;
    background: linear-gradient(to right, #ffffff, #666666);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.google-btn {
    background: #fff !important;
    color: #333 !important;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    border: 1px solid #ddd;
}

@keyframes pulseBrand {

    0%,
    100% {
        opacity: 1;
        transform: scale(1);
    }

    50% {
        opacity: 0.7;
        transform: scale(0.98);
    }
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

@keyframes skeleton-loading {
    0% {
        background-position: 200% 0;
    }

    100% {
        background-position: -200% 0;
    }
}

/* --- AI BUTTON STYLES --- */
.ai-sparkle-icon {
    width: 20px;
    height: 20px;
    filter: drop-shadow(0 0 2px rgba(255, 255, 255, 0.5));
}

.ai-gradient-btn {
    background: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 50%, #ec4899 100%);
    background-size: 200% 200%;
    animation: ai-gradient-anim 3s ease infinite;
    border: none !important;
    color: white !important;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.ai-gradient-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 0 15px rgba(139, 92, 246, 0.6);
}

@keyframes ai-gradient-anim {
    0% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }

    100% {
        background-position: 0% 50%;
    }
}

.ai-text-gradient {
    background: linear-gradient(to right, #60a5fa, #c084fc);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    font-weight: 700;
}

/* --- UPDATED AI BUTTON STYLES --- */
.ai-gen-btn {
    background: linear-gradient(45deg, #ec4899, #8b5cf6, #3b82f6, #ec4899);
    background-size: 300% 300%;
    color: white !important;
    border: none !important;
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(236, 72, 153, 0.4);
    animation: ai-gradient-anim 3s ease infinite, ai-pulse 2s infinite;
}

.ai-gen-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(236, 72, 153, 0.6);
}

.ai-gen-btn svg {
    width: 24px !important;
    height: 24px !important;
    filter: brightness(0) invert(1) !important;
    fill: white !important;
}

/* --- Make all AI buttons circular icons --- */
.sidebar .ai-gen-btn,
.hero-search-actions .ai-gen-btn,
.welcome-search-box .ai-gen-btn {
    border-radius: 50% !important;
    width: 44px !important;
    height: 44px !important;
    padding: 0 !important;
    flex-shrink: 0;
    /* Prevent shrinking in flex container */
}

/* Hide text on the sidebar button to make it an icon */
.sidebar .ai-gen-btn span {
    display: none !important;
}

/* Floating Comment (Tooltip) */
.ai-gen-btn::after {
    content: "Generate img with AI";
    position: absolute;
    bottom: 115%;
    left: 50%;
    transform: translateX(-50%) translateY(10px);
    background: var(--bg-surface);
    color: var(--text-primary);
    padding: 6px 10px;
    border-radius: 8px;
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.27, 1.55);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-color);
    z-index: 1000;
    pointer-events: none;
}

/* Arrow for tooltip */
.ai-gen-btn::before {
    content: '';
    position: absolute;
    bottom: 105%;
    left: 50%;
    transform: translateX(-50%) translateY(10px);
    border-width: 6px;
    border-style: solid;
    border-color: var(--bg-surface) transparent transparent transparent;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.27, 1.55);
    z-index: 1000;
}

.ai-gen-btn:hover::after,
.ai-gen-btn:hover::before {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

@keyframes ai-pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(236, 72, 153, 0.7);
    }

    70% {
        box-shadow: 0 0 0 10px rgba(236, 72, 153, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(236, 72, 153, 0);
    }
}

/* Fix for small screens (300px) in Hero Search */
@media (max-width: 380px) {
    .hero-search-wrapper {
        padding: 4px 4px 4px 8px !important;
    }

    .hero-search-actions {
        gap: 2px !important;
    }

    .hero-search-actions .hero-icon-btn,
    .hero-search-actions .ai-gen-btn {
        width: 35px !important;
        height: 35px !important;
        padding: 0 !important;
    }

    .hero-search-actions .hero-icon-btn img,
    .hero-search-actions .ai-gen-btn svg {
        width: 18px !important;
        height: 18px !important;
    }

    .hero-search-wrapper input {
        padding-left: 30px !important;
        font-size: 14px !important;
    }

    .hero-search-icon {
        width: 18px !important;
        height: 18px !important;
        left: 8px !important;
    }

    /* Hide middle button (Options) to give space to input */
    .hero-search-actions>div:nth-child(2) {
        display: none !important;
    }
}

/* ... existing code ... */
.report-btn-cancel:hover {
    background: var(--hover-bg);
}

/* ================= CONTEXT MENU ================= */
.card-context-menu {
    position: fixed;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 6px;
    min-width: 170px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 2px;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    animation: fadeInScale 0.2s ease-out;
}

.ctx-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 8px;
    cursor: pointer;
    color: var(--text-primary);
    font-size: 0.9rem;
    font-weight: 500;
    transition: background 0.2s;
}

.ctx-item:hover {
    background: var(--hover-bg);
    color: var(--primary);
}

.ctx-item img,
.ctx-item svg {
    width: 18px;
    height: 18px;
    opacity: 0.8;
    filter: brightness(0) invert(1);
    object-fit: contain;
}

[data-theme="light"] .ctx-item img,
[data-theme="light"] .ctx-item svg {
    filter: brightness(0);
}

.ctx-item:hover img,
.ctx-item:hover svg {
    opacity: 1;
}

/* Brand 'e' Animation */
#animE {
    display: inline-block;
    transition: color 0.3s ease;
}

#animE.active {
    color: #ff0000 !important;
    -webkit-text-fill-color: #ff0000 !important;
    /* Override gradient */
    font-weight: 900;
    animation: wiggleBrand 0.5s ease-in-out infinite;
}

@keyframes wiggleBrand {

    0%,
    100% {
        transform: rotate(0deg) scale(1.2);
    }

    25% {
        transform: rotate(-15deg) scale(1.4);
    }

    75% {
        transform: rotate(15deg) scale(1.4);
    }
}

/* ================= USER SEARCH CARD ================= */
.user-search-card {
    background: var(--bg-surface-darker);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    break-inside: avoid;
    margin-bottom: 24px;
    width: 100%;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    cursor: pointer;
}

.user-search-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.2);
}

.user-card-header {
    display: flex;
    align-items: center;
    gap: 15px;
}

.user-card-avatar {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--primary);
    flex-shrink: 0;
}

.user-card-info {
    flex-grow: 1;
    min-width: 0;
}

.user-card-name {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-card-stats {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-top: 4px;
}

.user-card-follow-btn {
    padding: 8px 20px;
    border-radius: 20px;
    border: none;
    background: var(--primary);
    color: white;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
    font-size: 0.9rem;
}

.user-card-follow-btn.secondary {
    background: var(--hover-bg);
    color: var(--text-secondary);
}

.user-card-follow-btn:hover {
    transform: scale(1.05);
}

.user-card-gallery {
    position: relative;
    width: 100%;
    aspect-ratio: 4 / 3;
    border-radius: 12px;
    overflow: hidden;
    background: var(--input-bg);
}

.user-gallery-inner {
    display: flex;
    height: 100%;
    transition: transform 1s cubic-bezier(0.77, 0, 0.175, 1);
}

.user-gallery-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Mobile User Card */
@media (max-width: 768px) {
    .user-search-card {
        flex-direction: row;
        align-items: center;
        padding: 12px;
        grid-column: 1 / -1;
        /* Span full width */
        margin-bottom: 12px;
    }

    .user-card-avatar {
        width: 48px;
        height: 48px;
    }

    .user-card-gallery {
        display: none;
    }

    .user-card-follow-btn {
        margin-left: auto;
        padding: 6px 16px;
        font-size: 0.8rem;
    }
}

/* ================= AI IMAGE GENERATOR UI ================= */

/* Floating Button (PC Only) */
.ai-fab {
    position: fixed;
    right: 30px;
    bottom: 30px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: rgba(40, 40, 40, 0.4);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 1000;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3), inset 0 0 15px rgba(255, 255, 255, 0.05);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    overflow: hidden;
}

[data-theme="light"] .ai-fab {
    background: rgba(255, 255, 255, 0.6);
    border: 1px solid rgba(0, 0, 0, 0.05);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1), inset 0 0 15px rgba(255, 255, 255, 0.5);
}

.ai-fab::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 50%;
    height: 100%;
    background: linear-gradient(to right, transparent, rgba(255, 255, 255, 0.2), transparent);
    transform: skewX(-20deg);
    transition: 0.5s;
}

.ai-fab:hover::before {
    left: 100%;
}

.ai-fab:hover {
    transform: translateY(-5px) scale(1.05);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.4), inset 0 0 20px rgba(255, 255, 255, 0.1);
    background: rgba(50, 50, 50, 0.5);
}

[data-theme="light"] .ai-fab:hover {
    background: rgba(255, 255, 255, 0.8);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.15), inset 0 0 20px rgba(255, 255, 255, 0.6);
}

.ai-fab svg {
    width: 28px;
    height: 28px;
    fill: none;
    stroke: url(#gradient-sparkle);
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    transition: transform 0.4s;
}

[data-theme="light"] .ai-fab svg {
    stroke: url(#gradient-sparkle-light);
}

.ai-fab:hover svg {
    transform: rotate(15deg);
}

/* Slide-out Panel */
.ai-panel {
    position: fixed;
    right: -420px;
    bottom: 30px;
    width: 380px;
    background: rgba(20, 20, 22, 0.85);
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 24px;
    padding: 24px;
    z-index: 1001;
    box-shadow: -10px 10px 40px rgba(0, 0, 0, 0.5), inset 0 1px 1px rgba(255, 255, 255, 0.1);
    transition: all 0.5s cubic-bezier(0.25, 1, 0.5, 1);
    display: flex;
    flex-direction: column;
    gap: 16px;
    opacity: 0;
    pointer-events: none;
    transform: translateX(20px);
}

[data-theme="light"] .ai-panel {
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(0, 0, 0, 0.08);
    box-shadow: -10px 10px 40px rgba(0, 0, 0, 0.15), inset 0 1px 1px rgba(255, 255, 255, 0.8);
}

.ai-panel.active {
    right: 30px;
    opacity: 1;
    pointer-events: auto;
    transform: translateX(0);
}

.ai-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}

.ai-panel-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
    font-family: 'Outfit', sans-serif;
    display: flex;
    align-items: center;
    gap: 8px;
}

.ai-panel-title .sparkle-icon {
    width: 20px;
    height: 20px;
    color: var(--primary);
}

.ai-panel-close {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 6px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.ai-panel-close:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

[data-theme="light"] .ai-panel-close:hover {
    background: rgba(0, 0, 0, 0.05);
}

/* ==== Custom Dropdowns ==== */
.ai-custom-dd {
    position: relative;
}

.ai-custom-dd-trigger {
    display: flex;
    align-items: center;
    gap: 5px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    padding: 5px 8px;
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 0.75rem;
    font-weight: 500;
    transition: all 0.2s;
    white-space: nowrap;
}

[data-theme="light"] .ai-custom-dd-trigger {
    background: rgba(0, 0, 0, 0.05);
    border-color: rgba(0, 0, 0, 0.08);
    color: var(--text-primary);
}

.ai-custom-dd-trigger:hover {
    background: rgba(255, 255, 255, 0.12);
    color: var(--text-primary);
}

.ai-custom-dd.open .ai-custom-dd-trigger {
    background: rgba(10, 132, 255, 0.1);
    border-color: var(--primary);
    color: var(--primary);
}

.dd-ratio-preview {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
}

.dd-model-logo {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.dd-label {
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.01em;
    max-width: 55px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dd-chevron {
    width: 10px;
    height: 10px;
    flex-shrink: 0;
    transition: transform 0.2s;
}

.ai-custom-dd.open .dd-chevron {
    transform: rotate(180deg);
}

.ai-custom-dd-list {
    position: absolute;
    bottom: calc(100% + 6px);
    left: 0;
    min-width: 160px;
    background: rgba(18, 18, 22, 0.96);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 6px;
    display: none;
    flex-direction: column;
    gap: 2px;
    z-index: 10000;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
}

[data-theme="light"] .ai-custom-dd-list {
    background: rgba(255, 255, 255, 0.98);
    border-color: rgba(0, 0, 0, 0.1);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
}

.ai-custom-dd.open .ai-custom-dd-list {
    display: flex;
}

.dd-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 8px;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 0.82rem;
    font-weight: 500;
    cursor: pointer;
    text-align: left;
    transition: all 0.15s;
    width: 100%;
}

.dd-option svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.dd-option:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
}

[data-theme="light"] .dd-option:hover {
    background: rgba(0, 0, 0, 0.05);
}

.dd-option.active {
    background: rgba(10, 132, 255, 0.12);
    color: var(--primary);
}

[data-theme="light"] .dd-option.active {
    background: rgba(10, 132, 255, 0.1);
}

.dd-ratio-tag {
    margin-left: auto;
    font-size: 0.7rem;
    opacity: 0.5;
    font-variant-numeric: tabular-nums;
}

/* Feed Area */
.ai-feed {
    flex: 1;
    overflow-y: scroll;
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding-right: 6px;
    margin-bottom: 0;
    max-height: 320px;
    min-height: 60px;
    scroll-behavior: smooth;
}

.ai-feed::-webkit-scrollbar {
    width: 5px;
}

.ai-feed::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.03);
    border-radius: 4px;
}

.ai-feed::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 4px;
}

.ai-feed::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

[data-theme="light"] .ai-feed::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.15);
}

/* Image upload button */
.ai-upload-btn {
    display: flex;
    align-items: center;
    gap: 5px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px dashed rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    padding: 5px 8px;
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 0.75rem;
    font-weight: 500;
    transition: all 0.2s;
    animation: slideInX 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes slideInX {
    from {
        opacity: 0;
        transform: translateX(-10px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.ai-upload-btn:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.35);
    color: var(--text-primary);
}

[data-theme="light"] .ai-upload-btn {
    background: rgba(0, 0, 0, 0.04);
    border-color: rgba(0, 0, 0, 0.18);
}

.ai-upload-btn svg {
    width: 13px;
    height: 13px;
}

/* Edit action button on feed items */
.ai-edit-btn {
    background: rgba(255, 180, 0, 0.12);
    color: #fbbf24;
    border: 1px solid rgba(255, 180, 0, 0.2);
}

.ai-edit-btn:hover {
    background: rgba(255, 180, 0, 0.25);
    border-color: rgba(255, 180, 0, 0.4);
}

.ai-feed-item {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 16px;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    animation: slideInFromTop 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

[data-theme="light"] .ai-feed-item {
    background: rgba(0, 0, 0, 0.03);
    border-color: rgba(0, 0, 0, 0.1);
}

@keyframes slideInFromTop {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.ai-item-img-container {
    width: 100%;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 12px;
    overflow: hidden;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

[data-theme="light"] .ai-item-img-container {
    background: rgba(0, 0, 0, 0.05);
}

.ai-item-prompt {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.ai-result-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

.ai-action-btn {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 8px;
    padding: 8px;
    color: var(--text-primary);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: 0.2s;
}

.ai-action-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

[data-theme="light"] .ai-action-btn {
    background: rgba(0, 0, 0, 0.05);
}

[data-theme="light"] .ai-action-btn:hover {
    background: rgba(0, 0, 0, 0.1);
}

.ai-action-btn svg {
    width: 16px;
    height: 16px;
}

.ai-publish-btn {
    background: var(--primary);
    padding: 8px 12px;
    gap: 6px;
    font-weight: 600;
}

.ai-publish-btn:hover {
    background: var(--primary-dark);
}

.ai-publish-btn svg {
    width: 14px;
    height: 14px;
}

/* Image Preview Container (Iteration 4) */
.ai-preview-container {
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    margin-bottom: 4px;
}

[data-theme="light"] .ai-preview-container {
    border-bottom-color: rgba(0, 0, 0, 0.05);
}

.ai-preview-box {
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(10, 132, 255, 0.08);
    border: 1px solid rgba(10, 132, 255, 0.2);
    border-radius: 12px;
    padding: 8px;
    position: relative;
    animation: slideDownIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes slideDownIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.ai-preview-box img {
    width: 44px;
    height: 44px;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.ai-preview-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.ai-preview-tag {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--primary);
}

.ai-preview-name {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 150px;
}

.ai-preview-remove {
    background: rgba(0, 0, 0, 0.2);
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    cursor: pointer;
    transition: all 0.2s;
}

.ai-preview-remove:hover {
    background: #ff3b30;
    transform: scale(1.1);
}

.ai-preview-remove svg {
    width: 14px;
    height: 14px;
}

/* Input Area */
.ai-input-section {
    position: relative;
    margin-top: auto;
    padding-top: 12px;
    z-index: 100;
    /* Ensure dropdowns float above feed */
}

.ai-chat-input-wrapper {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 16px;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    transition: all 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
    position: relative;
    overflow: hidden;
}

[data-theme="light"] .ai-chat-input-wrapper {
    background: rgba(0, 0, 0, 0.03);
    border: 1px solid rgba(0, 0, 0, 0.1);
}

.ai-chat-input-wrapper:focus-within {
    background: rgba(0, 0, 0, 0.3);
    border-color: rgba(10, 132, 255, 0.5);
    box-shadow: inset 0 0 0 1px rgba(10, 132, 255, 0.2), 0 4px 20px rgba(0, 0, 0, 0.2);
}

[data-theme="light"] .ai-chat-input-wrapper:focus-within {
    background: #fff;
    box-shadow: inset 0 0 0 1px rgba(10, 132, 255, 0.2), 0 4px 20px rgba(0, 0, 0, 0.05);
}

/* Restored pulse animation for input area when generating */
.ai-panel.loading .ai-chat-input-wrapper::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: 16px;
    box-shadow: inset 0 0 20px rgba(10, 132, 255, 0.2);
    animation: scan-pulse 2s infinite alternate;
    pointer-events: none;
    z-index: 1;
}

@keyframes scan-pulse {
    0% {
        box-shadow: inset 0 0 10px rgba(10, 132, 255, 0.1), 0 0 0px var(--primary);
    }

    100% {
        box-shadow: inset 0 0 30px rgba(10, 132, 255, 0.4), 0 0 15px var(--primary);
    }
}

.ai-prompt-area {
    width: 100%;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 0.95rem;
    resize: none;
    height: 60px;
    outline: none;
    font-family: inherit;
    padding: 0;
}

.ai-prompt-area::placeholder {
    color: var(--text-secondary);
    opacity: 0.7;
}

.ai-chat-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    padding-top: 8px;
    position: relative;
    z-index: 2;
}

[data-theme="light"] .ai-chat-controls {
    border-top-color: rgba(0, 0, 0, 0.05);
}

.ai-chat-settings {
    display: flex;
    gap: 8px;
}

.ai-compact-dropdown {
    position: relative;
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    padding: 4px 8px;
    gap: 6px;
    transition: 0.2s;
    border: 1px solid transparent;
}

.ai-compact-dropdown:hover {
    background: rgba(255, 255, 255, 0.1);
}

[data-theme="light"] .ai-compact-dropdown {
    background: rgba(0, 0, 0, 0.05);
}

[data-theme="light"] .ai-compact-dropdown:hover {
    background: rgba(0, 0, 0, 0.08);
}

.dropdown-icon {
    width: 14px;
    height: 14px;
    color: var(--text-secondary);
}

.ai-minimal-select {
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 0.75rem;
    font-weight: 500;
    outline: none;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    padding-right: 12px;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right center;
    background-size: 12px;
}

.ai-minimal-select option {
    background: var(--bg-surface);
    color: var(--text-primary);
}

.ai-chat-send-btn {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark, #0060cc));
    color: white;
    border: none;
    border-radius: 10px;
    padding: 12px 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.2, 0.8, 0.2, 1);
    box-shadow: 0 4px 15px rgba(10, 132, 255, 0.35);
    white-space: nowrap;
    font-size: 0.9rem;
    font-weight: 600;
    font-family: inherit;
    width: 100%;
    margin-top: 12px;
}

.send-ai-icon {
    width: 14px;
    height: 14px;
    filter: drop-shadow(0 0 4px rgba(255, 255, 255, 0.5));
    animation: icon-breathe 3s ease-in-out infinite;
}

@keyframes icon-breathe {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.7;
        transform: scale(0.9);
    }
}

.ai-chat-send-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 22px rgba(10, 132, 255, 0.45);
}

.ai-chat-send-btn:active {
    transform: translateY(0px);
    box-shadow: 0 2px 8px rgba(10, 132, 255, 0.3);
}

.ai-chat-send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}



.ai-generate-btn::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 50%;
    height: 100%;
    background: linear-gradient(to right, transparent, rgba(255, 255, 255, 0.3), transparent);
    transform: skewX(-20deg);
    transition: 0.5s;
}

.ai-generate-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 30px rgba(10, 132, 255, 0.4);
}

.ai-generate-btn:hover::after {
    left: 100%;
}

.ai-generate-btn:active {
    transform: translateY(1px);
}

/* Unique Loading Box Animation */
.ai-loader-container {
    display: none;
    align-items: center;
    justify-content: center;
    height: 100px;
    /* matches textarea height to swap seamlessly */
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 16px;
    position: relative;
}

[data-theme="light"] .ai-loader-container {
    background: rgba(0, 0, 0, 0.03);
    border: 1px solid rgba(0, 0, 0, 0.1);
}

.ai-panel.loading .ai-loader-container {
    display: flex;
}

.ai-panel.loading .ai-prompt-area {
    display: none;
}

.ai-panel.loading .ai-generate-btn {
    opacity: 0.6;
    pointer-events: none;
}

.ai-loader-box {
    width: 24px;
    height: 24px;
    background: var(--primary);
    border-radius: 6px;
    animation: loader-rise 1.4s infinite cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 0 15px rgba(10, 132, 255, 0.6);
}

.ai-loader-glow {
    position: absolute;
    bottom: 25px;
    width: 30px;
    height: 4px;
    background: rgba(10, 132, 255, 0.4);
    border-radius: 50%;
    filter: blur(2px);
    animation: loader-shadow 1.4s infinite cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes loader-rise {
    0% {
        transform: translateY(10px) rotate(0deg) scale(0.8);
    }

    50% {
        transform: translateY(-20px) rotate(180deg) scale(1.2);
    }

    100% {
        transform: translateY(10px) rotate(360deg) scale(0.8);
    }
}

@keyframes loader-shadow {
    0% {
        transform: scale(0.8);
        opacity: 0.8;
    }

    50% {
        transform: scale(1.4);
        opacity: 0.2;
    }

    100% {
        transform: scale(0.8);
        opacity: 0.8;
    }
}

/* Mobile Adjustments */
@media (max-width: 768px) {

    /* Hide the floating button on mobile */
    .ai-fab {
        display: none;
    }

    .ai-panel {
        width: calc(100% - 20px);
        left: 10px;
        right: 10px;
        bottom: -500px;
        transform: translateY(20px);
        background: rgba(20, 20, 22, 0.95);
        backdrop-filter: blur(10px);
        -webkit-backdrop-filter: blur(10px);
        z-index: 9999;
    }

    .ai-panel.active {
        bottom: 10px;
        transform: translateY(0);
        right: 10px;
        left: 10px;
    }
}

@media (max-width: 290px) {
    .ai-panel {
        padding: 16px;
    }

    .ai-panel-title {
        font-size: 1.1rem;
    }
}

/* AI Inline Loader */
.ai-loader-container {
    width: 60px;
    height: 60px;
    position: relative;
}

.ai-loader-glow {
    position: absolute;
    width: 100%;
    height: 100%;
    background: var(--primary);
    border-radius: 50%;
    filter: blur(20px);
    opacity: 0.5;
    animation: aiPulseGlow 2s ease-in-out infinite;
}

.ai-loader-box {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 30px;
    height: 30px;
    background: linear-gradient(135deg, #fff, rgba(255, 255, 255, 0.8));
    border-radius: 8px;
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.5);
    animation: aiFloatBox 2s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

[data-theme="light"] .ai-loader-box {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    box-shadow: 0 0 20px rgba(10, 132, 255, 0.4);
}

@keyframes aiPulseGlow {

    0%,
    100% {
        transform: scale(0.8);
        opacity: 0.3;
    }

    50% {
        transform: scale(1.2);
        opacity: 0.6;
    }
}

@keyframes aiFloatBox {

    0%,
    100% {
        transform: translate(-50%, -50%) rotate(0deg);
    }

    50% {
        transform: translate(-50%, -100%) rotate(180deg);
    }

}

