:root {
    --navy: #0D223A;
    --green: #728ADF;
    --green-dark: #5A6EC8;
    --bg: #F6F8F6;
    --text: #1A1A1A;
    --muted: #666666;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    color: var(--text);
    background: var(--bg);
    line-height: 1.6;
}

a { color: var(--green-dark); text-decoration: none; }
a:hover { text-decoration: underline; }

.brand-header {
    background: #fff;
    border-bottom: 1px solid #eee;
    padding: 12px 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}
.brand-header img { height: 32px; width: auto; }
.brand-header .brand-name { font-weight: 700; font-size: 20px; color: var(--navy); }

.container { max-width: 760px; margin: 0 auto; padding: 24px 20px 48px; }

.hero { text-align: center; padding: 48px 20px; }
.hero h1 { color: var(--navy); font-size: 34px; margin: 0 0 12px; }
.hero .tagline { color: var(--muted); font-size: 18px; }
.hero .badge { display: inline-block; background: var(--green); color: #fff; border-radius: 999px; padding: 4px 14px; font-size: 13px; font-weight: 600; margin-bottom: 16px; }
.hero-lead { color: var(--muted); max-width: 520px; margin: 8px auto 24px; }

.btn {
    display: inline-block;
    background: var(--green);
    color: #fff;
    border-radius: 999px;
    padding: 12px 28px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    text-decoration: none;
}
.btn:hover { background: var(--green-dark); text-decoration: none; color: #fff; }

.section { background: #fff; border-radius: 12px; padding: 24px; margin-bottom: 16px; }
.section h2 { color: var(--navy); margin-top: 0; }

.legal h1 { color: var(--navy); }
.legal h2 { color: var(--navy); margin-top: 28px; }
.legal .placeholder { color: #b00020; font-weight: 700; }
.legal .pending { background: #fff3cd; border: 1px solid #ffe08a; border-radius: 8px; padding: 16px; color: #856404; }

.footer { text-align: center; padding: 24px; color: var(--muted); font-size: 14px; }
.footer a { margin: 0 8px; }

.product-card { background: #fff; border-radius: 12px; overflow: hidden; max-width: 420px; margin: 24px auto; }
.product-card img { width: 100%; height: auto; display: block; }
.product-card .body { padding: 16px; }
.product-card h1 { color: var(--navy); font-size: 20px; margin: 0 0 8px; }
.product-card .price { color: var(--green-dark); font-weight: 700; font-size: 22px; margin-bottom: 16px; }

.error { text-align: center; padding: 48px 20px; }
.error h1 { color: var(--navy); }

/* ------------------------------------------------------------------ */
/* Responsive enhancements (additive, mobile-first).                  */
/* Nothing below 768px changes: all base rules above stay untouched.  */
/* ------------------------------------------------------------------ */

/* Tablet: widen the main column so it doesn't look cramped. */
@media (min-width: 768px) {
    .container { max-width: 820px; }
}

/* Desktop: widen further and turn the product card into two columns. */
@media (min-width: 1024px) {
    .container { max-width: 1040px; }

    .hero-lead { max-width: 640px; }

    /* Image on the left (~560px), details on the right. */
    .product-card {
        max-width: 920px;
        display: grid;
        grid-template-columns: 560px 1fr;
        align-items: start;
    }
    /* Base .product-card img (width:100%; height:auto) already fits the
       560px column at natural aspect ratio — no override needed. */
    .product-card .body { padding: 32px; }
}

/* ------------------------------------------------------------------ */
/* Product page /p/{id} (Fase 1). Mobile-first single column; all new  */
/* classes, no base rule above is modified.                           */
/* ------------------------------------------------------------------ */

.product-gallery { margin-bottom: 20px; }
.product-cover { width: 100%; height: auto; display: block; border-radius: 12px; background: #fff; }
.product-thumbs { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.product-thumbs img { width: 64px; height: 64px; object-fit: cover; border-radius: 8px; border: 1px solid #eee; }

.product-panel { background: #fff; border-radius: 12px; padding: 20px; }
.product-panel h1 { color: var(--navy); font-size: 22px; margin: 0 0 8px; }
.product-price { color: var(--green-dark); font-weight: 700; font-size: 26px; margin-bottom: 4px; }
.product-submeta { color: var(--muted); font-size: 14px; margin-bottom: 16px; }

.product-details { list-style: none; padding: 0; margin: 0 0 16px; border-top: 1px solid #eee; }
.product-details li { display: flex; justify-content: space-between; gap: 16px; padding: 10px 0; border-bottom: 1px solid #eee; }
.product-details .label { color: var(--muted); }
.product-details .value { color: var(--text); font-weight: 600; text-align: right; }

.product-description { white-space: pre-wrap; margin: 0 0 4px; }

.seller { display: flex; align-items: center; gap: 12px; padding: 16px 0; margin-top: 16px; border-top: 1px solid #eee; }
.seller-avatar { width: 48px; height: 48px; border-radius: 50%; object-fit: cover; background: var(--bg); flex-shrink: 0; }
.seller-info { min-width: 0; }
.seller-name { font-weight: 700; color: var(--navy); display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.seller-verified { display: inline-block; background: var(--green); color: #fff; border-radius: 999px; padding: 2px 10px; font-size: 12px; font-weight: 600; }
.seller-rating { color: var(--muted); font-size: 14px; }
.seller-new { color: var(--muted); font-size: 13px; }

.trust-note { background: var(--bg); border-radius: 10px; padding: 12px 16px; color: var(--muted); font-size: 14px; margin: 0 0 16px; }

.product-actions { display: flex; flex-direction: column; gap: 10px; }
.product-actions .btn { width: 100%; text-align: center; }
.btn-secondary { background: #fff; color: var(--green-dark); border: 1px solid var(--green); }
.btn-secondary:hover { background: var(--bg); color: var(--green-dark); }

/* Desktop: image left, purchase panel right. */
@media (min-width: 1024px) {
    .container.product-page { max-width: 1100px; }
    .product { display: grid; grid-template-columns: minmax(0, 1fr) 400px; gap: 32px; align-items: start; }
    .product-gallery { margin-bottom: 0; }
}

/* ------------------------------------------------------------------ */
/* Landing + search (Fase 2). All additive, mobile-first.             */
/* ------------------------------------------------------------------ */

.container.feed-page { max-width: 1120px; }

/* Top bar: search + download */
.topbar { background: #fff; border-bottom: 1px solid #eee; }
.topbar-inner { display: flex; align-items: center; gap: 12px; padding-top: 12px; padding-bottom: 12px; flex-wrap: wrap; }
.searchbar { display: flex; flex: 1 1 260px; gap: 8px; min-width: 0; }
.searchbar input { flex: 1 1 auto; min-width: 0; padding: 10px 14px; border: 1px solid #ddd; border-radius: 999px; font-size: 15px; }
.searchbar .btn { flex-shrink: 0; }
.btn-sm { padding: 8px 16px; font-size: 14px; }

/* Category strip */
.cat-strip { background: #fff; border-bottom: 1px solid #eee; }
.cat-chips { display: flex; gap: 8px; overflow-x: auto; padding: 10px 0; }
.cat-chips a { flex-shrink: 0; background: var(--bg); color: var(--navy); border-radius: 999px; padding: 6px 14px; font-size: 14px; font-weight: 600; white-space: nowrap; }
.cat-chips a:hover { background: #e9edf7; text-decoration: none; }
.cat-chips a.is-active { background: var(--green); color: #fff; }

/* Hero */
.landing-hero { padding: 40px 0; text-align: center; }
.landing-hero h1 { color: var(--navy); font-size: 30px; margin: 12px 0; }
.landing-hero-lead { color: var(--muted); font-size: 17px; max-width: 620px; margin: 0 auto 20px; }
.landing-hero-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.trust-chips { list-style: none; display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 20px; padding: 0; margin: 24px 0 0; color: var(--muted); font-size: 14px; }
.trust-chips li { position: relative; padding-left: 22px; }
.trust-chips li::before { content: "✓"; position: absolute; left: 0; color: var(--green-dark); font-weight: 700; }

/* Feed + card grid */
.feed { padding: 16px 0 32px; }
.feed h2, .how h2, .download-band h2 { color: var(--navy); }
.feed-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 16px; }

.pcard { display: block; background: #fff; border-radius: 12px; overflow: hidden; color: var(--text); border: 1px solid #eee; }
.pcard:hover { text-decoration: none; box-shadow: 0 4px 16px rgba(13, 34, 58, 0.08); }
.pcard-media { aspect-ratio: 1 / 1; background: var(--bg); }
.pcard-media img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pcard-noimg { width: 100%; height: 100%; background: var(--bg); }
.pcard-body { padding: 10px 12px 14px; }
.pcard-price { color: var(--navy); font-weight: 700; font-size: 18px; }
.pcard-title { color: var(--text); font-size: 14px; margin: 2px 0 6px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.pcard-meta { display: flex; flex-wrap: wrap; gap: 4px 8px; color: var(--muted); font-size: 12px; }
.pcard-cond { font-weight: 600; }

/* How it works */
.how { padding: 24px 0; }
.how-grid { display: grid; grid-template-columns: 1fr; gap: 16px; }
.how-step { background: #fff; border-radius: 12px; padding: 20px; }
.how-num { width: 32px; height: 32px; border-radius: 50%; background: var(--green); color: #fff; font-weight: 700; display: flex; align-items: center; justify-content: center; margin-bottom: 10px; }
.how-step h3 { color: var(--navy); margin: 0 0 6px; }
.how-step p { margin: 0; color: var(--muted); }

/* Download band */
.download-band { padding: 24px 0 8px; text-align: center; }
.download-actions { display: flex; gap: 12px; justify-content: center; align-items: center; flex-wrap: wrap; margin-top: 8px; }
.download-soon { color: var(--muted); font-size: 14px; }

/* Search results */
.search-context { color: var(--navy); font-size: 22px; margin: 20px 0 16px; }
.pagination { display: flex; justify-content: space-between; gap: 12px; margin: 24px 0; }

/* Empty state */
.empty-state { text-align: center; padding: 48px 20px; }
.empty-icon { font-size: 44px; margin-bottom: 8px; }
.empty-state h2 { color: var(--navy); margin: 0 0 8px; }
.empty-state p { color: var(--muted); margin: 0 auto 16px; max-width: 420px; }
.empty-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; margin-bottom: 24px; }
.empty-cats-label { color: var(--muted); font-size: 14px; }
.empty-state .cat-chips { justify-content: center; flex-wrap: wrap; overflow: visible; }

@media (min-width: 640px) {
    .how-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (min-width: 768px) {
    .feed-grid { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
    .landing-hero h1 { font-size: 40px; }
}

/* ── Tienda pública del vendedor (/u/{id}) ─────────────────────────────────── */
.container.store-page { max-width: 1120px; }

.store-cover {
    height: 160px; border-radius: 16px; background-size: cover; background-position: center;
    background-color: #e7ebf2;
}
.store-cover-empty { background: linear-gradient(120deg, #e7ebf2, #d7ddeb); }

/* Sin fila flex compartida: el avatar va solo y el texto en un bloque aparte,
   en flujo normal debajo. Así es físicamente imposible que el texto toque la
   portada: siempre queda sobre fondo claro y legible. */
.store-identity { padding: 0 4px; }
/* Solo el avatar asoma sobre la portada, con su propio margen negativo. */
.store-avatar {
    display: block;
    width: 92px; height: 92px; border-radius: 50%; border: 4px solid #fff; object-fit: cover;
    background: #fff; box-shadow: 0 2px 8px rgba(0,0,0,.12);
    margin-top: -54px;
}
.store-avatar-empty { background: #cfd6e4; }
/* Bloque de texto: flujo normal bajo el avatar, sin desplazamiento. */
.store-identity-text { margin-top: 10px; min-width: 0; }
.store-name { color: var(--navy); font-size: 22px; margin: 0; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.store-sub { color: var(--muted); font-size: 14px; margin-top: 4px; }
.store-bio { color: var(--text); margin: 10px 0 0; max-width: 640px; line-height: 1.5; }

.store-section { margin-top: 36px; }
.store-section h2 { color: var(--navy); margin: 0 0 16px; font-size: 20px; }
.store-empty { color: var(--muted); }

.store-reviews { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; }
.store-review { background: #fff; border: 1px solid #eee; border-radius: 12px; padding: 14px 16px; }
.store-review-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.store-review-alias { font-weight: 600; color: var(--text); }
.store-review-stars { color: #F0A020; letter-spacing: 1px; font-size: 14px; flex-shrink: 0; }
.store-review-comment { margin: 8px 0 0; color: var(--text); line-height: 1.45; }
.store-review-date { margin-top: 6px; color: var(--muted); font-size: 13px; }
.store-reviews-more { display: inline-block; margin-top: 16px; }

@media (min-width: 600px) {
    .store-cover { height: 220px; }
    .store-avatar { width: 112px; height: 112px; margin-top: -64px; }
    .store-name { font-size: 26px; }
    .store-reviews { grid-template-columns: 1fr 1fr; }
}
