body {
    background-color: #f4f7f3;
    font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    /* Sticky footer: body fills the viewport and stacks vertically so the
       footer is pushed to the bottom even when the page content is short. */
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

#app {
    /* Grow to absorb free space, keeping the footer at the bottom. */
    flex: 1 0 auto;
}

body > footer {
    flex-shrink: 0;
    margin-top: 0 !important; /* override Bootstrap mt-5 so there's no mid-page gap */
}

.brand-text {
    color: #1b5e20;
}

#navbar {
    position: sticky;
    top: 0;
    z-index: 1030;
    box-shadow: 0 2px 10px rgba(0,0,0,0.12);
}

#navbar .btn {
    border-radius: 50rem;
}

.btn {
    border-radius: 0.6rem;
}

.btn-success {
    background-color: #198754;
    border-color: #198754;
}

.btn-success:hover {
    background-color: #157347;
    border-color: #146c43;
}

.card, .product-card, .seller-card {
    border: none;
    border-radius: 1rem;
    box-shadow: 0 1px 4px rgba(0,0,0,0.07);
    transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.product-card, .seller-card {
    height: 100%;
}

.product-card:hover, .seller-card:hover {
    transform: translateY(-3px) scale(1.01);
    box-shadow: 0 8px 20px rgba(0,0,0,0.12);
}

.product-card img, .seller-card img {
    height: 140px;
    object-fit: cover;
    border-radius: 1rem 1rem 0 0;
    background: #e9ecef;
}

.form-control, .form-select {
    border-radius: 0.6rem;
    border-color: #dde3dd;
}

.form-control:focus, .form-select:focus {
    border-color: #66bb6a;
    box-shadow: 0 0 0 0.2rem rgba(34, 151, 78, 0.15);
}

.star-rating {
    color: #f5a623;
    letter-spacing: 2px;
}

/* ---------------------------------------------------------------
   Home page — hero
   --------------------------------------------------------------- */
.home-hero {
    position: relative;
    min-height: 520px;
    background-image: url('/assets/img/header.jpg');
    background-size: cover;
    background-position: center 40%;
    display: flex;
    align-items: center;
}

.home-hero-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(100deg, rgba(10,40,15,0.82) 0%, rgba(10,40,15,0.55) 55%, rgba(10,40,15,0.2) 100%);
    display: flex;
    align-items: center;
    width: 100%;
}

.home-hero-content {
    padding-top: 3rem;
    padding-bottom: 3rem;
}

.home-hero-eyebrow {
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #86efac;
    margin-bottom: 0.75rem;
}

.home-hero-title {
    font-size: clamp(2rem, 5vw, 3.2rem);
    font-weight: 800;
    color: #fff;
    line-height: 1.15;
    margin-bottom: 1rem;
    text-shadow: 0 2px 12px rgba(0,0,0,0.3);
}

.home-hero-sub {
    font-size: 1.05rem;
    color: rgba(255,255,255,0.88);
    max-width: 500px;
    line-height: 1.65;
    margin-bottom: 0;
}

/* ---------------------------------------------------------------
   Home page — feature cards
   --------------------------------------------------------------- */
.home-feature-card {
    background: #fff;
    border-radius: 1rem;
    padding: 1.75rem 1.5rem;
    height: 100%;
    box-shadow: 0 1px 6px rgba(0,0,0,0.06);
    transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.home-feature-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 22px rgba(0,0,0,0.1);
}

.home-feature-icon {
    width: 52px;
    height: 52px;
    border-radius: 0.85rem;
    background: #edf7ed;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
}

.home-feature-icon i {
    font-size: 1.5rem;
    color: #198754;
}

.home-feature-card h5 {
    font-weight: 700;
    font-size: 1rem;
    margin-bottom: 0.5rem;
    color: #1b3a1f;
}

.home-feature-card p {
    font-size: 0.875rem;
    color: #6c757d;
    margin-bottom: 0;
    line-height: 1.6;
}

/* ---------------------------------------------------------------
   Home page — seller card banner placeholder
   --------------------------------------------------------------- */
.seller-card-banner-placeholder {
    width: 100%;
    height: 110px;
    background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
    border-radius: 1rem 1rem 0 0;
}

/* ---------------------------------------------------------------
   Home page — seller CTA banner
   --------------------------------------------------------------- */
.home-cta-banner {
    background: linear-gradient(100deg, #edf7ed 0%, #d8f0d8 100%);
    border-radius: 1rem;
    padding: 1.5rem 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
    border: 1px solid #c3e6c3;
}

@media (max-width: 576px) {
    .home-hero { min-height: 420px; }
    .home-hero-sub { font-size: 0.95rem; }
    .home-cta-banner { flex-direction: column; text-align: center; }
}

#location-suggestions {
    border-radius: 0.6rem;
    overflow: hidden;
    max-height: 260px;
    overflow-y: auto;
}

/* ---------------------------------------------------------------
   Admin dashboard — sidebar layout
   --------------------------------------------------------------- */
.admin-layout {
    display: flex;
    min-height: calc(100vh - 58px);
}

.admin-sidebar {
    width: 230px;
    min-width: 230px;
    background: #fff;
    border-right: 1px solid #e4ebe4;
    display: flex;
    flex-direction: column;
    box-shadow: 2px 0 8px rgba(0,0,0,0.04);
}

.admin-sidebar-brand {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 1.1rem 1.4rem;
    font-weight: 700;
    font-size: 0.95rem;
    color: #1b5e20;
    border-bottom: 1px solid #e4ebe4;
    letter-spacing: 0.01em;
}

.admin-sidebar-brand i {
    font-size: 1.15rem;
}

.admin-nav {
    padding: 0.6rem 0;
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.admin-nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.65rem 1.4rem;
    color: #546054;
    background: none;
    border: none;
    border-left: 3px solid transparent;
    text-align: left;
    cursor: pointer;
    font-size: 0.88rem;
    width: 100%;
    transition: background 0.13s, color 0.13s, border-color 0.13s;
    border-radius: 0;
}

.admin-nav-item i {
    font-size: 1rem;
    width: 1.1rem;
    flex-shrink: 0;
    opacity: 0.7;
    transition: opacity 0.13s;
}

.admin-nav-item:hover {
    background: #f0f7f0;
    color: #198754;
}

.admin-nav-item:hover i {
    opacity: 1;
}

.admin-nav-item.active {
    background: #edf7ed;
    color: #198754;
    font-weight: 600;
    border-left-color: #198754;
}

.admin-nav-item.active i {
    opacity: 1;
}

.admin-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    background: #f4f7f3;
}

.admin-content-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.85rem 1.5rem;
    background: #fff;
    border-bottom: 1px solid #e4ebe4;
    box-shadow: 0 1px 4px rgba(0,0,0,0.04);
    position: sticky;
    top: 58px;
    z-index: 100;
}

.admin-page-title {
    font-size: 1rem;
    font-weight: 700;
    color: #1b5e20;
    margin: 0;
    letter-spacing: 0.01em;
}

.admin-sidebar-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: 1px solid #dde3dd;
    border-radius: 0.5rem;
    padding: 0.3rem 0.5rem;
    font-size: 1.1rem;
    color: #546054;
    cursor: pointer;
    line-height: 1;
}

.admin-sidebar-toggle:hover {
    background: #f0f7f0;
    color: #198754;
}

.admin-content-body {
    padding: 1.5rem;
    flex: 1;
}

.admin-sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.35);
    z-index: 1019;
}

@media (max-width: 767px) {
    .admin-sidebar {
        position: fixed;
        top: 58px;
        left: -240px;
        height: calc(100vh - 58px);
        z-index: 1020;
        width: 230px;
        transition: left 0.22s ease;
        box-shadow: 4px 0 20px rgba(0,0,0,0.18);
    }

    .admin-sidebar.open {
        left: 0;
    }

    .admin-content-header {
        top: 58px;
    }

    .admin-content-body {
        padding: 1rem;
    }
}

/* ---------------------------------------------------------------
   Seller banner (profile page header)
   --------------------------------------------------------------- */
.seller-banner {
    width: 100%;
    height: 220px;
    background-size: cover;
    background-position: center;
    position: relative;
}

.seller-banner-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.65) 0%, rgba(0,0,0,0.15) 100%);
    display: flex;
    align-items: flex-end;
    padding-bottom: 1.25rem;
}

.seller-banner-name {
    color: #fff;
    font-size: 1.6rem;
    font-weight: 700;
    margin: 0;
    text-shadow: 0 1px 4px rgba(0,0,0,0.5);
}

.seller-banner-sub {
    color: rgba(255,255,255,0.85);
    margin: 0.2rem 0 0;
    font-size: 0.9rem;
}

/* ---------------------------------------------------------------
   Seller banner thumbnail in dashboard profile tab
   --------------------------------------------------------------- */
.seller-banner-preview {
    width: 100%;
    height: 140px;
    object-fit: cover;
    border-radius: 0.6rem;
    display: block;
}

.seller-banner-placeholder {
    width: 100%;
    height: 140px;
    background: #eef5ee;
    border-radius: 0.6rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border: 2px dashed #c8dfc8;
}

/* ---------------------------------------------------------------
   Seller card banner thumbnail (search results)
   --------------------------------------------------------------- */
.seller-card-banner {
    width: 100%;
    height: 110px;
    object-fit: cover;
    border-radius: 1rem 1rem 0 0;
    display: block;
}

/* ---------------------------------------------------------------
   Distance badge ("Near Me" sort)
   --------------------------------------------------------------- */
.distance-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: #fff;
    background: #198754;
    border-radius: 50rem;
    padding: 0.15rem 0.55rem;
    white-space: nowrap;
}

.distance-badge i {
    font-size: 0.7rem;
}

.cursor-pointer { cursor: pointer; }

.rating-stars-input span {
    font-size: 1.6rem;
    cursor: pointer;
    color: #ccc;
}

.rating-stars-input span.active {
    color: #f5a623;
}

/* ---------------------------------------------------------------
   ID document upload area (seller registration)
   --------------------------------------------------------------- */
.id-doc-upload-area {
    border: 2px dashed #c8dfc8;
    border-radius: 0.75rem;
    background: #f8fdf8;
    padding: 1.5rem 1rem;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
}

.id-doc-upload-area.drag-over {
    border-color: #198754;
    background: #edf7ed;
}

.id-doc-preview-wrap {
    position: relative;
    display: inline-flex;
    align-items: center;
    background: #f0f7f0;
    border-radius: 0.6rem;
    padding: 0.5rem;
    gap: 0.5rem;
    max-width: 100%;
}

.id-doc-preview-img {
    max-height: 120px;
    max-width: 100%;
    border-radius: 0.4rem;
    display: block;
    object-fit: contain;
}

.id-doc-pdf {
    padding: 0.75rem 1rem;
}

.id-doc-remove-btn {
    position: absolute;
    top: -8px;
    right: -8px;
    background: none;
    border: none;
    color: #dc3545;
    font-size: 1.1rem;
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

/* ---------------------------------------------------------------
   Seller registration — step indicator
   --------------------------------------------------------------- */
.reg-steps {
    display: flex;
    align-items: center;
    gap: 0;
}

.reg-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.3rem;
}

.reg-step span {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    font-weight: 700;
    background: #e4ebe4;
    color: #7a927a;
    border: 2px solid #c8dfc8;
    transition: background 0.2s, color 0.2s;
}

.reg-step small {
    font-size: 0.68rem;
    color: #9aaa9a;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    white-space: nowrap;
}

.reg-step.active span {
    background: #198754;
    color: #fff;
    border-color: #198754;
}

.reg-step.active small {
    color: #198754;
}

.reg-step.done span {
    background: #d1fae5;
    color: #198754;
    border-color: #86efac;
}

.reg-step.done small {
    color: #198754;
}

.reg-step-line {
    flex: 1;
    height: 2px;
    background: #c8dfc8;
    margin: 0 0.5rem;
    margin-bottom: 1.2rem;
    min-width: 40px;
}

.reg-step-line.active {
    background: #198754;
}

@media (max-width: 576px) {
    .hero h1 { font-size: 1.6rem; }
    .navbar-brand { font-size: 1.1rem; }
}

/* ── Floating WhatsApp support button ────────────────────────────────────── */
.whatsapp-fab {
    position: fixed;
    right: 20px;
    bottom: 20px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: #25d366;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25);
    z-index: 1040;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    text-decoration: none;
}
.whatsapp-fab:hover,
.whatsapp-fab:focus {
    color: #fff;
    transform: scale(1.08);
    box-shadow: 0 8px 22px rgba(37, 211, 102, 0.5);
}
.whatsapp-fab::after {
    /* Gentle attention pulse. */
    content: "";
    position: absolute;
    inset: 0;
    border-radius: 50%;
    box-shadow: 0 0 0 0 rgba(37, 211, 102, 0.5);
    animation: whatsapp-pulse 2.4s infinite;
}
@keyframes whatsapp-pulse {
    0%   { box-shadow: 0 0 0 0 rgba(37, 211, 102, 0.45); }
    70%  { box-shadow: 0 0 0 14px rgba(37, 211, 102, 0); }
    100% { box-shadow: 0 0 0 0 rgba(37, 211, 102, 0); }
}
@media (max-width: 576px) {
    .whatsapp-fab { width: 50px; height: 50px; right: 14px; bottom: 14px; }
    .whatsapp-fab svg { width: 26px; height: 26px; }
}
@media print {
    .whatsapp-fab { display: none !important; }
}

/* ── Print: show only the shop QR poster ─────────────────────────────────── */
/* ── Printable shop-QR poster (half A4 / A5) ─────────────────────────────── */
.qr-print {
    max-width: 420px;
    margin: 0 auto;
}
.qr-poster {
    /* On-screen preview mirrors the printed A5 proportions (148 x 210mm). */
    width: 100%;
    aspect-ratio: 148 / 210;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    text-align: center;
    padding: 6% 8% 5%;
    background: #fff;
    border: 2px solid #198754;
    border-radius: 1.1rem;
    box-shadow: 0 10px 30px rgba(25, 135, 84, 0.12);
}
.qr-poster__brand {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin-bottom: 4%;
}
.qr-poster__brand-mark {
    width: 2rem;
    height: 2rem;
    border-radius: 0.55rem;
    background: #198754;
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.05rem;
}
.qr-poster__brand-name {
    font-weight: 800;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: #198754;
    font-size: 1.15rem;
}
.qr-poster__logo {
    margin-bottom: 3%;
}
.qr-shop-logo {
    width: 84px;
    height: 84px;
    object-fit: cover;
    border-radius: 50%;
    border: 3px solid #e4efe6;
    background: #fff;
}
.qr-shop-logo--placeholder {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #9bb8a3;
    font-size: 2.2rem;
    background: #f1f7f2;
}
.qr-poster__shop {
    margin: 0 0 0.15rem;
    font-weight: 700;
    line-height: 1.15;
    color: #1c2b20;
}
.qr-poster__tag {
    color: #6b7d70;
    margin-bottom: 5%;
    font-size: 0.95rem;
}
.qr-poster__code {
    display: inline-flex;
    padding: 12px;
    background: #fff;
    border: 1px solid #d9e5db;
    border-radius: 1rem;
    margin-bottom: 4%;
}
.qr-poster__code img,
.qr-poster__code canvas {
    display: block;
    width: 100% !important;
    height: auto !important;
    max-width: 220px;
}
.qr-poster__cta {
    font-weight: 700;
    font-size: 1.25rem;
    color: #1c2b20;
    margin-bottom: 0.35rem;
}
.qr-poster__hint {
    color: #6b7d70;
    font-size: 0.85rem;
    margin-bottom: auto;
}
.qr-poster__footer {
    margin-top: 4%;
    padding-top: 3%;
    border-top: 1px solid #e4efe6;
    width: 100%;
    color: #9bb8a3;
    font-size: 0.75rem;
    letter-spacing: 1px;
    text-transform: uppercase;
}

@media print {
    /* Print on half an A4 sheet. */
    @page { size: A5 portrait; margin: 8mm; }

    body * { visibility: hidden !important; }
    .qr-print, .qr-print * { visibility: visible !important; }
    .qr-print {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        max-width: none;
        margin: 0;
    }
    .qr-poster {
        aspect-ratio: auto;
        width: 100%;
        min-height: 190mm;
        border: 2px solid #198754;
        border-radius: 10px;
        box-shadow: none !important;
        padding: 12mm 10mm 8mm;
    }
    .qr-poster__code img,
    .qr-poster__code canvas { max-width: 62mm; }
    #navbar, footer, .nav-tabs, .no-print { display: none !important; }

    /* Keep the green ink in the printout. */
    .qr-poster__brand-mark { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* ── Finance sub-page navigation (pills) ─────────────────────────────────── */
.finance-subnav .nav-link {
    color: #546054;
    background: #eef3ee;
    font-size: 0.86rem;
    padding: 0.4rem 0.9rem;
}
.finance-subnav .nav-link:hover {
    background: #e0efe0;
    color: #198754;
}
.finance-subnav .nav-link.active {
    background: #198754;
    color: #fff;
}

/* ── Modern data tables (clickable rows + mobile card stacking) ───────────── */
.table-modern {
    border-collapse: separate;
    border-spacing: 0;
}
.table-modern thead th {
    background: #f4f7f3;
    color: #48594a;
    font-size: 0.74rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    border-bottom: 2px solid #e4ebe4;
    white-space: nowrap;
}
.table-modern tbody td { border-top: 1px solid #eef2ee; }
.table-modern tbody tr { transition: background 0.12s; }
.row-click { cursor: pointer; }
.row-click:hover { background: #f0f7f0; }
.row-click:active { background: #e6f2e6; }

/* Card grid used for products/records on any screen when preferred */
.record-hint { font-size: 0.7rem; color: #9aa79a; }

@media (max-width: 640px) {
    .data-table thead { display: none; }
    .data-table, .data-table tbody { display: block; width: 100%; }
    .data-table tr {
        display: block;
        margin-bottom: 0.75rem;
        border: 1px solid #e4ebe4;
        border-radius: 0.85rem;
        background: #fff;
        box-shadow: 0 1px 4px rgba(0,0,0,0.05);
        overflow: hidden;
    }
    .data-table td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        gap: 1rem;
        border: none;
        border-bottom: 1px solid #f1f5f1;
        padding: 0.5rem 0.9rem;
        text-align: right;
    }
    .data-table tr td:last-child { border-bottom: none; }
    .data-table td::before {
        content: attr(data-label);
        font-weight: 600;
        color: #6b776b;
        text-align: left;
        font-size: 0.78rem;
        flex-shrink: 0;
    }
    .data-table td:empty { display: none; }
    /* First cell acts as a card header */
    .data-table td:first-child {
        background: #f7faf7;
        font-weight: 600;
        font-size: 0.95rem;
    }
}

/* Detail rows inside record modals */
.detail-row {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.5rem 0;
    border-bottom: 1px solid #f0f4f0;
    font-size: 0.9rem;
}
.detail-row:last-child { border-bottom: none; }
.detail-row .detail-label { color: #6b776b; font-weight: 600; }
.detail-row .detail-value { text-align: right; word-break: break-word; }
