/* WebberSites Store — base styles.
   Dark App-Store flavor, with launchpad's .lp-* grid carried over for
   the PWA launcher view. */

:root {
    --bg:        #0b0b10;
    --surface:   #14141b;
    --surface-2: #1c1c25;
    --border:    rgba(255,255,255,.08);
    --text:      #ededf2;
    --muted:     #9a9aa8;
    --accent:    #6366f1;
    --accent-2:  #8b5cf6;
    --danger:    #ef4444;
    --radius:    14px;
    --radius-lg: 22px;
    --shadow:    0 10px 30px rgba(0,0,0,.4);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body.store {
    font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
    background: radial-gradient(1200px 600px at 20% -10%, #1d1733 0%, transparent 60%),
                radial-gradient(900px 500px at 110% 20%, #0a2438 0%, transparent 60%),
                var(--bg);
    color: var(--text);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
code { background: var(--surface-2); padding: 1px 6px; border-radius: 4px; font-size: .9em; }

/* ---------- Topbar ---------- */
.topbar {
    display: flex; align-items: center; gap: 24px;
    padding: 14px 24px;
    backdrop-filter: blur(20px);
    background: rgba(11,11,16,.6);
    border-bottom: 1px solid var(--border);
    position: sticky; top: 0; z-index: 50;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 600; }
.brand-mark {
    width: 28px; height: 28px; border-radius: 8px;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    display: grid; place-items: center; color: #fff; font-weight: 800;
    box-shadow: 0 4px 12px rgba(99,102,241,.4);
}
.topnav { display: flex; gap: 18px; margin-left: 12px; }
.topnav a { color: var(--muted); font-weight: 500; }
.topnav a:hover { color: var(--text); }
.topbar-search {
    flex: 1; max-width: 360px; margin-left: auto;
    display: flex; align-items: center; gap: 8px;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: 999px; padding: 6px 14px;
}
.topbar-search i { color: var(--muted); font-size: .8rem; }
.topbar-search input {
    flex: 1; background: transparent; border: none; outline: none;
    color: var(--text); font: inherit; padding: 4px 0;
}
.topbar-actions { display: flex; align-items: center; gap: 12px; }
.search-form { display: flex; gap: 10px; max-width: 600px; margin: 16px 0 24px; }
.search-form input {
    flex: 1; padding: 10px 14px; border-radius: 999px;
    background: var(--surface); border: 1px solid var(--border);
    color: var(--text); font: inherit;
}
.card-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
    gap: 14px; margin-top: 14px;
}
.who { color: var(--muted); font-size: .85rem; }

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center;
    gap: 8px; padding: 8px 16px; border-radius: 999px; border: 1px solid transparent;
    font: inherit; font-weight: 600; cursor: pointer;
    transition: transform .1s ease, background .15s ease, border-color .15s ease;
    text-decoration: none;
}
.btn-primary {
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    color: #fff; box-shadow: 0 4px 14px rgba(99,102,241,.35);
}
.btn-primary:hover { transform: translateY(-1px); }
.btn-ghost { background: transparent; color: var(--muted); border-color: var(--border); }
.btn-ghost:hover { color: var(--text); border-color: rgba(255,255,255,.18); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-lg { padding: 12px 28px; font-size: 1.05rem; }

/* ---------- Main + sections ---------- */
.main { max-width: 1240px; margin: 0 auto; padding: 28px 24px 80px; }
.footer { padding: 24px; text-align: center; color: var(--muted); }
.flash {
    padding: 10px 14px; border-radius: var(--radius); margin-bottom: 16px;
    background: var(--surface); border: 1px solid var(--border);
}
.flash-error  { border-color: rgba(239,68,68,.35); }
.flash-ok     { border-color: rgba(34,197,94,.35); }

.muted { color: var(--muted); }
.kicker { color: var(--muted); text-transform: uppercase; letter-spacing: .08em; font-size: .7rem; font-weight: 700; }

/* ---------- Hero ---------- */
.hero-cta {
    padding: 60px 24px; text-align: center;
    background: linear-gradient(135deg, rgba(99,102,241,.18), rgba(139,92,246,.12));
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    margin-bottom: 36px;
}
.hero-cta h1 { font-size: 2.4rem; margin: 0 0 12px; letter-spacing: -.02em; }
.hero-cta p  { color: var(--muted); margin: 0 0 24px; }

/* ---------- Rails ---------- */
.rail { margin-bottom: 36px; }
.rail-head { display: flex; align-items: baseline; justify-content: space-between; padding: 0 4px 12px; }
.rail-head h2 { font-size: 1.25rem; margin: 0; letter-spacing: -.01em; }
.rail-more { color: var(--accent); font-size: .9rem; font-weight: 600; }
.rail-track {
    display: grid; grid-auto-flow: column; grid-auto-columns: 230px;
    gap: 16px; overflow-x: auto; scroll-snap-type: x mandatory;
    padding: 4px 4px 16px;
    scrollbar-width: thin;
}
.rail-track-large { grid-auto-columns: minmax(360px, 1fr); }

/* ---------- Cards ---------- */
.card {
    display: flex; flex-direction: column; gap: 10px;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 14px;
    scroll-snap-align: start;
    transition: transform .15s ease, border-color .15s ease;
}
.card:hover { transform: translateY(-2px); border-color: rgba(255,255,255,.18); }
.card-icon {
    width: 56px; height: 56px; border-radius: 14px;
    display: grid; place-items: center; color: #fff; font-size: 1.4rem; font-weight: 700;
    overflow: hidden; box-shadow: inset 0 1px 0 rgba(255,255,255,.18), 0 4px 12px rgba(0,0,0,.3);
}
.card-icon img { width: 100%; height: 100%; object-fit: cover; }
.card-meta { display: flex; flex-direction: column; gap: 2px; }
.card-meta strong { font-size: .98rem; }
.card-price { color: var(--muted); font-size: .82rem; }

.card-feature {
    flex-direction: row; align-items: stretch; gap: 18px;
    padding: 22px; min-height: 220px; overflow: hidden;
    background:
        linear-gradient(135deg, rgba(0,0,0,.55), rgba(0,0,0,.15)),
        linear-gradient(135deg, var(--card-bg, var(--accent)), color-mix(in oklab, var(--card-bg, var(--accent)) 60%, black));
    border-color: transparent;
    color: #fff;
}
.card-feature h3 { margin: 4px 0 6px; font-size: 1.6rem; letter-spacing: -.01em; }
.card-feature p { margin: 0; opacity: .85; }
.card-feature-meta { display: flex; flex-direction: column; justify-content: flex-end; flex: 1; }
.card-feature-icon {
    width: 100px; height: 100px; border-radius: 22px;
    background: rgba(0,0,0,.25);
    display: grid; place-items: center; align-self: center;
    font-size: 2.4rem; box-shadow: inset 0 1px 0 rgba(255,255,255,.18);
}
.card-feature-icon img { width: 100%; height: 100%; object-fit: cover; border-radius: 22px; }

/* ---------- App detail ---------- */
.app-hero {
    display: flex; gap: 24px; align-items: center;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius-lg); padding: 28px;
    margin-bottom: 24px;
}
.app-hero-icon {
    width: 128px; height: 128px; border-radius: 28px;
    display: grid; place-items: center; color: #fff;
    font-size: 3rem; font-weight: 800; flex-shrink: 0;
    box-shadow: inset 0 1px 0 rgba(255,255,255,.18), 0 10px 30px rgba(0,0,0,.4);
    overflow: hidden;
}
.app-hero-icon img { width: 100%; height: 100%; object-fit: cover; }
.app-hero-meta h1 { margin: 8px 0; font-size: 2rem; letter-spacing: -.02em; }
.app-hero-meta .tagline { color: var(--muted); margin: 0 0 18px; }

.screenshots { margin-bottom: 24px; }
.screenshot-track {
    display: grid; grid-auto-flow: column; grid-auto-columns: 320px;
    gap: 12px; overflow-x: auto; padding-bottom: 8px;
    scroll-snap-type: x mandatory;
}
.screenshot-track img {
    border-radius: 12px; border: 1px solid var(--border);
    scroll-snap-align: start;
}

.app-desc {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 24px;
}

/* ---------- Empty / library ---------- */
.empty {
    text-align: center; padding: 80px 24px;
    background: var(--surface); border: 1px dashed var(--border); border-radius: var(--radius-lg);
}

/* ---------- Admin ---------- */
.admin-page { max-width: 1100px; margin: 0 auto; }
.admin-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.admin-head h1 { margin: 0; }
.admin-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; margin-top: 16px; }
.admin-card {
    display: block; padding: 22px; background: var(--surface);
    border: 1px solid var(--border); border-radius: var(--radius);
    transition: border-color .15s ease;
}
.admin-card:hover { border-color: rgba(255,255,255,.18); }
.admin-card h3 { margin: 0 0 6px; }
.admin-card p { margin: 0; color: var(--muted); font-size: .9rem; }

.admin-table {
    width: 100%; border-collapse: collapse; background: var(--surface);
    border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden;
}
.admin-table th, .admin-table td {
    text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--border);
    font-size: .9rem; vertical-align: middle;
}
.admin-table th { background: var(--surface-2); color: var(--muted); font-weight: 600; }
.admin-table tr:last-child td { border-bottom: none; }
.row-actions { white-space: nowrap; text-align: right; }
.btn-sm { padding: 5px 10px; font-size: .8rem; }
.admin-icon { width: 36px; height: 36px; border-radius: 9px; font-size: .9rem; }

.pill {
    display: inline-block; padding: 2px 8px; border-radius: 999px;
    font-size: .7rem; font-weight: 600;
    background: var(--surface-2); color: var(--muted);
    border: 1px solid var(--border);
}
.pill-ok      { color: #4ade80; border-color: rgba(74,222,128,.3); }
.pill-feature { color: #fbbf24; border-color: rgba(251,191,36,.3); }

.admin-form { display: flex; flex-direction: column; gap: 14px; }
.admin-form label {
    display: flex; flex-direction: column; gap: 4px;
    font-size: .85rem; color: var(--muted); font-weight: 500;
}
.admin-form input[type=text],
.admin-form input[type=url],
.admin-form input[type=number],
.admin-form input[type=file],
.admin-form select,
.admin-form textarea {
    background: var(--surface); border: 1px solid var(--border);
    color: var(--text); padding: 9px 11px; border-radius: 10px; font: inherit;
}
.admin-form input[type=color] { width: 56px; height: 36px; border: 1px solid var(--border); border-radius: 8px; padding: 0; background: transparent; }
.admin-form input:focus, .admin-form select:focus, .admin-form textarea:focus {
    outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(99,102,241,.18);
}
.admin-form .form-row { display: flex; gap: 14px; align-items: flex-end; }
.admin-form .form-row > label { flex: 1; }
.admin-form .checkbox-row { gap: 18px; align-items: center; }
.admin-form .check { flex-direction: row; align-items: center; gap: 8px; color: var(--text); }
.admin-form .check input { accent-color: var(--accent); }
.form-fieldset {
    border: 1px solid var(--border); border-radius: var(--radius);
    padding: 14px 16px; margin: 0;
}
.form-fieldset legend { padding: 0 8px; color: var(--muted); font-size: .8rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }
.form-actions { display: flex; gap: 10px; padding-top: 8px; }

.admin-screenshots { margin-top: 32px; }
.shot-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; margin-bottom: 14px; }
.shot-tile { position: relative; }
.shot-tile img { width: 100%; aspect-ratio: 16/10; object-fit: cover; border-radius: 10px; border: 1px solid var(--border); }
.shot-del {
    position: absolute; top: 6px; right: 6px;
    background: rgba(0,0,0,.7); color: #fff; border: none;
    width: 24px; height: 24px; border-radius: 50%; cursor: pointer;
}
.shot-add-form { display: flex; gap: 10px; align-items: center; }

/* ===========================================================
   LAUNCHER — ported from launchpad's .lp-* (iOS-style grid).
   Kept identical class names so the launchpad CSS reads 1:1.
   =========================================================== */
.launcher {
    background: rgba(0,0,0,.4);
    backdrop-filter: blur(30px);
    border-radius: var(--radius-lg);
    padding: 32px 16px 64px;
    border: 1px solid var(--border);
    min-height: 70vh;
}
.launcher-head { text-align: center; margin-bottom: 24px; }
.launcher-head h1 { margin: 0 0 6px; font-size: 1.8rem; letter-spacing: -.01em; }
.launcher-head p  { color: var(--muted); margin: 0; }
.launcher-empty { text-align: center; padding: 60px 16px; color: var(--muted); }

.lp-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
    gap: 28px 16px;
    padding: 12px 24px 32px;
    justify-items: center;
}
.lp-item {
    display: flex; flex-direction: column; align-items: center; gap: 8px;
    width: 88px; cursor: pointer; user-select: none;
    opacity: 0; transform: translateY(8px);
    animation: lpFade .35s ease forwards;
    animation-delay: calc(var(--i, 0) * 30ms);
}
@keyframes lpFade { to { opacity: 1; transform: translateY(0); } }

.lp-icon {
    width: 72px; height: 72px; border-radius: 18px;
    display: grid; place-items: center;
    color: #fff; font-size: 1.8rem; font-weight: 800;
    overflow: hidden; position: relative;
    box-shadow: 0 6px 16px rgba(0,0,0,.45), inset 0 1px 0 rgba(255,255,255,.18);
    transition: transform .15s ease;
}
/* iOS-style top gloss */
.lp-icon::after {
    content: ''; position: absolute; inset: 0 0 50% 0; border-radius: 18px 18px 50% 50% / 18px 18px 30% 30%;
    background: linear-gradient(180deg, rgba(255,255,255,.22), rgba(255,255,255,0));
    pointer-events: none;
}
.lp-icon img { width: 100%; height: 100%; object-fit: cover; }
.lp-icon .fa-icon { color: #fff; }
.lp-icon .lp-initials { font-size: 1.5rem; }
.lp-item:hover .lp-icon { transform: scale(1.06); }

.lp-label {
    color: rgba(255,255,255,.92); font-size: .78rem; font-weight: 500;
    max-width: 88px;
    text-align: center; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    text-shadow: 0 1px 4px rgba(0,0,0,.5);
}

/* ---------- Responsive ---------- */
@media (max-width: 768px) {
    .topbar { padding: 12px 16px; gap: 10px; flex-wrap: wrap; }
    .brand-name { display: none; }
    .topnav { gap: 10px; order: 3; flex-basis: 100%; }
    .topbar-search { max-width: none; flex: 1; }
    .main { padding: 18px 14px 60px; }
    .hero-cta h1 { font-size: 1.7rem; }
    .app-hero { flex-direction: column; align-items: flex-start; padding: 20px; }
    .app-hero-icon { width: 96px; height: 96px; border-radius: 22px; font-size: 2.2rem; }
    .lp-grid { gap: 22px 12px; padding: 8px 8px 24px; }
    .lp-icon { width: 60px; height: 60px; border-radius: 15px; }
    .lp-icon .fa-icon { font-size: 1.4rem; }
    .lp-label { max-width: 76px; }
    .lp-item { width: 76px; }
}
