/* ==========================================================================
   Housing Expo — main stylesheet
   Brand colors come from Admin → Branding (injected as CSS variables).
   ========================================================================== */
:root {
  --primary: #0B2A5B;
  --primary-dark: #071B3B;
  --primary-soft: #E7EAEF;
  --accent: #D7262E;
  --accent-dark: #B01F26;
  --accent-soft: #FBE9EA;
  --ink: #1A2233;
  --ink-2: #4A5568;
  --muted: #718096;
  --line: #E3E8EF;
  --bg: #F5F7FA;
  --card: #FFFFFF;
  --ok: #1F8A4C;
  --warn: #B7791F;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 4px 16px rgba(16, 24, 40, .06);
  --shadow-lg: 0 12px 32px rgba(16, 24, 40, .14);
  --tap: 48px; /* minimum touch target */
  --font: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0; font-family: var(--font); color: var(--ink); background: var(--bg);
  font-size: 16px; line-height: 1.55; -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
img { max-width: 100%; display: block; }
a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--accent); }
h1, h2, h3, h4 { line-height: 1.2; margin: 0 0 .5em; color: var(--primary); letter-spacing: -.01em; }
h1 { font-size: clamp(1.7rem, 3.2vw, 2.4rem); font-weight: 800; }
h2 { font-size: clamp(1.3rem, 2.2vw, 1.7rem); font-weight: 800; }
h3 { font-size: 1.1rem; font-weight: 700; }
p { margin: 0 0 1em; }
code { background: var(--primary-soft); padding: .1em .35em; border-radius: 4px; font-size: .9em; }
.container { width: 100%; max-width: 1240px; margin: 0 auto; padding: 0 20px; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.center { text-align: center; }
.strong { font-weight: 700; }
.nowrap { white-space: nowrap; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
[hidden] { display: none !important; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  min-height: var(--tap); padding: .7rem 1.3rem; border-radius: 999px; border: 2px solid transparent;
  font: inherit; font-weight: 700; font-size: .98rem; cursor: pointer; text-align: center;
  transition: background .15s, color .15s, border-color .15s, transform .05s; user-select: none;
}
.btn:active { transform: scale(.98); }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-dark); color: #fff; }
.btn-outline { border-color: currentColor; color: var(--primary); background: transparent; }
.btn-outline:hover { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-ghost { background: var(--primary-soft); color: var(--primary); }
.btn-ghost:hover { background: var(--primary); color: #fff; }
.btn-danger { background: #C53030; color: #fff; }
.btn-danger-ghost { background: #FDECEC; color: #C53030; }
.btn-danger-ghost:hover { background: #C53030; color: #fff; }
.btn-sm { min-height: 38px; padding: .4rem .9rem; font-size: .88rem; }
.btn-lg { min-height: 56px; font-size: 1.05rem; }
.btn-block { width: 100%; }
.icon-btn {
  width: var(--tap); height: var(--tap); display: inline-grid; place-items: center; border-radius: 12px;
  border: 0; background: rgba(255,255,255,.1); color: inherit; cursor: pointer; font-size: 1.6rem; line-height: 1;
}
.icon-btn:hover { background: rgba(255,255,255,.2); }
.pill { display: inline-block; min-width: 1.4em; padding: 0 .45em; border-radius: 999px; background: var(--accent); color: #fff; font-size: .75rem; line-height: 1.5; text-align: center; }

/* ---------- Header ---------- */
.site-header { position: sticky; top: 0; z-index: 50; background: var(--primary); color: #fff; box-shadow: 0 2px 12px rgba(0,0,0,.18); }
.nav { display: flex; align-items: center; gap: 1.5rem; min-height: 76px; }
.brand { display: inline-flex; align-items: center; gap: .65rem; color: #fff; font-weight: 800; font-size: 1.15rem; flex-shrink: 0; }
.brand:hover { color: #fff; }
.brand-logo { height: 46px; width: auto; max-width: 230px; object-fit: contain; }
.brand-mark { width: 42px; height: 42px; border-radius: 10px; display: grid; place-items: center; background: var(--accent); color: #fff; font-size: 1.3rem; font-weight: 800; }
.nav-links { display: flex; align-items: center; gap: .25rem; margin-left: auto; }
.nav-links a { color: rgba(255,255,255,.85); font-weight: 600; padding: .7rem 1rem; border-radius: 999px; min-height: var(--tap); display: inline-flex; align-items: center; }
.nav-links a:hover { color: #fff; background: rgba(255,255,255,.1); }
.nav-links a.active { color: #fff; background: rgba(255,255,255,.16); box-shadow: inset 0 -3px 0 var(--accent); }
.nav-tools { display: flex; gap: .4rem; }
.nav-toggle { display: none; }

/* ---------- Hero / search ---------- */
.hero {
  position: relative; color: #fff; padding: 72px 0 64px; overflow: hidden;
  background:
    radial-gradient(1100px 500px at 85% -10%, color-mix(in srgb, var(--accent) 45%, transparent), transparent 60%),
    linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
}
.hero::after {
  content: ""; position: absolute; inset: auto -5% -1px -5%; height: 70px;
  background: var(--bg); clip-path: ellipse(60% 100% at 50% 100%);
}
.hero .container { position: relative; z-index: 1; }
.hero h1 { color: #fff; max-width: 820px; font-size: clamp(2rem, 4.4vw, 3.2rem); }
.hero h1 span { color: #fff; background: linear-gradient(transparent 62%, color-mix(in srgb, var(--accent) 80%, transparent) 62%); }
.hero-sub { font-size: 1.15rem; color: rgba(255,255,255,.85); max-width: 680px; margin-bottom: 2rem; }
.search-box {
  display: grid; grid-template-columns: 2fr 1fr 1fr 1fr auto; gap: .5rem; padding: .6rem;
  background: #fff; border-radius: 20px; box-shadow: var(--shadow-lg); max-width: 1100px;
}
.sb-field { display: flex; flex-direction: column; padding: .45rem .9rem; border-radius: 12px; cursor: pointer; }
.sb-field:not(:last-of-type) { border-right: 1px solid var(--line); }
.sb-field:hover { background: var(--bg); }
.sb-field span { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.sb-field input, .sb-field select { border: 0; outline: 0; background: transparent; font: inherit; font-weight: 600; color: var(--ink); padding: .2rem 0; min-height: 32px; width: 100%; }
.sb-btn { border-radius: 14px; min-height: 64px; padding: 0 2rem; font-size: 1.05rem; }
.hero-stats { display: flex; gap: 2.5rem; margin-top: 2.2rem; flex-wrap: wrap; }
.hero-stats div { display: flex; flex-direction: column; }
.hero-stats strong { font-size: 1.8rem; font-weight: 800; }
.hero-stats span { color: rgba(255,255,255,.75); font-size: .9rem; }

/* ---------- Sections ---------- */
.section { padding: 56px 0; }
.section-alt { background: #fff; }
.section-tight { padding: 40px 0 56px; }
.section-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; margin-bottom: 1.6rem; flex-wrap: wrap; }
.section-head h2 { margin: 0 0 .2rem; }
.section-head p { margin: 0; color: var(--muted); }
.link-more { font-weight: 700; color: var(--accent); padding: .6rem 0; }

/* ---------- Cards ---------- */
.grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 22px; }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.card {
  background: var(--card); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow);
  display: flex; flex-direction: column; transition: transform .2s, box-shadow .2s; border: 1px solid var(--line);
}
.card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }
.card-media { position: relative; aspect-ratio: 4 / 3; background: var(--primary-soft); overflow: hidden; }
.card-media img { width: 100%; height: 100%; object-fit: cover; transition: transform .4s; }
.card:hover .card-media img { transform: scale(1.04); }
.badge { position: absolute; top: 12px; padding: .3rem .7rem; border-radius: 999px; font-size: .75rem; font-weight: 700; letter-spacing: .02em; }
.badge-region { left: 12px; background: rgba(255,255,255,.95); color: var(--primary); }
.badge-featured { right: 12px; background: var(--accent); color: #fff; }
.card-body { padding: 16px 18px 18px; display: flex; flex-direction: column; gap: .35rem; flex: 1; }
.card-code { font-size: .72rem; font-weight: 700; color: var(--muted); letter-spacing: .06em; }
.card-title { margin: 0; font-size: 1.08rem; }
.card-title a { color: var(--primary); }
.card-title a::after { content: ""; position: absolute; inset: 0; } /* whole card tappable */
.card { position: relative; }
.card-price { font-size: 1.15rem; font-weight: 800; color: var(--accent); }
.card-price small { font-size: .78rem; font-weight: 600; color: var(--muted); }
.card-price .tba { font-size: .95rem; color: var(--muted); font-weight: 600; }
.card-loc { font-size: .9rem; color: var(--ink-2); }
.card-specs { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: auto; padding-top: .6rem; border-top: 1px dashed var(--line); }
.card-specs span { font-size: .78rem; font-weight: 600; color: var(--ink-2); background: var(--bg); padding: .25rem .6rem; border-radius: 6px; }

/* ---------- Region & type tiles ---------- */
.region-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; }
.region-tile {
  min-height: 260px; border-radius: var(--radius); padding: 26px; display: flex; align-items: flex-end;
  color: #fff; background-size: cover; background-position: center; box-shadow: var(--shadow); transition: transform .2s;
}
.region-tile:hover { color: #fff; transform: translateY(-4px); }
.region-tile h3 { color: #fff; font-size: 1.7rem; margin-bottom: .3rem; }
.region-tile p { color: rgba(255,255,255,.85); margin-bottom: .8rem; font-size: .95rem; }
.region-luzon    { background-image: linear-gradient(160deg, var(--primary) 0%, var(--primary-dark) 100%); }
.region-visayas  { background-image: linear-gradient(160deg, color-mix(in srgb, var(--primary) 70%, var(--accent)) 0%, var(--primary-dark) 100%); }
.region-mindanao { background-image: linear-gradient(160deg, var(--accent) 0%, color-mix(in srgb, var(--accent) 40%, var(--primary-dark)) 100%); }
.tile-count { display: inline-block; font-weight: 700; background: rgba(255,255,255,.18); padding: .5rem 1rem; border-radius: 999px; backdrop-filter: blur(4px); }
.type-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; }
.type-tile {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; display: flex; flex-direction: column;
  gap: .2rem; color: var(--ink); box-shadow: var(--shadow); transition: border-color .15s, transform .15s;
}
.type-tile:hover { border-color: var(--accent); transform: translateY(-3px); color: var(--ink); }
.type-icon { font-size: 2rem; }
.type-tile strong { font-size: 1.1rem; color: var(--primary); }
.type-tile span:last-child { color: var(--muted); font-size: .9rem; }

/* ---------- FAQ ---------- */
.faq { max-width: 860px; }
.faq details { background: #fff; border: 1px solid var(--line); border-radius: var(--radius-sm); margin-bottom: 10px; }
.faq summary { cursor: pointer; padding: 1.1rem 1.3rem; font-weight: 700; color: var(--primary); list-style: none; display: flex; justify-content: space-between; gap: 1rem; }
.faq summary::after { content: "+"; font-size: 1.4rem; line-height: 1; color: var(--accent); }
.faq details[open] summary::after { content: "–"; }
.faq details p { padding: 0 1.3rem 1.1rem; margin: 0; color: var(--ink-2); }

/* ---------- Listing page ---------- */
.page-head { background: linear-gradient(135deg, var(--primary), var(--primary-dark)); color: #fff; padding: 34px 0 38px; }
.page-head h1 { color: #fff; margin-bottom: .2rem; }
.page-head p { margin: 0; color: rgba(255,255,255,.8); }
.page-head .crumbs, .page-head .crumbs a { color: rgba(255,255,255,.75); }
.crumbs { font-size: .88rem; margin-bottom: .6rem; color: var(--muted); }
.crumbs a { color: var(--ink-2); }
.listing-layout { display: grid; grid-template-columns: 280px 1fr; gap: 28px; padding-top: 28px; padding-bottom: 60px; align-items: start; }
.filters { background: #fff; border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); position: sticky; top: 96px; border: 1px solid var(--line); }
.filters-head { display: none; }
.filter-group { margin-bottom: 1.1rem; }
.filter-group > label:not(.radio), .filter-label { display: block; font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin-bottom: .4rem; }
.filter-group input[type=text], .filter-group select, .form input, .form select, .form textarea {
  width: 100%; min-height: var(--tap); padding: .6rem .85rem; border: 1.5px solid var(--line); border-radius: var(--radius-sm);
  font: inherit; color: var(--ink); background: #fff; transition: border-color .15s, box-shadow .15s;
}
.filter-group input:focus, .filter-group select:focus, .form input:focus, .form select:focus, .form textarea:focus {
  outline: 0; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft);
}
.radio { display: flex; align-items: center; gap: .6rem; min-height: 42px; padding: 0 .4rem; border-radius: 8px; cursor: pointer; font-weight: 600; }
.radio:hover { background: var(--bg); }
.radio input { width: 20px; height: 20px; accent-color: var(--accent); }
.filters .btn { margin-top: .4rem; }
.results-bar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 18px; flex-wrap: wrap; color: var(--ink-2); font-weight: 600; }
.results-bar select { min-height: 44px; border: 1.5px solid var(--line); border-radius: 999px; padding: 0 1rem; font: inherit; font-weight: 600; background: #fff; margin-left: .4rem; }
.filter-toggle { display: none; }
.empty { background: #fff; border-radius: var(--radius); padding: 50px 24px; text-align: center; box-shadow: var(--shadow); }
.pagination { display: flex; gap: .4rem; justify-content: center; margin-top: 30px; flex-wrap: wrap; }
.pagination a { min-width: var(--tap); min-height: var(--tap); display: grid; place-items: center; padding: 0 .9rem; border-radius: 12px; background: #fff; border: 1px solid var(--line); font-weight: 700; }
.pagination a.current { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ---------- Detail page ---------- */
.detail { padding-top: 22px; padding-bottom: 20px; }
.gallery { margin-bottom: 26px; }
.gallery-main { position: relative; border-radius: var(--radius); overflow: hidden; background: var(--primary-soft); box-shadow: var(--shadow); }
.gallery-track { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; scroll-behavior: smooth; }
.gallery-track::-webkit-scrollbar { display: none; }
.gallery-slide { flex: 0 0 100%; margin: 0; scroll-snap-align: center; position: relative; aspect-ratio: 16 / 8; max-height: 62vh; width: 100%; }
.gallery-slide img { width: 100%; height: 100%; object-fit: cover; cursor: zoom-in; }
.gallery-slide figcaption { position: absolute; left: 0; right: 0; bottom: 0; padding: 30px 20px 14px; color: #fff; font-weight: 600; background: linear-gradient(transparent, rgba(0,0,0,.6)); }
.gallery-nav {
  position: absolute; top: 50%; transform: translateY(-50%); width: 56px; height: 56px; border-radius: 50%; border: 0;
  background: rgba(255,255,255,.92); color: var(--primary); font-size: 2rem; line-height: 1; cursor: pointer; box-shadow: var(--shadow-lg);
}
.gallery-nav.prev { left: 16px; } .gallery-nav.next { right: 16px; }
.gallery-count { position: absolute; right: 16px; bottom: 16px; background: rgba(0,0,0,.6); color: #fff; padding: .3rem .8rem; border-radius: 999px; font-size: .85rem; font-weight: 700; }
.gallery-thumbs { display: flex; gap: 10px; margin-top: 10px; overflow-x: auto; padding-bottom: 4px; }
.gallery-thumbs button { flex: 0 0 120px; height: 80px; border-radius: 10px; overflow: hidden; border: 3px solid transparent; padding: 0; cursor: pointer; opacity: .7; background: none; }
.gallery-thumbs button.active { border-color: var(--accent); opacity: 1; }
.gallery-thumbs img { width: 100%; height: 100%; object-fit: cover; }
.detail-grid { display: grid; grid-template-columns: 1fr 380px; gap: 32px; align-items: start; }
.detail-head h1 { margin: .2rem 0 .4rem; }
.detail-loc { font-size: 1.05rem; color: var(--ink-2); }
.chips { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: 1.4rem; }
.chip { padding: .4rem .9rem; border-radius: 999px; background: var(--primary-soft); color: var(--primary); font-weight: 700; font-size: .85rem; }
.chip-accent { background: var(--accent-soft); color: var(--accent-dark); }
.price-panel { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; background: var(--line); border-radius: var(--radius); overflow: hidden; margin-bottom: 2rem; border: 1px solid var(--line); }
.price-panel > div { background: #fff; padding: 18px 22px; }
.price-panel .label { display: block; font-size: .78rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.price-panel strong { font-size: 1.5rem; color: var(--accent); font-weight: 800; }
.price-panel > div + div strong { color: var(--primary); }
.facts { margin: 0 0 2rem; background: #fff; border-radius: var(--radius); border: 1px solid var(--line); overflow: hidden; }
.facts div { display: grid; grid-template-columns: 240px 1fr; border-bottom: 1px solid var(--line); }
.facts div:last-child { border-bottom: 0; }
.facts dt { padding: 14px 20px; font-weight: 600; color: var(--muted); background: #FAFBFC; }
.facts dd { margin: 0; padding: 14px 20px; font-weight: 600; }
.prose { background: #fff; border-radius: var(--radius); border: 1px solid var(--line); padding: 20px 22px; margin-bottom: 2rem; color: var(--ink-2); }
.map { border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); aspect-ratio: 16 / 7; background: var(--primary-soft); margin-bottom: 2rem; }
.map iframe { width: 100%; height: 100%; border: 0; }
.detail-side { position: sticky; top: 96px; }
.inquiry { background: #fff; border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow-lg); border-top: 5px solid var(--accent); }
.form label { display: block; font-weight: 600; font-size: .9rem; margin-bottom: .9rem; color: var(--ink-2); }
.form label input, .form label select, .form label textarea { margin-top: .3rem; }
.form small { display: block; color: var(--muted); font-weight: 400; margin-top: .3rem; font-size: .8rem; }
.form textarea { resize: vertical; min-height: 90px; }
.form h2 { font-size: 1.15rem; margin: 1.4rem 0 .8rem; }
.form h2:first-of-type { margin-top: 0; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1rem; }
.form-actions { display: flex; gap: .6rem; margin-top: .6rem; flex-wrap: wrap; }
.checks { display: flex; flex-direction: column; justify-content: center; gap: .2rem; }
.check { display: flex !important; align-items: center; gap: .6rem; min-height: 40px; cursor: pointer; }
.check input { width: 22px !important; height: 22px; min-height: 0 !important; margin: 0 !important; accent-color: var(--accent); }

/* ---------- Lightbox ---------- */
.lightbox { position: fixed; inset: 0; z-index: 100; background: rgba(5, 10, 20, .94); display: grid; place-items: center; padding: 20px; }
.lightbox img { max-width: 100%; max-height: 92vh; border-radius: 8px; }
.lightbox-close { position: absolute; top: 14px; right: 18px; width: 56px; height: 56px; border-radius: 50%; border: 0; background: rgba(255,255,255,.15); color: #fff; font-size: 2rem; cursor: pointer; }

/* ---------- Alerts ---------- */
.alert { padding: .9rem 1.1rem; border-radius: var(--radius-sm); margin: 0 0 1rem; font-weight: 600; }
.alert-success { background: #E6F6EC; color: #17633A; }
.alert-error { background: #FDECEC; color: #9B2C2C; }
.alert-info { background: var(--primary-soft); color: var(--primary); }

/* ---------- Footer ---------- */
.site-footer { background: var(--primary-dark); color: rgba(255,255,255,.75); padding: 48px 0 20px; margin-top: 20px; }
.footer-grid { display: grid; grid-template-columns: 1.6fr 1fr 1fr 1fr; gap: 30px; }
.site-footer h4 { color: #fff; font-size: .95rem; margin-bottom: .8rem; }
.site-footer a { color: rgba(255,255,255,.75); display: block; padding: .3rem 0; }
.site-footer a:hover { color: #fff; }
.site-footer .brand { display: inline-flex; padding: 0; color: #fff; }
.footer-tag { margin-top: 1rem; max-width: 320px; }
.footer-bottom { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; border-top: 1px solid rgba(255,255,255,.12); margin-top: 30px; padding-top: 18px; font-size: .82rem; }
.site-footer .staff-link { display: inline; padding: 0; opacity: .5; }

/* ---------- Admin ---------- */
.admin-body { background: var(--bg); }
.admin-main { padding-top: 26px; padding-bottom: 60px; }
.admin-nav a { padding: .55rem .8rem; font-size: .92rem; }
.admin-title { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; margin-bottom: 18px; }
.admin-title h1 { margin: 0; font-size: 1.7rem; }
.panel { background: #fff; border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); border: 1px solid var(--line); margin-bottom: 20px; }
.stat-tabs { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.stat-tabs a { padding: .55rem 1rem; border-radius: 999px; background: #fff; border: 1px solid var(--line); font-weight: 600; color: var(--ink-2); }
.stat-tabs a b { margin-left: .3rem; color: var(--primary); }
.stat-tabs a.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.stat-tabs a.active b { color: #fff; }
.admin-search { margin-left: auto; }
.admin-search input { min-height: 42px; border: 1.5px solid var(--line); border-radius: 999px; padding: 0 1rem; font: inherit; min-width: 240px; }
.table-wrap { overflow-x: auto; background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); border: 1px solid var(--line); }
.admin-table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.admin-table th { text-align: left; font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding: 12px 14px; background: #FAFBFC; border-bottom: 1px solid var(--line); }
.admin-table td { padding: 10px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.admin-table tr:last-child td { border-bottom: 0; }
.admin-table .row-muted { opacity: .55; }
.admin-table .row-new td:first-child { box-shadow: inset 4px 0 0 var(--accent); }
.admin-table .actions { white-space: nowrap; text-align: right; }
.admin-table .actions form { display: inline; }
.thumb { position: relative; display: block; width: 84px; height: 60px; border-radius: 8px; overflow: hidden; background: var(--primary-soft); }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb span { position: absolute; right: 4px; bottom: 4px; background: rgba(0,0,0,.65); color: #fff; font-size: .7rem; font-weight: 700; padding: 0 .4rem; border-radius: 4px; }
.warn { color: var(--warn); font-weight: 700; font-size: .85rem; }
.toggle { border: 0; background: none; font-size: 1.5rem; color: #CBD5E0; cursor: pointer; width: 44px; height: 44px; }
.toggle.on { color: #F2A900; }
.switch { width: 50px; height: 28px; border-radius: 999px; border: 0; background: #CBD5E0; position: relative; cursor: pointer; }
.switch span { position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; transition: left .15s; }
.switch.on { background: var(--ok); }
.switch.on span { left: 25px; }
.edit-grid { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 22px; align-items: start; }
.dropzone { position: relative; border: 2px dashed var(--line); border-radius: var(--radius); padding: 20px; text-align: center; margin-bottom: 18px; transition: border-color .15s, background .15s; }
.dropzone.drag { border-color: var(--accent); background: var(--accent-soft); }
.dropzone input[type=file] { position: absolute; width: 1px; height: 1px; opacity: 0; }
.dropzone label { display: block; cursor: pointer; padding: 18px 10px; color: var(--ink-2); }
.dropzone label strong { color: var(--accent); }
.dropzone small { display: block; color: var(--muted); margin-top: .3rem; }
.dz-preview { display: grid; grid-template-columns: repeat(auto-fill, minmax(80px, 1fr)); gap: 8px; margin: 6px 0 12px; }
.dz-preview img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 8px; }
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; }
.photo-item { position: relative; border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; background: #fff; }
.photo-item.is-cover { border: 2px solid var(--accent); }
.photo-item img { width: 100%; aspect-ratio: 4/3; object-fit: cover; }
.caption-form { display: flex; gap: 6px; padding: 8px; }
.caption-form input { flex: 1; min-width: 0; border: 1px solid var(--line); border-radius: 8px; padding: .4rem .6rem; font: inherit; font-size: .85rem; }
.photo-actions { display: flex; gap: 6px; padding: 0 8px 8px; }
.photo-actions form { flex: 1; }
.photo-actions .btn { width: 100%; }
.danger-zone { border-color: #F5C6C6; }
.logo-preview { border-radius: var(--radius-sm); padding: 18px; margin-bottom: 1rem; }
.color-field { display: flex; gap: .5rem; margin-top: .3rem; }
.color-field input[type=color] { width: 60px; padding: 4px; flex-shrink: 0; cursor: pointer; }
.steps { padding-left: 1.2rem; color: var(--ink-2); }
.steps li { margin-bottom: .6rem; }
.checklist { list-style: none; padding: 0; margin: 0 0 1rem; }
.checklist li { padding: .35rem 0; font-weight: 600; }
.checklist .ok { color: var(--ok); } .checklist .bad { color: #C53030; }
.auth-bg { background: linear-gradient(135deg, var(--primary), var(--primary-dark)); }
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.auth-card { width: 100%; max-width: 420px; background: #fff; border-radius: 20px; padding: 32px; box-shadow: var(--shadow-lg); }
.auth-logo { background: var(--primary); border-radius: 14px; padding: 14px 18px; margin-bottom: 1.4rem; }
.brand-dark { color: var(--primary); margin-bottom: 1rem; }

/* ==========================================================================
   Responsive — tuned for tablets (iPad / Android, portrait + landscape) and laptops
   ========================================================================== */
@media (max-width: 1180px) {
  .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .nav { gap: .8rem; }
  .nav-links a { font-size: .95rem; }
  .listing-layout { grid-template-columns: 250px 1fr; gap: 22px; }
  .search-box { grid-template-columns: 1.4fr 1fr 1fr 1fr auto; }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .detail-grid { grid-template-columns: 1fr 340px; }
  .nav-links a { padding: .6rem .75rem; }
}

/* Tablet portrait: collapse nav and turn filters into a drawer */
@media (max-width: 960px) {
  .nav-toggle { display: inline-grid; }
  .nav-links {
    position: absolute; top: 100%; left: 0; right: 0; flex-direction: column; align-items: stretch; gap: 0;
    background: var(--primary); padding: 8px 16px 16px; box-shadow: 0 12px 24px rgba(0,0,0,.25); display: none;
  }
  .nav-links.open { display: flex; }
  .nav-links a { min-height: 56px; font-size: 1.05rem; border-radius: 10px; }
  .nav-tools { margin-left: auto; }
  .search-box { grid-template-columns: 1fr 1fr; }
  .sb-field.sb-wide { grid-column: 1 / -1; }
  .sb-field { border-right: 0 !important; border-bottom: 1px solid var(--line); }
  .sb-btn { grid-column: 1 / -1; }
  .listing-layout { grid-template-columns: 1fr; }
  .filter-toggle { display: inline-flex; }
  .filters {
    position: fixed; top: 0; bottom: 0; left: 0; width: min(380px, 88vw); z-index: 80; border-radius: 0;
    overflow-y: auto; transform: translateX(-105%); transition: transform .25s ease; padding-top: 12px;
  }
  .filters.open { transform: none; box-shadow: 0 0 0 100vmax rgba(0,0,0,.45); }
  .filters-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; color: var(--primary); font-size: 1.15rem; }
  .filters-head .icon-btn { background: var(--bg); color: var(--ink); }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .detail-grid { grid-template-columns: 1fr; }
  .detail-side { position: static; }
  .gallery-slide { aspect-ratio: 16 / 10; }
  .region-grid { grid-template-columns: 1fr 1fr 1fr; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .edit-grid { grid-template-columns: 1fr; }
}

@media (max-width: 820px) {
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .region-grid { grid-template-columns: 1fr; }
  .region-tile { min-height: 180px; }
}

@media (max-width: 560px) {
  .container { padding: 0 16px; }
  .nav { min-height: 64px; }
  .brand-logo { height: 36px; max-width: 160px; }
  .brand-text { font-size: 1rem; }
  .hero { padding: 44px 0 56px; }
  .search-box { grid-template-columns: 1fr; }
  .grid, .grid-3 { grid-template-columns: 1fr; }
  .price-panel { grid-template-columns: 1fr; }
  .facts div { grid-template-columns: 1fr; }
  .facts dt { padding-bottom: 4px; }
  .facts dd { padding-top: 4px; }
  .form-row { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr; }
  .gallery-nav { width: 44px; height: 44px; }
  .admin-search { margin-left: 0; width: 100%; }
  .admin-search input { width: 100%; min-width: 0; }
}

/* Touch devices: no sticky hover lift */
@media (hover: none) {
  .card:hover, .region-tile:hover, .type-tile:hover { transform: none; }
  .card:hover .card-media img { transform: none; }
}

/* ---------- Homepage banner (Admin > Branding > Homepage banner) ---------- */
.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; }

/* Full banner: the whole image is visible; a blurred copy fills the sides */
.hero--banner { padding: 28px 0 64px; background: var(--primary-dark); isolation: isolate; }
.hero--banner .hero-backdrop {
  position: absolute; inset: -40px; z-index: -1; background-size: cover; background-position: center;
  filter: blur(28px) brightness(.55) saturate(1.2); transform: scale(1.05);
}
.hero-banner-img {
  display: block; width: 100%; height: auto; max-height: 78vh; object-fit: contain;
  border-radius: 18px; box-shadow: 0 18px 50px rgba(0,0,0,.35); background: #fff;
}
.hero--banner .search-box { position: relative; z-index: 2; margin: 22px auto 0; }
.hero--banner .hero-stats { justify-content: center; }

/* Background mode: image behind the headline, darkened for readability */
.hero--background {
  background:
    linear-gradient(90deg, rgba(10,10,10,.82) 0%, rgba(10,10,10,.55) 55%, rgba(10,10,10,.25) 100%),
    var(--hero-img) center / cover no-repeat,
    var(--primary-dark);
  min-height: 560px; display: flex; align-items: center;
}
.hero--background h1 span { background: linear-gradient(transparent 62%, color-mix(in srgb, var(--primary) 85%, transparent) 62%); }

/* Branding page preview */
.hero-preview { border-radius: var(--radius-sm); overflow: hidden; border: 1px solid var(--line); margin-bottom: .8rem; background: var(--bg); }
.hero-preview img { width: 100%; max-height: 240px; object-fit: contain; }

@media (max-width: 960px) {
  .hero--banner { padding-top: 18px; }
  .hero-banner-img { border-radius: 14px; }
  .hero--banner .search-box { margin-top: 16px; }
}
@media (max-width: 560px) {
  .hero--banner .search-box { margin-top: 12px; }
  .hero-banner-img { border-radius: 10px; }
}
