/* =====================================================
   Pasar UMKM Seluma — Style Publik
   Tone biru Pemkab Seluma, mobile-first
   ===================================================== */

:root {
    --blue-900: #0c2d5e;
    --blue-700: #1352a3;
    --blue-500: #2273dd;
    --blue-100: #e3eefb;
    --gold-500: #f0a821;
    --red-600:  #d63333;
    --green-600:#1f9d55;
    --text-900: #16202e;
    --text-600: #5a6b80;
    --bg:       #f6f9fd;
    --white:    #ffffff;
    --radius:   0.625rem;
    --shadow:   0 1px 4px rgba(12,45,94,.08);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
    background: var(--bg);
    color: var(--text-900);
    line-height: 1.6;
    padding-bottom: 64px; /* ruang bottom-nav mobile */
}

img { max-width: 100%; display: block; }
a { color: var(--blue-700); text-decoration: none; }
a:hover { color: var(--blue-500); }

.container { max-width: 1140px; margin: 0 auto; padding: 0 1rem; }

/* ---------- Tombol ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
    padding: .55rem 1.1rem; border-radius: var(--radius);
    border: 1px solid transparent; cursor: pointer;
    font-size: .925rem; font-weight: 600; line-height: 1.3;
    transition: background .15s, color .15s, border-color .15s;
    text-align: center;
}
.btn-primary { background: var(--blue-700); color: var(--white); }
.btn-primary:hover { background: var(--blue-500); color: var(--white); }
.btn-primary:disabled { background: #9db5d4; cursor: not-allowed; }
.btn-outline { background: var(--white); color: var(--blue-700); border-color: var(--blue-700); }
.btn-outline:hover { background: var(--blue-100); }
.btn-outline-light { background: transparent; color: var(--white); border-color: rgba(255,255,255,.7); }
.btn-outline-light:hover { background: rgba(255,255,255,.12); color: var(--white); }
.btn-gold { background: var(--gold-500); color: var(--blue-900); }
.btn-gold:hover { background: #ffbe3d; color: var(--blue-900); }
.btn-danger { background: var(--red-600); color: var(--white); }
.btn-danger:hover { background: #b82a2a; color: var(--white); }
.btn-wa { background: #25d366; color: #fff; }
.btn-wa:hover { background: #1ebe5b; color: #fff; }
.btn-wa::before { content: "💬"; }
.btn-sm { padding: .35rem .7rem; font-size: .825rem; }
.btn-lg { padding: .75rem 1.5rem; font-size: 1rem; }
.btn-block { display: flex; width: 100%; }

/* ---------- Header ---------- */
.site-header {
    position: sticky; top: 0; z-index: 50;
    background: var(--white);
    border-bottom: 1px solid var(--blue-100);
    box-shadow: var(--shadow);
}
.header-inner {
    display: flex; align-items: center; gap: 1rem;
    padding-top: .6rem; padding-bottom: .6rem;
}
.brand { display: flex; align-items: center; gap: .6rem; min-width: 0; }
.brand-logo { width: 40px; height: 40px; flex-shrink: 0; }
.brand-text { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.brand-text strong { color: var(--blue-900); font-size: 1rem; white-space: nowrap; }
.brand-text small { color: var(--text-600); font-size: .7rem; white-space: nowrap; }

.header-search { flex: 1; display: flex; max-width: 480px; }
.header-search input {
    flex: 1; padding: .55rem .9rem;
    border: 1px solid #cfdef2; border-right: 0;
    border-radius: var(--radius) 0 0 var(--radius);
    font-size: .925rem; outline: none; min-width: 0;
}
.header-search input:focus { border-color: var(--blue-500); }
.header-search button {
    padding: 0 .9rem; border: none; cursor: pointer;
    background: var(--blue-700); color: var(--white);
    border-radius: 0 var(--radius) var(--radius) 0;
}

.header-actions { display: flex; align-items: center; gap: .6rem; margin-left: auto; }
.cart-button { position: relative; font-size: 1.3rem; padding: .25rem; }
.cart-badge {
    position: absolute; top: -4px; right: -8px;
    min-width: 18px; height: 18px; padding: 0 4px;
    background: var(--red-600); color: var(--white);
    font-size: .68rem; font-weight: 700; line-height: 18px;
    text-align: center; border-radius: 9px;
}

/* ---------- Alert ---------- */
.alert { padding: .8rem 1rem; border-radius: var(--radius); margin: .8rem 0; font-size: .925rem; }
.alert-success { background: #e3f6ea; color: #14532d; border: 1px solid #b5e3c5; }
.alert-error { background: #fdecec; color: #7f1d1d; border: 1px solid #f5c2c2; }
.alert-warning { background: #fef6e0; color: #713f12; border: 1px solid #f3dfa5; }
.alert-info { background: var(--blue-100); color: var(--blue-900); border: 1px solid #c2d9f5; }

/* ---------- Hero ---------- */
.hero { padding: 1rem 0 0; }
.hero-default {
    background: linear-gradient(120deg, var(--blue-900), var(--blue-700) 60%, var(--blue-500));
    color: var(--white);
    border-radius: var(--radius);
    padding: 2.5rem 1.5rem;
    text-align: center;
}
.hero-default h1 { font-size: clamp(1.5rem, 4vw, 2.4rem); margin-bottom: .6rem; }
.hero-default p { max-width: 620px; margin: 0 auto 1.3rem; opacity: .92; }
.hero-cta { display: flex; gap: .8rem; justify-content: center; flex-wrap: wrap; }

.hero-carousel { position: relative; border-radius: var(--radius); overflow: hidden; }
.hero-slide { display: none; }
.hero-slide.active { display: block; }
.hero-slide img { width: 100%; aspect-ratio: 3 / 1; object-fit: cover; }
.hero-dots {
    position: absolute; bottom: .7rem; left: 0; right: 0;
    display: flex; gap: .4rem; justify-content: center;
}
.hero-dot {
    width: 10px; height: 10px; border-radius: 50%;
    border: none; cursor: pointer; background: rgba(255,255,255,.55);
}
.hero-dot.active { background: var(--white); }

/* ---------- Section ---------- */
.section { padding: 2.2rem 0; }
.section-alt { background: var(--blue-100); }
.section-head {
    display: flex; align-items: baseline; justify-content: space-between;
    gap: 1rem; margin-bottom: 1.2rem;
}
.section-head h2 { color: var(--blue-900); font-size: 1.35rem; }
.section-link { font-weight: 600; font-size: .9rem; white-space: nowrap; }

/* ---------- Kategori ---------- */
.category-grid {
    display: grid; gap: .8rem;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
}
.category-card {
    background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow);
    padding: 1rem .6rem; text-align: center;
    display: flex; flex-direction: column; align-items: center; gap: .2rem;
    transition: transform .15s, box-shadow .15s;
}
.category-card:hover { transform: translateY(-3px); box-shadow: 0 6px 16px rgba(12,45,94,.14); }
.category-icon { font-size: 1.8rem; }
.category-name { font-weight: 600; color: var(--text-900); font-size: .9rem; }
.category-card small { color: var(--text-600); font-size: .75rem; }

/* ---------- Kartu Produk ---------- */
.product-grid {
    display: grid; gap: .9rem;
    grid-template-columns: repeat(2, 1fr);
}
@media (min-width: 640px) { .product-grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 960px) { .product-grid { grid-template-columns: repeat(4, 1fr); } }

.product-card {
    background: var(--white); border-radius: var(--radius);
    box-shadow: var(--shadow); overflow: hidden;
    display: flex; flex-direction: column;
    transition: transform .15s, box-shadow .15s;
}
.product-card:hover { transform: translateY(-3px); box-shadow: 0 8px 20px rgba(12,45,94,.14); }
.product-card-media { position: relative; display: block; }
.product-card-media img { width: 100%; aspect-ratio: 1 / 1; object-fit: cover; background: var(--blue-100); }
.product-card-body { padding: .7rem .8rem .9rem; display: flex; flex-direction: column; gap: .35rem; flex: 1; }
.product-card-name {
    color: var(--text-900); font-weight: 600; font-size: .9rem; line-height: 1.35;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
    min-height: 2.4em;
}
.product-card-price { color: var(--blue-700); font-weight: 700; font-size: 1.05rem; }
.product-card-price small { color: var(--text-600); font-weight: 400; font-size: .75rem; }
.product-card-store { color: var(--text-600); font-size: .76rem; margin-bottom: .35rem; }
.product-card .btn { margin-top: auto; }

.badge {
    display: inline-block; padding: .15rem .55rem; border-radius: 999px;
    font-size: .72rem; font-weight: 700;
}
.badge-stock { position: absolute; top: .5rem; left: .5rem; background: var(--red-600); color: #fff; }
.badge-category { background: var(--blue-100); color: var(--blue-700); }
.badge-verified { background: var(--green-600); color: #fff; font-size: .65rem; vertical-align: middle; }
.badge-success { background: #e3f6ea; color: #14532d; }
.badge-warning { background: #fef6e0; color: #92600a; }
.badge-danger { background: #fdecec; color: var(--red-600); }
.badge-muted { background: #eceff3; color: var(--text-600); }

/* ---------- Toko ---------- */
.store-grid {
    display: grid; gap: .8rem;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
}
.store-card {
    display: flex; align-items: center; gap: .8rem;
    background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow);
    padding: .8rem 1rem; color: var(--text-900);
    transition: transform .15s;
}
.store-card:hover { transform: translateY(-2px); color: var(--blue-700); }
.store-card-logo, .store-box-logo {
    width: 48px; height: 48px; border-radius: 50%;
    object-fit: cover; background: var(--blue-100); flex-shrink: 0;
}
.store-card small { display: block; color: var(--text-600); font-size: .78rem; }

/* ---------- CTA banner ---------- */
.cta-banner {
    background: linear-gradient(120deg, var(--blue-900), var(--blue-700));
    color: var(--white); padding: 2.2rem 0; margin-top: 1rem;
}
.cta-inner { display: flex; align-items: center; justify-content: space-between; gap: 1.5rem; flex-wrap: wrap; }
.cta-inner h2 { font-size: 1.4rem; margin-bottom: .3rem; }
.cta-inner p { opacity: .92; }

/* ---------- Halaman umum ---------- */
.page { padding: 1.5rem 0 2.5rem; }
.page-head { margin-bottom: 1.3rem; }
.page-head h1 { color: var(--blue-900); font-size: 1.5rem; }
.page-head p { color: var(--text-600); font-size: .925rem; }

.breadcrumb { font-size: .82rem; color: var(--text-600); margin-bottom: 1rem; }
.breadcrumb span { color: var(--text-900); }

/* ---------- Katalog ---------- */
.catalog-layout { display: grid; gap: 1.2rem; grid-template-columns: 1fr; }
@media (min-width: 880px) { .catalog-layout { grid-template-columns: 250px 1fr; align-items: start; } }

.catalog-filter {
    background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow);
    padding: 1.1rem;
}
.filter-group { margin-bottom: .9rem; }
.filter-group label { display: block; font-weight: 600; font-size: .85rem; margin-bottom: .3rem; color: var(--blue-900); }
.filter-group select, .filter-group input {
    width: 100%; padding: .5rem .7rem;
    border: 1px solid #cfdef2; border-radius: calc(var(--radius) - 2px);
    font-size: .9rem; background: var(--white);
}
.filter-price { display: flex; gap: .5rem; }
.filter-form .btn + .btn { margin-top: .5rem; }

.pagination { display: flex; gap: .35rem; justify-content: center; margin-top: 1.5rem; flex-wrap: wrap; }
.page-link {
    min-width: 36px; height: 36px; line-height: 34px; text-align: center;
    background: var(--white); border: 1px solid #cfdef2; border-radius: calc(var(--radius) - 2px);
    font-size: .9rem; font-weight: 600;
}
.page-link.active { background: var(--blue-700); color: var(--white); border-color: var(--blue-700); }
.page-dots { line-height: 36px; color: var(--text-600); }

/* ---------- Detail produk ---------- */
.product-detail { display: grid; gap: 1.5rem; grid-template-columns: 1fr; }
@media (min-width: 820px) { .product-detail { grid-template-columns: minmax(0, 440px) 1fr; } }

.gallery-main img {
    width: 100%; aspect-ratio: 1 / 1; object-fit: cover;
    border-radius: var(--radius); background: var(--blue-100);
}
.gallery-thumbs { display: flex; gap: .5rem; margin-top: .6rem; flex-wrap: wrap; }
.gallery-thumb {
    width: 64px; height: 64px; padding: 0; border-radius: calc(var(--radius) - 3px);
    overflow: hidden; border: 2px solid transparent; cursor: pointer; background: none;
}
.gallery-thumb img { width: 100%; height: 100%; object-fit: cover; }
.gallery-thumb.active { border-color: var(--blue-700); }

.product-info h1 { color: var(--blue-900); font-size: 1.45rem; margin: .4rem 0 .5rem; }
.product-price { color: var(--blue-700); font-size: 1.7rem; font-weight: 800; }
.product-price small { color: var(--text-600); font-size: .95rem; font-weight: 400; }
.product-meta { display: flex; gap: 1.2rem; color: var(--text-600); font-size: .875rem; margin: .6rem 0 1.1rem; flex-wrap: wrap; }

.product-actions { display: flex; gap: .7rem; flex-wrap: wrap; align-items: center; margin-bottom: 1.2rem; }
.qty-control { display: inline-flex; border: 1px solid #cfdef2; border-radius: var(--radius); overflow: hidden; }
.qty-control button {
    width: 40px; border: none; background: var(--blue-100); color: var(--blue-900);
    font-size: 1.1rem; cursor: pointer; font-weight: 700;
}
.qty-control input {
    width: 56px; border: none; text-align: center; font-size: 1rem; font-weight: 600;
    -moz-appearance: textfield;
}
.qty-control input::-webkit-inner-spin-button { -webkit-appearance: none; }

.store-box {
    display: flex; align-items: center; gap: .8rem;
    background: var(--blue-100); border-radius: var(--radius);
    padding: .8rem 1rem; margin-bottom: 1.2rem; flex-wrap: wrap;
}
.store-box-info { flex: 1; min-width: 160px; display: flex; flex-direction: column; }
.store-box-info small { color: var(--text-600); font-size: .8rem; }

.product-description h3 { color: var(--blue-900); font-size: 1.05rem; margin-bottom: .4rem; }
.product-description p { color: var(--text-900); font-size: .94rem; }

/* ---------- Halaman toko ---------- */
.store-hero { background: linear-gradient(120deg, var(--blue-900), var(--blue-700)); color: var(--white); padding: 1.8rem 0; }
.store-hero-inner { display: flex; align-items: center; gap: 1.2rem; flex-wrap: wrap; }
.store-hero-logo {
    width: 84px; height: 84px; border-radius: 50%; object-fit: cover;
    border: 3px solid rgba(255,255,255,.5); background: var(--blue-100);
}
.store-hero-info { flex: 1; min-width: 220px; }
.store-hero-info h1 { font-size: 1.4rem; }
.store-hero-meta { opacity: .9; font-size: .9rem; }
.store-hero-desc { opacity: .85; font-size: .875rem; margin-top: .4rem; max-width: 640px; }

/* ---------- Keranjang ---------- */
.cart-layout { display: grid; gap: 1.2rem; grid-template-columns: 1fr; }
@media (min-width: 920px) { .cart-layout { grid-template-columns: 1fr 360px; align-items: start; } }

.cart-store-group {
    background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow);
    padding: 1rem 1.1rem; margin-bottom: 1rem;
}
.cart-store-head {
    display: flex; justify-content: space-between; align-items: center;
    border-bottom: 1px solid var(--blue-100); padding-bottom: .6rem; margin-bottom: .6rem;
}
.cart-store-head strong { color: var(--blue-900); }
.cart-store-subtotal { font-size: .875rem; color: var(--text-600); }
.cart-store-subtotal b { color: var(--blue-700); }

.cart-item { display: flex; gap: .8rem; align-items: center; padding: .6rem 0; border-bottom: 1px dashed #e4ecf6; }
.cart-item:last-child { border-bottom: none; }
.cart-item img { width: 64px; height: 64px; object-fit: cover; border-radius: calc(var(--radius) - 3px); background: var(--blue-100); }
.cart-item-info { flex: 1; min-width: 0; }
.cart-item-info a { font-weight: 600; font-size: .9rem; color: var(--text-900); }
.cart-item-info small { display: block; color: var(--text-600); font-size: .78rem; }
.cart-item-total { font-weight: 700; color: var(--blue-700); font-size: .9rem; white-space: nowrap; }
.cart-item-remove {
    border: none; background: none; color: var(--red-600);
    font-size: 1.1rem; cursor: pointer; padding: .3rem;
}
.cart-item .qty-control { transform: scale(.85); transform-origin: left center; }

.cart-checkout {
    background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow);
    padding: 1.2rem;
}
.cart-checkout h3 { color: var(--blue-900); margin-bottom: .3rem; }
.cart-checkout-hint { color: var(--text-600); font-size: .825rem; margin-bottom: 1rem; }
.cart-total {
    display: flex; justify-content: space-between; align-items: center;
    padding: .8rem 0; margin: .6rem 0;
    border-top: 2px solid var(--blue-100);
    font-size: 1rem;
}
.cart-total strong { color: var(--blue-700); font-size: 1.25rem; }
#checkoutButtons .btn { margin-bottom: .5rem; }
.cart-checkout-note { font-size: .76rem; color: var(--text-600); }

/* ---------- Form ---------- */
.form-group { margin-bottom: .9rem; }
.form-group label { display: block; font-weight: 600; font-size: .875rem; margin-bottom: .3rem; color: var(--blue-900); }
.form-group label small { color: var(--text-600); font-weight: 400; }
.form-group input, .form-group select, .form-group textarea {
    width: 100%; padding: .6rem .8rem;
    border: 1px solid #cfdef2; border-radius: calc(var(--radius) - 2px);
    font-size: .925rem; font-family: inherit; background: var(--white);
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
    outline: none; border-color: var(--blue-500); box-shadow: 0 0 0 3px rgba(34,115,221,.12);
}
.form-row { display: grid; gap: 0 1rem; grid-template-columns: 1fr; }
@media (min-width: 640px) { .form-row { grid-template-columns: 1fr 1fr; } .form-row-3 { grid-template-columns: 1fr 1fr 1fr; } }
.form-section-title {
    color: var(--blue-900); font-size: 1rem;
    border-bottom: 2px solid var(--blue-100);
    padding-bottom: .35rem; margin: 1.2rem 0 .9rem;
}
.checkbox-label { display: flex !important; align-items: center; gap: .45rem; font-weight: 600; cursor: pointer; }
.checkbox-label input { width: auto !important; }

/* ---------- Auth ---------- */
.auth-body {
    background: linear-gradient(160deg, var(--blue-900), var(--blue-700) 70%, var(--blue-500));
    min-height: 100vh; padding: 2rem 1rem 3rem;
}
.auth-wrapper { max-width: 720px; margin: 0 auto; }
.auth-brand { justify-content: center; margin-bottom: 1.4rem; }
.auth-brand .brand-text strong { color: var(--white); }
.auth-brand .brand-text small { color: rgba(255,255,255,.75); }
.auth-card {
    background: var(--white); border-radius: var(--radius);
    box-shadow: 0 10px 30px rgba(0,0,0,.18);
    padding: 1.8rem; max-width: 420px; margin: 0 auto;
}
.auth-card-wide { max-width: 720px; }
.auth-card h1 { color: var(--blue-900); font-size: 1.35rem; margin-bottom: .2rem; }
.auth-subtitle { color: var(--text-600); font-size: .875rem; margin-bottom: 1.2rem; }
.auth-switch { text-align: center; margin-top: 1rem; font-size: .875rem; }
.auth-footer-link { text-align: center; margin-top: 1.2rem; }
.auth-footer-link a { color: rgba(255,255,255,.85); font-size: .875rem; }

/* ---------- Empty state ---------- */
.empty-state {
    text-align: center; padding: 3rem 1rem;
    background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow);
}
.empty-icon { font-size: 2.6rem; display: block; margin-bottom: .6rem; }
.empty-state h3 { color: var(--blue-900); margin-bottom: .3rem; }
.empty-state p { color: var(--text-600); margin-bottom: 1.1rem; }

/* ---------- Footer ---------- */
.site-footer { background: var(--blue-900); color: rgba(255,255,255,.85); margin-top: 2rem; }
.footer-grid {
    display: grid; gap: 1.6rem; padding: 2.2rem 1rem;
    grid-template-columns: 1fr;
}
@media (min-width: 720px) { .footer-grid { grid-template-columns: 2fr 1fr 1fr; } }
.brand-footer .brand-text strong { color: var(--white); }
.brand-footer .brand-text small { color: var(--gold-500); }
.footer-desc { font-size: .85rem; margin-top: .7rem; opacity: .8; max-width: 420px; }
.footer-hashtags { color: var(--gold-500); font-size: .85rem; font-weight: 600; margin-top: .5rem; }
.site-footer h4 { color: var(--white); font-size: .95rem; margin-bottom: .6rem; }
.footer-links { list-style: none; }
.footer-links li { margin-bottom: .4rem; }
.footer-links a { color: rgba(255,255,255,.8); font-size: .875rem; }
.footer-links a:hover { color: var(--gold-500); }
.footer-bottom {
    border-top: 1px solid rgba(255,255,255,.12);
    padding: .9rem 0; text-align: center; font-size: .78rem; opacity: .7;
}

/* ---------- Floating WA ---------- */
.wa-float {
    position: fixed; right: 1rem; bottom: 80px; z-index: 60;
    width: 52px; height: 52px; border-radius: 50%;
    background: #25d366; color: #fff;
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 4px 14px rgba(0,0,0,.25);
    transition: transform .15s;
}
.wa-float:hover { transform: scale(1.08); color: #fff; }

/* ---------- Bottom nav (mobile) ---------- */
.bottom-nav {
    position: fixed; bottom: 0; left: 0; right: 0; z-index: 55;
    display: flex; background: var(--white);
    border-top: 1px solid var(--blue-100);
    box-shadow: 0 -2px 8px rgba(12,45,94,.07);
}
.bottom-nav a {
    flex: 1; display: flex; flex-direction: column; align-items: center;
    padding: .45rem 0 .55rem; font-size: 1.05rem; color: var(--text-600);
    position: relative;
}
.bottom-nav a span { font-size: .66rem; font-weight: 600; }
.bottom-nav-cart .cart-badge { top: 2px; right: calc(50% - 22px); }

@media (min-width: 768px) {
    body { padding-bottom: 0; }
    .bottom-nav { display: none; }
    .wa-float { bottom: 1.2rem; }
}

/* ---------- Util ---------- */
.hide-mobile { display: none; }
@media (min-width: 640px) { .hide-mobile { display: inline-flex; } }
.text-muted { color: var(--text-600); }
.text-danger { color: var(--red-600); display: block; }

@media (max-width: 639px) {
    .header-inner { flex-wrap: wrap; }
    .header-search { order: 3; max-width: none; width: 100%; }
}
