/* =========================================================
   WallpaperHub — All Wallpapers
   Clean white mobile-first UI
   ========================================================= */

:root{
    --bg:#fff;
    --surface:#fff;
    --surface-soft:#f7f8fb;
    --surface-tint:#f1f3f8;
    --line:#e3e7ee;
    --line-soft:#edf0f4;
    --text:#182033;
    --muted:#718096;
    --muted-2:#98a1b0;
    --accent:#5a63f2;
    --accent-2:#477dff;
    --accent-soft:#eef0ff;
    --danger:#e93668;
    --radius-xl:24px;
    --radius-lg:18px;
    --radius-md:14px;
    --shadow:0 7px 22px rgba(28,39,64,.07);
    --font:system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;
}

*{box-sizing:border-box;margin:0;padding:0}
html{background:#fff;scroll-behavior:smooth}
body{
    min-height:100vh;
    margin:0;
    padding:0 0 94px;
    background:#fff !important;
    color:var(--text) !important;
    font-family:var(--font);
    -webkit-font-smoothing:antialiased;
    text-rendering:optimizeLegibility;
}
button,input,select{font:inherit}
button{border:0}
button:focus-visible,input:focus-visible,select:focus-visible{
    outline:3px solid rgba(90,99,242,.18);
    outline-offset:2px;
}

/* HEADER */
.header{
    position:sticky;
    top:0;
    z-index:100;
    min-height:72px;
    display:grid;
    grid-template-columns:44px 1fr 44px;
    align-items:center;
    gap:9px;
    padding:9px 12px;
    background:rgba(255,255,255,.96);
    border-bottom:1px solid var(--line-soft);
    backdrop-filter:blur(18px);
    -webkit-backdrop-filter:blur(18px);
}
.header-info{text-align:center;min-width:0}
.header-info h2{
    color:var(--text);
    font-size:19px;
    line-height:1.2;
    font-weight:850;
    white-space:nowrap;
    overflow:hidden;
    text-overflow:ellipsis;
}
#wallpaperCount{display:block;margin-top:4px;color:var(--muted);font-size:10px}
.back-btn,.search-btn,.header-more{
    width:44px;height:44px;
    display:flex;align-items:center;justify-content:center;
    border-radius:50%;
    color:#53617a;
    background:#fff;
    border:1px solid #dfe4ec;
    box-shadow:0 4px 12px rgba(28,39,64,.06);
    cursor:pointer;
    transition:.2s ease;
}
.back-btn:hover,.search-btn:hover,.header-more:hover{color:var(--accent);border-color:#cbd2f5;transform:translateY(-1px)}
.header-actions{display:flex;justify-content:flex-end;gap:7px}
.header-actions .header-more{display:none}

/* SEARCH */
.search-section{
    display:flex;
    gap:9px;
    padding:13px 12px 6px;
}
.search-box{
    flex:1;
    min-width:0;
    height:50px;
    display:flex;
    align-items:center;
    gap:9px;
    padding:0 14px;
    background:var(--surface-soft);
    border:1px solid var(--line);
    border-radius:17px;
    box-shadow:0 4px 14px rgba(28,39,64,.04);
}
.search-box .material-icons{font-size:22px;color:#6b7a96}
.search-box input{
    width:100%;min-width:0;border:0;outline:0;background:transparent;
    color:var(--text);font-size:14px;
}
.search-box input::placeholder{color:#98a1b0}
.advanced-filter-btn{
    width:50px;flex:0 0 50px;
    display:flex;align-items:center;justify-content:center;
    border-radius:17px;
    color:#59677f;
    background:#f5f6fa;
    border:1px solid var(--line);
    cursor:pointer;
}

/* FILTERS */
.filters-wrap{padding:8px 0 7px}
.filters-head{
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:8px;
    padding:0 12px 8px;
}
.filters-title{
    display:flex;
    align-items:center;
    gap:6px;
    color:#4f5d74;
    font-size:11px;
}
.filters-title .material-icons{font-size:17px;color:#6878e9}
.categories-trigger{
    height:32px;
    display:inline-flex;
    align-items:center;
    gap:5px;
    padding:0 10px;
    border-radius:10px;
    color:#4f5de0;
    background:var(--accent-soft);
    border:1px solid #dce0ff;
    font-size:10px;
    font-weight:800;
    cursor:pointer;
}
.categories-trigger .material-icons{font-size:16px}

.filters{
    display:flex;
    gap:8px;
    overflow-x:auto;
    padding:0 12px 6px;
    scrollbar-width:none;
    scroll-snap-type:x proximity;
    -webkit-overflow-scrolling:touch;
}
.filters::-webkit-scrollbar{display:none}
.filter-btn{
    flex:0 0 auto;
    min-height:39px;
    display:inline-flex;
    align-items:center;
    gap:5px;
    padding:0 13px;
    border-radius:13px;
    color:#526078;
    background:#f7f8fb;
    border:1px solid var(--line);
    font-size:11px;
    font-weight:750;
    cursor:pointer;
    scroll-snap-align:start;
    transition:.18s ease;
}
.filter-btn:active{transform:scale(.97)}
.filter-btn.active{
    color:#fff;
    background:linear-gradient(135deg,#6359f4,#477dff);
    border-color:#6673ee;
    box-shadow:0 6px 16px rgba(86,91,235,.20);
}

/* CATEGORY SHEET */
.categories-panel{
    position:fixed;
    inset:0;
    z-index:300;
    display:none;
}
.categories-panel.is-open{display:block}
.categories-backdrop{
    position:absolute;
    inset:0;
    background:rgba(22,29,43,.28);
    backdrop-filter:blur(4px);
}
.categories-sheet{
    position:absolute;
    left:10px;
    right:10px;
    bottom:10px;
    max-height:min(78vh,650px);
    overflow:auto;
    padding:18px 14px 16px;
    border:1px solid #dfe4ec;
    border-radius:24px;
    background:#fff;
    box-shadow:0 20px 50px rgba(28,39,64,.18);
    animation:sheetIn .22s ease both;
}
.categories-sheet-head{
    display:flex;
    align-items:flex-start;
    justify-content:space-between;
    gap:10px;
    padding:2px 2px 14px;
    border-bottom:1px solid var(--line-soft);
}
.categories-kicker{
    display:block;
    margin-bottom:2px;
    color:#6a73e9;
    font-size:9px;
    font-weight:850;
    letter-spacing:.4px;
}
.categories-sheet-head h3{font-size:20px;color:var(--text)}
.categories-sheet-head p{margin-top:4px;color:var(--muted);font-size:10px}
.categories-close{
    width:38px;height:38px;display:grid;place-items:center;
    border-radius:12px;color:#66748a;background:#f5f6f9;
    border:1px solid var(--line);cursor:pointer;
}
.categories-content{padding-top:12px}
.categories-content section+section{margin-top:18px}
.category-group-title{
    display:flex;align-items:center;gap:6px;
    margin-bottom:8px;color:#344159;font-size:12px;font-weight:850;
}
.category-group-title .material-icons{font-size:17px;color:#6672e9}
.category-items{
    display:grid;
    grid-template-columns:repeat(2,minmax(0,1fr));
    gap:7px;
}
.category-item{
    min-height:43px;
    display:flex;align-items:center;gap:8px;
    padding:0 10px;
    border-radius:12px;
    color:#536078;
    background:#f7f8fb;
    border:1px solid #e5e8ee;
    font-size:11px;
    font-weight:700;
    text-align:right;
    cursor:pointer;
    transition:.18s ease;
}
.category-item .material-icons{font-size:18px;color:#7887a3}
.category-item.active{
    color:#4f5ee2;
    background:#eef0ff;
    border-color:#cdd3ff;
}
.category-item.active .material-icons{color:#5968ef}

/* TOOLBAR */
.toolbar{
    display:flex;align-items:center;justify-content:space-between;
    gap:8px;padding:4px 12px 11px;
}
.toolbar-left,.toolbar-right{display:flex;align-items:center;gap:6px}
.toolbar-btn,.sort-select{
    height:35px;
    border:1px solid var(--line);
    border-radius:11px;
    color:#5c6980;
    background:#f7f8fb;
}
.toolbar-btn{
    width:35px;display:flex;align-items:center;justify-content:center;cursor:pointer;
}
.toolbar-btn.active{
    color:#5965df;
    background:var(--accent-soft);
    border-color:#cfd4ff;
}
.sort-select{
    max-width:160px;
    padding:0 9px;
    outline:0;
    font-size:10px;
}

/* GRID */
.wallpapers-grid{
    display:grid;
    grid-template-columns:repeat(3,minmax(0,1fr));
    gap:9px;
    padding:0 10px 25px;
    max-width:1180px;
    margin:0 auto;
}
.wallpaper-card{
    position:relative;
    min-width:0;
    overflow:hidden;
    aspect-ratio:4/5;
    border-radius:17px;
    background:#f1f3f6;
    border:1px solid #dde2ea;
    box-shadow:0 5px 15px rgba(28,39,64,.07);
    cursor:pointer;
    isolation:isolate;
    animation:cardIn .3s ease both;
    transition:transform .18s ease,border-color .18s ease,box-shadow .18s ease;
}
.wallpaper-card:hover{
    transform:translateY(-2px);
    border-color:#bdc7ed;
    box-shadow:0 9px 20px rgba(28,39,64,.10);
}
.wallpaper-card:active{transform:scale(.985)}
.wallpaper-card img{
    width:100%;height:100%;display:block;object-fit:cover;
    background:#edf0f4;
    transition:transform .35s ease;
}
.wallpaper-card:hover img{transform:scale(1.035)}
.wallpaper-card::after{
    content:"";position:absolute;inset:0;z-index:1;pointer-events:none;
    background:linear-gradient(180deg,rgba(0,0,0,.06) 0%,transparent 42%,rgba(0,0,0,.78) 100%);
}

/* CARD */
.quality-badge{
    position:absolute;top:7px;left:7px;z-index:4;
    min-width:38px;height:27px;padding:0 7px;
    display:flex;align-items:center;justify-content:center;
    border-radius:10px;color:#fff;background:rgba(25,36,57,.90);
    border:1px solid rgba(255,255,255,.20);
    font-size:10px;font-weight:850;
    backdrop-filter:blur(7px);
}
.card-favorite{
    position:absolute;top:7px;right:7px;z-index:5;
    width:34px;height:34px;
    display:flex;align-items:center;justify-content:center;
    border-radius:50%;color:#fff;
    background:rgba(25,36,57,.84);
    border:1px solid rgba(255,255,255,.18);
    cursor:pointer;backdrop-filter:blur(7px);
    transition:.18s ease;
}
.card-favorite:hover{transform:scale(1.06)}
.card-favorite.is-favorite{color:#ff5b83;background:rgba(72,23,49,.90)}
.card-favorite span{font-size:18px}
.wallpaper-overlay{
    position:absolute;right:0;left:0;bottom:0;z-index:3;
    padding:34px 8px 8px;color:#fff;
}
.wallpaper-title{
    max-width:100%;margin-bottom:5px;
    color:#fff;font-size:10px;line-height:1.35;font-weight:800;
    white-space:nowrap;overflow:hidden;text-overflow:ellipsis;
}
.wallpaper-meta{
    display:flex;align-items:center;justify-content:space-between;
    gap:5px;color:#fff;font-size:8px;
}
.wallpaper-resolution{opacity:.86;white-space:nowrap}
.wallpaper-stats{display:flex;align-items:center;gap:6px}
.wallpaper-stat{display:flex;align-items:center;gap:2px;white-space:nowrap}
.wallpaper-stat .material-icons{font-size:11px}
.card-more{
    width:27px;height:27px;display:flex;align-items:center;justify-content:center;
    border-radius:50%;color:#eef2f8;background:rgba(20,29,47,.80);
    border:1px solid rgba(255,255,255,.18);
}

/* LOADING / EMPTY */
.loading{
    display:flex;flex-direction:column;align-items:center;justify-content:center;
    min-height:150px;gap:11px;color:var(--muted);
}
.loader{
    width:32px;height:32px;border-radius:50%;
    border:3px solid #e7eaf0;border-top-color:#6560f4;
    animation:loadingSpin .8s linear infinite;
}
.loading p{font-size:11px}
.empty-state{padding:65px 20px;text-align:center;color:var(--muted)}
.empty-state>span{display:block;margin-bottom:10px;color:#7b88a1;font-size:55px}
.empty-state h3{margin-bottom:6px;color:var(--text);font-size:16px}
.empty-state p{font-size:11px}

/* SCROLL TOP */
.scroll-top{
    position:fixed;right:15px;bottom:84px;z-index:85;
    width:43px;height:43px;display:none;align-items:center;justify-content:center;
    border-radius:50%;color:#fff;
    background:linear-gradient(135deg,#6359f4,#477dff);
    border:1px solid rgba(255,255,255,.4);
    box-shadow:0 9px 22px rgba(73,83,222,.24);
}

/* BOTTOM NAV */
.page-bottom-nav{
    position:fixed;left:10px;right:10px;bottom:9px;z-index:90;
    height:66px;display:grid;grid-template-columns:repeat(5,1fr);
    align-items:center;padding:5px;border-radius:21px;
    background:rgba(255,255,255,.98);
    border:1px solid #dfe4ec;
    box-shadow:0 8px 25px rgba(28,39,64,.10);
    backdrop-filter:blur(18px);
    -webkit-backdrop-filter:blur(18px);
}
.page-bottom-nav button{
    min-width:0;height:54px;display:flex;flex-direction:column;
    align-items:center;justify-content:center;gap:2px;border-radius:16px;
    color:#7a8699;background:transparent;cursor:pointer;
}
.page-bottom-nav button .material-icons{font-size:21px}
.page-bottom-nav button span:last-child{font-size:8px;font-weight:750}
.page-bottom-nav button.active{
    color:#fff;background:linear-gradient(145deg,#6d5cf5,#4c76ff);
    box-shadow:0 7px 17px rgba(82,78,255,.24);
}

/* COMPACT */
.wallpapers-grid.compact-grid .wallpaper-card{aspect-ratio:1/1}
.wallpapers-grid.compact-grid .wallpaper-overlay{padding-top:27px}
.wallpapers-grid.compact-grid .wallpaper-title{font-size:9px}

/* DESKTOP */
@media(min-width:600px){
    .header{padding-inline:22px}
    .search-section{padding-inline:22px}
    .filters-head{padding-inline:22px}
    .filters{padding-inline:22px}
    .toolbar{padding-inline:22px}
    .wallpapers-grid{gap:12px;padding-inline:22px}
    .page-bottom-nav{max-width:720px;left:50%;right:auto;transform:translateX(-50%);width:calc(100% - 32px)}
}
@media(min-width:900px){
    .header-actions .header-more{display:flex}
    .wallpapers-grid{grid-template-columns:repeat(4,minmax(0,1fr));gap:14px}
    .wallpaper-card{border-radius:19px}
    .categories-sheet{left:50%;right:auto;width:min(620px,calc(100% - 28px));transform:translateX(-50%)}
}
@media(max-width:380px){
    .header{grid-template-columns:42px 1fr 42px;padding-inline:10px}
    .back-btn,.search-btn{width:42px;height:42px}
    .search-section{padding-inline:10px}
    .filters-head{padding-inline:10px}
    .filters{padding-inline:10px}
    .wallpapers-grid{gap:7px;padding-inline:8px}
    .wallpaper-card{border-radius:14px}
    .quality-badge{top:6px;left:6px;height:25px;min-width:34px}
    .card-favorite{top:6px;right:6px;width:31px;height:31px}
    .wallpaper-overlay{padding:29px 7px 7px}
}

/* ANIMATION */
@keyframes loadingSpin{to{transform:rotate(360deg)}}
@keyframes cardIn{from{opacity:0;transform:translateY(8px)}to{opacity:1;transform:translateY(0)}}
@keyframes sheetIn{from{opacity:0;transform:translateY(18px)}to{opacity:1;transform:translateY(0)}}


/* Pixabay-backed "Other wallpapers" state */
.filter-btn[data-filter="other"]{white-space:nowrap}


/* WEATHER WALLPAPERS */
.weather-section{margin:8px 12px 14px;padding:14px 12px 11px;border:1px solid #e5e8f2;border-radius:19px;background:linear-gradient(145deg,#fbfcff,#f5f7ff);box-shadow:0 5px 16px rgba(40,52,92,.045)}
.weather-section-head{display:flex;align-items:center;justify-content:space-between;gap:10px;margin-bottom:12px}
.weather-heading{display:flex;align-items:center;gap:9px;min-width:0}
.weather-heading>.material-icons{width:39px;height:39px;display:grid;place-items:center;flex:0 0 39px;border-radius:13px;background:#e9edff;color:#5865e8;font-size:23px}
.weather-heading h3{font-size:13px;line-height:1.35;font-weight:850;color:#202b43}
.weather-heading p{margin-top:3px;font-size:10px;color:#78839a}
.weather-location-btn{min-height:34px;display:inline-flex;align-items:center;justify-content:center;gap:4px;padding:0 9px;border-radius:11px;white-space:nowrap;color:#4e5ed8;background:#eef0ff;border:1px solid #dce0ff;font-size:10px;font-weight:800;cursor:pointer}
.weather-location-btn .material-icons{font-size:15px}
.weather-location-btn:disabled{opacity:.6;cursor:wait}
.weather-options{display:flex;gap:7px;overflow-x:auto;padding:1px 0 5px;scrollbar-width:none;-webkit-overflow-scrolling:touch}
.weather-options::-webkit-scrollbar{display:none}
.weather-chip{flex:0 0 auto;min-width:62px;min-height:58px;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:5px;padding:6px 10px;border-radius:13px;background:#fff;border:1px solid #e3e7f0;color:#5c6880;font-size:10px;font-weight:750;cursor:pointer;transition:.18s ease}
.weather-chip>span:first-child{font-size:20px;line-height:1}
.weather-chip.active{color:#4e5cdb;background:#edf0ff;border-color:#cbd2ff;box-shadow:0 4px 10px rgba(85,95,220,.10)}
.weather-chip:active{transform:scale(.97)}
.weather-status{min-height:14px;margin-top:8px;color:#8791a5;font-size:10px;line-height:1.5}
@media(min-width:600px){.weather-section{margin-inline:22px;padding:15px 16px}.weather-options{gap:9px}}
@media(max-width:380px){.weather-section{margin-inline:10px;padding:12px 9px}.weather-location-btn{padding-inline:7px;font-size:9px}.weather-chip{min-width:57px}}


/* Weather system on/off control */
.weather-head-actions{display:flex;align-items:center;gap:7px;flex-wrap:wrap;justify-content:flex-end}
.weather-toggle{display:inline-flex;align-items:center;gap:5px;min-height:32px;padding:0 8px;border:1px solid #dfe4ef;border-radius:11px;background:#fff;color:#66728a;font-size:10px;font-weight:800;cursor:pointer;white-space:nowrap}
.weather-toggle input{position:absolute;opacity:0;width:1px;height:1px;pointer-events:none}
.weather-toggle-track{width:30px;height:17px;padding:2px;border-radius:99px;background:#cbd2df;transition:background .2s;direction:ltr}
.weather-toggle-track>span{display:block;width:13px;height:13px;border-radius:50%;background:#fff;box-shadow:0 1px 3px #0002;transition:transform .2s}
.weather-toggle input:checked+.weather-toggle-track{background:#5a63f2}
.weather-toggle input:checked+.weather-toggle-track>span{transform:translateX(13px)}
.weather-toggle input:focus-visible+.weather-toggle-track{outline:3px solid #aab2ff;outline-offset:2px}
.weather-section.weather-disabled .weather-options,.weather-section.weather-disabled .weather-location-btn{opacity:.42;pointer-events:none}
.weather-section.weather-disabled .weather-status{color:#9aa2b2}
@media(max-width:430px){.weather-section-head{align-items:flex-start}.weather-head-actions{flex-direction:column-reverse;align-items:flex-end;gap:5px}.weather-heading>.material-icons{width:34px;height:34px;flex-basis:34px}}
