/*
 * Banjoe Online design system.
 * Plain CSS, not a Tailwind utility layer - this file is guaranteed to render
 * regardless of what Tailwind's JIT compiler had scanned at the last build
 * (this server has no Node/npm to recompile assets/css/tailwind.css, so any
 * brand-new Tailwind class written into a template would silently do nothing).
 * Dark mode follows the existing html.dark class toggle from theme.js -
 * matching dark-mode.css's own pattern rather than Tailwind's dark: variant.
 * Low Data Mode (html.low-data / body.low-data-active) already strips shadows
 * and animations globally in dark-mode.css; components below inherit that for
 * free since they use the same --shadow-* tokens dark-mode.css already zeroes.
 */

:root {
    /* Brand */
    --bo-primary: #047857;       /* emerald-700 - existing brand green, kept */
    --bo-primary-strong: #065f46;/* emerald-800 */
    --bo-primary-soft: #10b981;  /* emerald-500 */
    --bo-primary-tint: #ecfdf5;  /* emerald-50 */
    --bo-secondary: #b45309;     /* amber-700 - warm accent for urgency/CTAs, pairs with green */
    --bo-secondary-soft: #f59e0b;/* amber-500 */
    --bo-secondary-tint: #fffbeb;/* amber-50 */

    /* Semantic */
    --bo-success: #059669;
    --bo-success-tint: #ecfdf5;
    --bo-warning: #d97706;
    --bo-warning-tint: #fffbeb;
    --bo-danger: #dc2626;
    --bo-danger-tint: #fef2f2;
    --bo-info: #2563eb;
    --bo-info-tint: #eff6ff;

    /* Neutrals */
    --bo-bg: #f8fafc;            /* slate-50 page background */
    --bo-surface: #ffffff;
    --bo-border: #e2e8f0;        /* slate-200 */
    --bo-border-strong: #cbd5e1; /* slate-300 */
    --bo-text: #0f172a;          /* slate-900 */
    --bo-text-muted: #64748b;    /* slate-500 */
    --bo-text-faint: #94a3b8;    /* slate-400 */

    /* Shape */
    --bo-radius-sm: 8px;
    --bo-radius-md: 12px;
    --bo-radius-lg: 20px;
    --bo-radius-full: 999px;

    /* Elevation */
    --bo-shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
    --bo-shadow-md: 0 4px 12px rgba(15, 23, 42, 0.08);
    --bo-shadow-lg: 0 12px 32px rgba(15, 23, 42, 0.12);

    /* Spacing scale (4px base, matches Tailwind's default so existing utility
       classes elsewhere in the app stay visually consistent with these) */
    --bo-space-1: 4px;
    --bo-space-2: 8px;
    --bo-space-3: 12px;
    --bo-space-4: 16px;
    --bo-space-5: 20px;
    --bo-space-6: 24px;
    --bo-space-8: 32px;

    /* Typography */
    --bo-font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    --bo-text-xs: 12px;
    --bo-text-sm: 14px;
    --bo-text-base: 15px;
    --bo-text-lg: 18px;
    --bo-text-xl: 22px;
    --bo-text-2xl: 28px;
}

/* Breakpoints (reference only - CSS custom properties can't hold media query
   ranges, so this documents the scale used consistently across the redesign):
   xs 320-374  sm 375-413  md 414-767  lg 768-1023  xl 1024-1279  2xl 1280+ */

html[data-theme="dark"] {
    --bo-bg: #0f172a;
    --bo-surface: #1e293b;       /* slate-800 */
    --bo-border: #334155;        /* slate-700 */
    --bo-border-strong: #475569; /* slate-600 */
    --bo-text: #f1f5f9;          /* slate-100 */
    --bo-text-muted: #94a3b8;
    --bo-text-faint: #64748b;
    --bo-primary-tint: rgba(16, 185, 129, 0.12);
    --bo-secondary-tint: rgba(245, 158, 11, 0.12);
    --bo-success-tint: rgba(5, 150, 105, 0.14);
    --bo-warning-tint: rgba(217, 119, 6, 0.14);
    --bo-danger-tint: rgba(220, 38, 38, 0.14);
    --bo-info-tint: rgba(37, 99, 235, 0.14);
}

/* ---------- Buttons ---------- */
.bo-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--bo-space-2);
    font-family: var(--bo-font);
    font-weight: 800;
    font-size: var(--bo-text-sm);
    line-height: 1;
    padding: 12px 20px;
    border-radius: var(--bo-radius-md);
    border: 1px solid transparent;
    cursor: pointer;
    transition: background-color 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
    text-decoration: none;
    min-height: 44px; /* touch target */
}
.bo-btn:active { transform: scale(0.98); }
.bo-btn:focus-visible { outline: 2px solid var(--bo-primary); outline-offset: 2px; }

.bo-btn-primary { background: var(--bo-primary); color: #fff; }
.bo-btn-primary:hover { background: var(--bo-primary-strong); }

.bo-btn-secondary { background: var(--bo-secondary); color: #fff; }
.bo-btn-secondary:hover { background: #92400e; }

.bo-btn-outline { background: transparent; color: var(--bo-text); border-color: var(--bo-border-strong); }
.bo-btn-outline:hover { border-color: var(--bo-primary); color: var(--bo-primary); }

.bo-btn-ghost { background: transparent; color: var(--bo-text-muted); }
.bo-btn-ghost:hover { background: var(--bo-bg); color: var(--bo-text); }

.bo-btn-danger { background: var(--bo-danger); color: #fff; }
.bo-btn-danger:hover { background: #b91c1c; }

.bo-btn-sm { padding: 8px 14px; font-size: var(--bo-text-xs); min-height: 36px; }
.bo-btn-block { width: 100%; }
.bo-btn-icon { padding: 10px; min-width: 44px; }

/* ---------- Cards ---------- */
.bo-card {
    background: var(--bo-surface);
    border: 1px solid var(--bo-border);
    border-radius: var(--bo-radius-lg);
    box-shadow: var(--bo-shadow-sm);
    overflow: hidden;
}
.bo-card-body { padding: var(--bo-space-5); }
.bo-card-hover { transition: box-shadow 0.15s ease, transform 0.15s ease; }
.bo-card-hover:hover { box-shadow: var(--bo-shadow-md); }

/* ---------- Inputs ---------- */
.bo-input, .bo-select, .bo-textarea {
    width: 100%;
    font-family: var(--bo-font);
    font-size: var(--bo-text-base);
    font-weight: 600;
    color: var(--bo-text);
    background: var(--bo-surface);
    border: 1px solid var(--bo-border-strong);
    border-radius: var(--bo-radius-md);
    padding: 12px 14px;
    min-height: 44px;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.bo-input::placeholder, .bo-textarea::placeholder { color: var(--bo-text-faint); font-weight: 500; }
.bo-input:focus, .bo-select:focus, .bo-textarea:focus {
    outline: none;
    border-color: var(--bo-primary);
    box-shadow: 0 0 0 3px var(--bo-primary-tint);
}
.bo-label {
    display: block;
    font-size: var(--bo-text-xs);
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--bo-text-muted);
    margin-bottom: var(--bo-space-2);
}

/* ---------- Badges & chips ---------- */
.bo-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 5px 10px;
    border-radius: var(--bo-radius-full);
    line-height: 1;
    white-space: nowrap;
}
.bo-badge-success { background: var(--bo-success-tint); color: var(--bo-success); }
.bo-badge-warning { background: var(--bo-warning-tint); color: var(--bo-warning); }
.bo-badge-danger  { background: var(--bo-danger-tint);  color: var(--bo-danger); }
.bo-badge-info    { background: var(--bo-info-tint);    color: var(--bo-info); }
.bo-badge-neutral { background: var(--bo-bg); color: var(--bo-text-muted); border: 1px solid var(--bo-border); }
.bo-badge-urgent  { background: var(--bo-secondary); color: #fff; }

.bo-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: var(--bo-text-xs);
    font-weight: 700;
    padding: 7px 14px;
    border-radius: var(--bo-radius-full);
    border: 1px solid var(--bo-border);
    background: var(--bo-surface);
    color: var(--bo-text);
    cursor: pointer;
    transition: all 0.15s ease;
    min-height: 36px;
}
.bo-chip:hover { border-color: var(--bo-primary); }
.bo-chip[aria-pressed="true"], .bo-chip.is-active {
    background: var(--bo-primary);
    border-color: var(--bo-primary);
    color: #fff;
}

/* ---------- Utility ---------- */
.bo-divider { border-top: 1px solid var(--bo-border); }
.bo-text-muted { color: var(--bo-text-muted); }
.bo-surface { background: var(--bo-surface); color: var(--bo-text); }
.bo-sr-only {
    position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

/* Fix: #low-data-suggestion (includes/header.php) uses bottom-24/left-4/right-4/
   md:right-5/md:bottom-5/md:max-w-sm Tailwind classes that are not present in
   the compiled tailwind.css (this server has no Node/npm to rebuild it), so
   the element only received bare position:fixed and collapsed to the top of
   the viewport, overlapping the hero heading on every page. This restores the
   intended bottom-anchored placement without depending on a Tailwind rebuild. */
#low-data-suggestion {
    top: auto !important;
    bottom: 96px !important;
    left: 16px !important;
    right: 16px !important;
    max-width: none;
}
@media (min-width: 768px) {
    #low-data-suggestion {
        left: auto !important;
        right: 20px !important;
        bottom: 20px !important;
        max-width: 384px;
    }
}

/* Safe responsive visibility utilities.
   Not every Tailwind responsive class (e.g. lg:flex) exists in the static
   compiled tailwind.css on this server (no Node/npm to rebuild it against
   new markup), so the redesign uses these plain-CSS equivalents instead -
   guaranteed to work at every breakpoint regardless of Tailwind build state. */
.bo-show-md { display: none; }
.bo-show-lg { display: none; }
@media (min-width: 768px) { .bo-show-md { display: flex; } }
@media (min-width: 1024px) { .bo-show-lg { display: flex; } }

/* Legacy dark-mode.css applies a broad "color: inherit" rule to .listing-card
   descendants which washes out badge text; restore intended colors explicitly. */
html[data-theme="dark"] .listing-card .bo-badge-success { color: var(--bo-success) !important; background: var(--bo-success-tint) !important; }
html[data-theme="dark"] .listing-card .bo-badge-warning { color: var(--bo-warning) !important; background: var(--bo-warning-tint) !important; }
html[data-theme="dark"] .listing-card .bo-badge-danger  { color: var(--bo-danger) !important; background: var(--bo-danger-tint) !important; }
html[data-theme="dark"] .listing-card .bo-badge-info    { color: var(--bo-info) !important; background: var(--bo-info-tint) !important; }
html[data-theme="dark"] .listing-card .bo-badge-neutral { color: var(--bo-text-muted) !important; background: var(--bo-bg) !important; }
html[data-theme="dark"] .listing-card .listing-card-price { color: var(--bo-primary-soft) !important; }
html[data-theme="dark"] .listing-card .bo-btn-primary { color: #fff !important; }

/* ---------- Filter drawer/panel (search redesign) ---------- */
.bo-drawer-overlay {
    position: fixed; inset: 0; background: rgba(15, 23, 42, 0.5);
    z-index: 200; opacity: 0; transition: opacity 0.2s ease;
}
.bo-drawer-overlay.is-open { opacity: 1; }
.bo-drawer {
    position: fixed; z-index: 201; background: var(--bo-surface); color: var(--bo-text);
    box-shadow: var(--bo-shadow-lg);
    left: 0; right: 0; bottom: 0; border-radius: var(--bo-radius-lg) var(--bo-radius-lg) 0 0;
    max-height: 85vh; overflow-y: auto;
    transform: translateY(100%); transition: transform 0.25s ease;
}
.bo-drawer.is-open { transform: translateY(0); }
@media (min-width: 768px) {
    .bo-drawer {
        left: auto; right: 24px; bottom: auto; top: 80px;
        width: 360px; max-height: calc(100vh - 120px);
        border-radius: var(--bo-radius-lg);
        transform: translateY(-12px) scale(0.98); opacity: 0;
        transition: transform 0.15s ease, opacity 0.15s ease;
    }
    .bo-drawer.is-open { transform: translateY(0) scale(1); opacity: 1; }
}
.bo-drawer-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: var(--bo-space-5); border-bottom: 1px solid var(--bo-border);
    position: sticky; top: 0; background: var(--bo-surface);
}
.bo-drawer-title { font-weight: 900; font-size: var(--bo-text-lg); margin: 0; }
.bo-drawer-close {
    width: 36px; height: 36px; border-radius: var(--bo-radius-full); border: none;
    background: var(--bo-bg); color: var(--bo-text-muted); cursor: pointer;
    display: flex; align-items: center; justify-content: center; font-size: 18px;
}
.bo-drawer-body { padding: var(--bo-space-5); display: flex; flex-direction: column; gap: var(--bo-space-5); }
.bo-drawer-footer {
    display: flex; gap: var(--bo-space-3); padding: var(--bo-space-5);
    border-top: 1px solid var(--bo-border); position: sticky; bottom: 0; background: var(--bo-surface);
}
.bo-price-range { display: flex; align-items: center; gap: var(--bo-space-2); }
.bo-price-range .bo-input { min-height: 40px; }

/* Active filter chips row */
.bo-filter-chips { display: flex; flex-wrap: wrap; gap: var(--bo-space-2); align-items: center; }
.bo-filter-chip {
    display: inline-flex; align-items: center; gap: 6px;
    background: var(--bo-primary-tint); color: var(--bo-primary); border: 1px solid transparent;
    font-size: var(--bo-text-xs); font-weight: 700; padding: 6px 8px 6px 12px; border-radius: var(--bo-radius-full);
}
.bo-filter-chip button {
    background: none; border: none; cursor: pointer; color: inherit; display: flex; padding: 2px;
    border-radius: 50%; width: 18px; height: 18px; align-items: center; justify-content: center;
}
.bo-filter-chip button:hover { background: rgba(0,0,0,0.08); }
html[data-theme="dark"] .bo-filter-chip button:hover { background: rgba(255,255,255,0.12); }

/* Chat composer: keep it reachable above the fixed mobile bottom nav (72px tall)
   without a full layout rewrite - sticky rather than fixed so it still scrolls
   away naturally on desktop where there is no bottom nav. */
@media (max-width: 767px) {
    .chat-composer {
        position: sticky;
        bottom: calc(72px + env(safe-area-inset-bottom, 0px));
        background: var(--bo-surface);
        z-index: 10;
    }
}
