/* ═══════════════════════════════════════════════════
   ASTORBOX WALLPAPER HUB — Frontend Styles v2
   ═══════════════════════════════════════════════════ */

/* Reset */
html, body { margin: 0; padding: 0; min-height: 100vh; background: #e9e9eb; }

.astorbox-app {
    --ab-bg: #ffffff;
    --ab-bg-alt: #fafafa;
    --ab-border: #e5e5e5;
    --ab-border-hover: #a3a3a3;
    --ab-text: #171717;
    --ab-text-secondary: #525252;
    --ab-text-muted: #a3a3a3;
    --ab-text-faint: #d4d4d4;
    --ab-dark: #171717;
    --ab-dark-hover: #404040;
    --ab-radius: 6px;
    --ab-radius-lg: 12px;
    --ab-transition: all 0.2s ease;
    --ab-font: -apple-system, BlinkMacSystemFont, 'Inter', 'Segoe UI', Roboto, sans-serif;
    font-family: var(--ab-font);
    background: #e9e9eb;
    color: var(--ab-text);
    min-height: 100vh;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    text-transform: uppercase;
    box-sizing: border-box;
    padding: 16px;
    width: 100%;
}

.astorbox-app *, .astorbox-app *::before, .astorbox-app *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ── HEADER ────────────────────────────────────────── */
.ab-header {
    display: flex; align-items: center; justify-content: space-between;
    gap: 16px; padding: 12px 16px;
    background: var(--ab-bg); border: 1px solid var(--ab-border);
    border-radius: var(--ab-radius-lg); margin-bottom: 10px; flex-wrap: wrap;
}
.ab-header-left { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.ab-logo-text { font-size: 18px; font-weight: 800; letter-spacing: 0.1em; color: var(--ab-text); }
.ab-tagline { font-size: 11px; color: var(--ab-text-muted); letter-spacing: 0.03em; text-transform: none; }
.ab-header-right { display: flex; align-items: center; gap: 6px; }

/* ── LANG SWITCH (micro) ───────────────────────────── */
.ab-lang { display: flex; border: 1px solid var(--ab-border); border-radius: 4px; overflow: hidden; font-size: 9px; font-weight: 700; letter-spacing: 0.04em; line-height: 1; }
.ab-lang button { padding: 4px 6px; background: var(--ab-bg); color: var(--ab-text-muted); border: none; cursor: pointer; transition: var(--ab-transition); font-family: var(--ab-font); text-transform: uppercase; }
.ab-lang button.active { background: var(--ab-dark); color: #fff; }
.ab-lang button:hover:not(.active) { background: var(--ab-bg-alt); }

/* ── BUTTONS ───────────────────────────────────────── */
.ab-btn { padding: 6px 12px; border-radius: var(--ab-radius); font-size: 10px; font-weight: 600; letter-spacing: 0.05em; cursor: pointer; transition: var(--ab-transition); font-family: var(--ab-font); text-transform: uppercase; border: 1px solid; }
.ab-btn-dark { background: var(--ab-dark); color: #fff; border-color: var(--ab-dark); }
.ab-btn-dark:hover { background: var(--ab-dark-hover); }
.ab-btn-outline { background: var(--ab-bg); color: var(--ab-text); border-color: var(--ab-border); }
.ab-btn-outline:hover { border-color: var(--ab-border-hover); }

/* ── USER BADGE ────────────────────────────────────── */
.ab-user-badge { display: flex; align-items: center; gap: 6px; padding: 4px 10px; background: var(--ab-bg-alt); border: 1px solid var(--ab-border); border-radius: var(--ab-radius); font-size: 10px; font-weight: 600; }
.ab-user-avatar { width: 20px; height: 20px; border-radius: 50%; background: var(--ab-dark); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 9px; font-weight: 700; }

/* ── PREMIUM BANNER ────────────────────────────────── */
.ab-premium-banner { display: flex; align-items: center; gap: 10px; padding: 8px 14px; background: linear-gradient(90deg, #171717 0%, #404040 100%); border: 1px solid var(--ab-border); border-radius: var(--ab-radius); margin-bottom: 10px; overflow: hidden; }
.ab-premium-scroll { flex: 1; overflow: hidden; }
.ab-premium-track { display: flex; gap: 40px; animation: ab-scroll 20s linear infinite; white-space: nowrap; }
@keyframes ab-scroll { 0% { transform: translateX(0); } 100% { transform: translateX(-50%); } }
.ab-premium-text { font-size: 10px; color: #fff; letter-spacing: 0.05em; font-weight: 500; }
.ab-premium-cta { padding: 5px 12px; background: #fff; color: var(--ab-dark); border: none; border-radius: var(--ab-radius); font-size: 9px; font-weight: 700; letter-spacing: 0.05em; cursor: pointer; transition: var(--ab-transition); font-family: var(--ab-font); text-transform: uppercase; white-space: nowrap; }
.ab-premium-cta:hover { background: #f0f0f0; }

/* ── FEATURED ROW ──────────────────────────────────── */
.ab-featured { display: flex; gap: 10px; margin-bottom: 10px; }
.ab-featured-card { flex: 1; background: var(--ab-bg); border: 1px solid var(--ab-border); border-radius: var(--ab-radius-lg); padding: 14px; display: flex; align-items: center; gap: 14px; cursor: pointer; transition: var(--ab-transition); position: relative; overflow: hidden; }
.ab-featured-card:hover { box-shadow: 0 8px 24px rgba(0,0,0,0.08); }

/* Popular card */
.ab-featured-popular { background: linear-gradient(135deg, #fafafa, #f5f5f5); }
.ab-featured-popular .ab-featured-icon { width: 48px; height: 48px; border-radius: 10px; background: var(--ab-dark); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.ab-featured-popular .ab-featured-icon svg { width: 22px; height: 22px; color: #fff; }
.ab-featured-popular .ab-featured-info h3 { font-size: 12px; font-weight: 700; letter-spacing: 0.06em; color: var(--ab-text); margin-bottom: 2px; }
.ab-featured-popular .ab-featured-info p { font-size: 10px; color: var(--ab-text-muted); text-transform: none; letter-spacing: 0.02em; }
.ab-featured-popular .ab-featured-count { position: absolute; top: 10px; right: 12px; font-size: 9px; color: var(--ab-text-muted); font-weight: 600; }

/* Week Box Reveal */
.ab-featured-week { background: linear-gradient(135deg, #171717 0%, #2d2d2d 40%, #404040 100%); border-color: #333; }
.ab-featured-week::before { content: ''; position: absolute; inset: 0; background: linear-gradient(135deg, transparent 30%, rgba(245,158,11,0.08) 60%, rgba(239,68,68,0.06) 100%); pointer-events: none; }
.ab-featured-week .ab-featured-icon { width: 52px; height: 52px; border-radius: 12px; background: linear-gradient(135deg, #f59e0b, #ef4444); display: flex; align-items: center; justify-content: center; flex-shrink: 0; animation: ab-glow 2s ease-in-out infinite alternate; position: relative; z-index: 1; }
@keyframes ab-glow { 0% { box-shadow: 0 0 8px rgba(245,158,11,0.3); } 100% { box-shadow: 0 0 20px rgba(245,158,11,0.5); } }
.ab-featured-week .ab-featured-icon svg { width: 24px; height: 24px; color: #fff; }
.ab-featured-week .ab-featured-info { position: relative; z-index: 1; }
.ab-featured-week .ab-featured-info h3 { font-size: 13px; font-weight: 800; letter-spacing: 0.08em; color: #fff; margin-bottom: 3px; }
.ab-featured-week .ab-featured-info p { font-size: 10px; color: rgba(255,255,255,0.6); text-transform: none; letter-spacing: 0.02em; }
.ab-week-badge { position: absolute; top: 10px; right: 12px; padding: 3px 8px; background: linear-gradient(90deg, #f59e0b, #ef4444); border-radius: 3px; font-size: 8px; font-weight: 700; color: #fff; letter-spacing: 0.06em; z-index: 1; }
.ab-week-cta { margin-left: auto; padding: 8px 16px; background: #fff; color: var(--ab-dark); border: none; border-radius: var(--ab-radius); font-size: 10px; font-weight: 700; letter-spacing: 0.05em; cursor: pointer; transition: var(--ab-transition); font-family: var(--ab-font); text-transform: uppercase; white-space: nowrap; position: relative; z-index: 1; }
.ab-week-cta:hover { background: #f5f5f5; transform: scale(1.02); }

/* ── FILTERS ───────────────────────────────────────── */
.ab-filters-section { background: var(--ab-bg-alt); border: 1px solid var(--ab-border); border-radius: var(--ab-radius-lg); padding: 8px; margin-bottom: 10px; }
.ab-filters-header { display: flex; align-items: center; justify-content: space-between; padding: 4px 6px 8px; }
.ab-filters-title { font-size: 10px; font-weight: 700; letter-spacing: 0.1em; color: var(--ab-text); }
.ab-filters-count { padding: 2px 6px; background: var(--ab-bg); border: 1px solid var(--ab-border); border-radius: 3px; font-size: 9px; color: var(--ab-text-muted); }
.ab-filters-inner { background: var(--ab-bg); border: 1px solid var(--ab-border); border-radius: var(--ab-radius); padding: 12px; }
.ab-filter-row { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 8px; }
.ab-filter-row:last-child { margin-bottom: 0; }
.ab-filter-label { font-size: 9px; font-weight: 600; color: var(--ab-text-muted); letter-spacing: 0.08em; margin-bottom: 4px; display: block; width: 100%; }
.ab-pill { padding: 5px 10px; background: var(--ab-bg); border: 1px solid var(--ab-border); border-radius: var(--ab-radius); color: var(--ab-text-secondary); font-size: 10px; font-weight: 500; letter-spacing: 0.04em; cursor: pointer; transition: var(--ab-transition); font-family: var(--ab-font); text-transform: uppercase; white-space: nowrap; }
.ab-pill:hover { border-color: var(--ab-border-hover); }
.ab-pill:active { transform: scale(0.95); }
.ab-pill.active { background: var(--ab-dark); color: #fff; border-color: var(--ab-dark); }

/* ── GRID ──────────────────────────────────────────── */
.ab-grid { display: grid; grid-template-columns: 1fr; gap: 10px; }
@media (min-width: 540px) { .ab-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1100px) { .ab-grid { grid-template-columns: repeat(3, 1fr); } }

/* ── CARD ──────────────────────────────────────────── */
.ab-card { background: var(--ab-bg); border: 1px solid var(--ab-border); border-radius: var(--ab-radius); padding: 5px; transition: box-shadow 0.3s ease; animation: ab-card-in 0.4s ease both; }
@keyframes ab-card-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
.ab-card:hover { box-shadow: 0 20px 25px -5px rgba(0,0,0,0.05), 0 8px 10px -6px rgba(0,0,0,0.03); }

/* Desktop = landscape 16:9 */
.ab-card[data-device="desktop"] .ab-card-img { aspect-ratio: 16 / 9; }
/* Mobile = portrait 9:16 */
.ab-card[data-device="mobile"] .ab-card-img { aspect-ratio: 9 / 16; }

.ab-card-img { position: relative; overflow: hidden; border-radius: 4px; }
.ab-card-img-bg { position: absolute; inset: 0; transition: transform 0.7s ease-out; width: 100%; height: 100%; object-fit: cover; }
.ab-card:hover .ab-card-img-bg { transform: scale(1.1); }
.ab-card-scan { position: absolute; inset: 0; background: linear-gradient(transparent 95%, rgba(255,255,255,0.07) 95%); background-size: 100% 6px; opacity: 0.6; pointer-events: none; }
.ab-card-badges { position: absolute; top: 5px; right: 5px; display: flex; gap: 3px; z-index: 2; }
.ab-badge { padding: 2px 5px; border-radius: 3px; font-size: 8px; font-weight: 600; letter-spacing: 0.03em; border: 1px solid; }
.ab-badge-rec { background: var(--ab-dark); color: #fff; border-color: var(--ab-dark); }
.ab-badge-res { background: rgba(255,255,255,0.95); color: var(--ab-text-secondary); border-color: var(--ab-border); display: flex; align-items: center; gap: 2px; }
.ab-badge-res svg { width: 9px; height: 9px; }
.ab-card-body { padding: 5px 5px 3px; padding-top: 8px; }
.ab-card-title { font-size: 11px; font-weight: 700; letter-spacing: 0.04em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ab-card-sub { font-size: 9px; letter-spacing: 0.08em; color: var(--ab-text-muted); margin-top: 2px; }
.ab-card-actions { display: flex; gap: 5px; margin-top: 10px; }
.ab-like-btn { display: flex; align-items: center; gap: 5px; padding: 5px 8px; background: var(--ab-bg); border: 1px solid var(--ab-border); border-radius: var(--ab-radius); color: var(--ab-text-secondary); font-size: 10px; font-weight: 500; cursor: pointer; transition: var(--ab-transition); font-family: var(--ab-font); text-transform: uppercase; }
.ab-like-btn:hover { border-color: var(--ab-border-hover); }
.ab-like-btn:active { transform: scale(0.9); }
.ab-like-btn.is-liked { color: #ef4444; border-color: #fca5a5; background: #fef2f2; }
.ab-like-btn svg { width: 12px; height: 12px; }
.ab-dl-btn { display: flex; flex: 1; align-items: center; justify-content: center; gap: 5px; padding: 5px 8px; background: var(--ab-dark); border: 1px solid var(--ab-dark); border-radius: var(--ab-radius); color: #fff; font-size: 10px; font-weight: 500; letter-spacing: 0.03em; cursor: pointer; transition: var(--ab-transition); font-family: var(--ab-font); text-transform: uppercase; }
.ab-dl-btn:hover { background: var(--ab-dark-hover); border-color: var(--ab-dark-hover); }
.ab-dl-btn:active { transform: scale(0.95); }
.ab-dl-btn svg { width: 12px; height: 12px; }
.ab-empty { grid-column: 1 / -1; text-align: center; padding: 40px 20px; color: var(--ab-text-muted); font-size: 11px; letter-spacing: 0.05em; }

/* ── MODAL ─────────────────────────────────────────── */
.ab-modal { display: none; position: fixed; inset: 0; z-index: 99999; align-items: center; justify-content: center; }
.ab-modal.is-open { display: flex; animation: ab-modal-in 0.2s ease; }
@keyframes ab-modal-in { from { opacity: 0; } to { opacity: 1; } }
.ab-modal-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,0.5); }
.ab-modal-content { position: relative; background: var(--ab-bg); border: 1px solid var(--ab-border); border-radius: var(--ab-radius-lg); padding: 28px; max-width: 400px; width: 90%; text-align: center; animation: ab-modal-content-in 0.3s ease; box-shadow: 0 25px 50px -12px rgba(0,0,0,0.25); text-transform: none; }
@keyframes ab-modal-content-in { from { opacity: 0; transform: scale(0.95) translateY(8px); } to { opacity: 1; transform: scale(1) translateY(0); } }
.ab-modal-close { position: absolute; top: 10px; right: 14px; background: none; border: none; color: var(--ab-text-muted); font-size: 22px; cursor: pointer; transition: var(--ab-transition); line-height: 1; }
.ab-modal-close:hover { color: var(--ab-text); }
.ab-modal-title { font-size: 15px; font-weight: 700; letter-spacing: 0.05em; margin-bottom: 6px; text-transform: uppercase; }
.ab-modal-desc { font-size: 12px; color: var(--ab-text-secondary); margin-bottom: 16px; text-transform: none; }

/* ── AUTH MODAL ────────────────────────────────────── */
.ab-auth-modal { max-width: 340px; }
.ab-auth-tabs { display: flex; gap: 3px; margin-bottom: 16px; border-bottom: 1px solid var(--ab-border); }
.ab-auth-tab { flex: 1; padding: 8px; background: none; border: none; border-bottom: 2px solid transparent; color: var(--ab-text-muted); font-size: 11px; font-weight: 600; letter-spacing: 0.05em; cursor: pointer; transition: var(--ab-transition); font-family: var(--ab-font); text-transform: uppercase; }
.ab-auth-tab.active { color: var(--ab-text); border-bottom-color: var(--ab-dark); }
.ab-auth-form { display: flex; flex-direction: column; gap: 8px; }
.ab-auth-form input { padding: 9px 12px; background: var(--ab-bg); border: 1px solid var(--ab-border); border-radius: var(--ab-radius); color: var(--ab-text); font-size: 12px; font-family: var(--ab-font); outline: none; transition: var(--ab-transition); text-transform: none; }
.ab-auth-form input:focus { border-color: var(--ab-dark); }
.ab-auth-submit { padding: 9px; background: var(--ab-dark); border: none; border-radius: var(--ab-radius); color: #fff; font-size: 11px; font-weight: 600; letter-spacing: 0.05em; cursor: pointer; transition: var(--ab-transition); font-family: var(--ab-font); text-transform: uppercase; }
.ab-auth-submit:hover { background: var(--ab-dark-hover); }
.ab-auth-msg { font-size: 11px; color: var(--ab-text-muted); text-align: center; min-height: 16px; }
.ab-auth-msg.error { color: #ef4444; }
.ab-auth-msg.success { color: #10b981; }

/* ── PREMIUM MODAL ─────────────────────────────────── */
.ab-premium-modal { max-width: 400px; }
.ab-premium-icon { font-size: 42px; color: #f59e0b; margin-bottom: 10px; }
.ab-premium-price { font-size: 26px; font-weight: 700; margin-bottom: 14px; }
.ab-premium-features { list-style: none; margin-bottom: 16px; text-align: left; }
.ab-premium-features li { padding: 7px 0; font-size: 12px; color: var(--ab-text-secondary); border-bottom: 1px solid var(--ab-border); text-transform: none; }
.ab-premium-features li:last-child { border-bottom: none; }
.ab-premium-subscribe { width: 100%; padding: 11px; background: linear-gradient(90deg, #f59e0b 0%, #ef4444 100%); border: none; border-radius: var(--ab-radius); color: #fff; font-size: 12px; font-weight: 700; letter-spacing: 0.05em; cursor: pointer; transition: var(--ab-transition); font-family: var(--ab-font); text-transform: uppercase; }
.ab-premium-subscribe:hover { opacity: 0.9; }

/* ── EMAIL MODAL ───────────────────────────────────── */
.ab-email-form { display: flex; flex-direction: column; gap: 8px; }
.ab-email-input { padding: 9px 12px; background: var(--ab-bg); border: 1px solid var(--ab-border); border-radius: var(--ab-radius); color: var(--ab-text); font-size: 12px; font-family: var(--ab-font); outline: none; transition: var(--ab-transition); text-transform: none; }
.ab-email-input:focus { border-color: var(--ab-dark); }
.ab-email-submit { padding: 9px; background: var(--ab-dark); border: none; border-radius: var(--ab-radius); color: #fff; font-size: 11px; font-weight: 600; letter-spacing: 0.05em; cursor: pointer; transition: var(--ab-transition); font-family: var(--ab-font); text-transform: uppercase; }
.ab-email-submit:hover { background: var(--ab-dark-hover); }

/* ── WEEK BOX MODAL ────────────────────────────────── */
.ab-week-modal-content { max-width: 420px; overflow: hidden; padding: 0; }
.ab-week-reveal { background: linear-gradient(135deg, #171717, #2d2d2d); padding: 32px; text-align: center; position: relative; }
.ab-week-reveal::before { content: ''; position: absolute; inset: 0; background: radial-gradient(circle at 50% 30%, rgba(245,158,11,0.12), transparent 70%); pointer-events: none; }
.ab-week-reveal-icon { font-size: 56px; margin-bottom: 12px; animation: ab-float 3s ease-in-out infinite; position: relative; z-index: 1; }
@keyframes ab-float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
.ab-week-reveal h2 { font-size: 16px; font-weight: 800; letter-spacing: 0.08em; color: #fff; margin-bottom: 6px; position: relative; z-index: 1; }
.ab-week-reveal p { font-size: 11px; color: rgba(255,255,255,0.5); text-transform: none; margin-bottom: 20px; position: relative; z-index: 1; }
.ab-week-wallpaper { width: 100%; aspect-ratio: 16/9; border-radius: 8px; overflow: hidden; margin-bottom: 16px; position: relative; z-index: 1; }
.ab-week-wallpaper-bg { width: 100%; height: 100%; object-fit: cover; }
.ab-week-info { display: flex; align-items: center; justify-content: space-between; padding: 0 4px; margin-bottom: 16px; position: relative; z-index: 1; }
.ab-week-info-title { font-size: 13px; font-weight: 700; color: #fff; letter-spacing: 0.04em; }
.ab-week-info-res { font-size: 10px; color: rgba(255,255,255,0.5); }
.ab-week-download { width: 100%; padding: 12px; background: linear-gradient(90deg, #f59e0b, #ef4444); border: none; border-radius: var(--ab-radius); color: #fff; font-size: 12px; font-weight: 700; letter-spacing: 0.06em; cursor: pointer; transition: var(--ab-transition); font-family: var(--ab-font); text-transform: uppercase; position: relative; z-index: 1; }
.ab-week-download:hover { opacity: 0.9; transform: scale(1.01); }
.ab-week-close { position: absolute; top: 10px; right: 14px; background: none; border: none; color: rgba(255,255,255,0.4); font-size: 22px; cursor: pointer; z-index: 2; line-height: 1; }
.ab-week-close:hover { color: #fff; }

/* ── RESPONSIVE ────────────────────────────────────── */
@media (max-width: 768px) {
    .astorbox-app { padding: 0; }
    .ab-header { border-radius: 0; border-left: none; border-right: none; border-top: none; margin-bottom: 6px; padding: 10px 12px; }
    .ab-premium-banner { border-radius: 0; border-left: none; border-right: none; margin-left: 0; margin-right: 0; }
    .ab-featured { flex-direction: column; }
    .ab-filters-section { padding: 6px; }
    .ab-filters-inner { padding: 10px; }
    .ab-filter-row { overflow-x: auto; flex-wrap: nowrap; -webkit-overflow-scrolling: touch; padding-bottom: 3px; }
}

/* ── SCROLLBAR ─────────────────────────────────────── */
.astorbox-app ::-webkit-scrollbar { width: 5px; height: 5px; }
.astorbox-app ::-webkit-scrollbar-track { background: var(--ab-bg-alt); }
.astorbox-app ::-webkit-scrollbar-thumb { background: var(--ab-text-faint); border-radius: 3px; }

/* ── CARD STAGGER ──────────────────────────────────── */
.ab-card:nth-child(1) { animation-delay: 0.02s; }
.ab-card:nth-child(2) { animation-delay: 0.04s; }
.ab-card:nth-child(3) { animation-delay: 0.06s; }
.ab-card:nth-child(4) { animation-delay: 0.08s; }
.ab-card:nth-child(5) { animation-delay: 0.10s; }
.ab-card:nth-child(6) { animation-delay: 0.12s; }
.ab-card:nth-child(7) { animation-delay: 0.14s; }
.ab-card:nth-child(8) { animation-delay: 0.16s; }
.ab-card:nth-child(9) { animation-delay: 0.18s; }
.ab-card:nth-child(10) { animation-delay: 0.20s; }
.ab-card:nth-child(11) { animation-delay: 0.22s; }
.ab-card:nth-child(12) { animation-delay: 0.24s; }
