:root {
  --bg-page: #f8f9fa;
  --bg-surface: #ffffff;
  --text-main: #111827;
  --text-muted: #6b7280;
  --border: #e5e7eb;
  --primary: #185f9d;
  --primary-hover: #124a7a;
  --radius: 12px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; background: var(--bg-page); color: var(--text-main); line-height: 1.5; -webkit-font-smoothing: antialiased; padding-bottom: 0; }
a { text-decoration: none; color: inherit; }

.navbar { background: var(--bg-surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 20; }
.nav-container { max-width: 1120px; margin: 0 auto; padding: 0 20px; height: 64px; display: flex; align-items: center; justify-content: space-between; }
.logo { font-size: 1.55rem; font-weight: 700; display: inline-flex; align-items: center; gap: 10px; line-height: 1; }
.logo-icon { font-family: "AppleMyungjo", "Palatino Linotype", Georgia, serif; width: 36px; height: 36px; border-radius: 9px; background: var(--primary); color: #ffffff; font-size: 1.45rem; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; line-height: 1; padding-top: 2px; box-shadow: 0 2px 6px rgba(24, 95, 157, 0.28); }
.logo-word { font-family: "AppleMyungjo", "Palatino Linotype", Georgia, serif; display: inline-flex; align-items: flex-start; line-height: 1; letter-spacing: 0.1em; padding-top: 3px; }
.logo-sub { font-size: 0.65rem; font-weight: 600; color: inherit; vertical-align: super; margin-left: 1px; letter-spacing: 0.03em; line-height: 1; }
.nav-actions { display: flex; align-items: center; gap: 14px; }

.lang-switch { display: inline-flex; background: #f3f4f6; border: 1px solid var(--border); border-radius: 8px; padding: 2px; gap: 2px; }
.lang-opt { border: none; background: transparent; color: var(--text-muted); font-size: 0.78rem; font-weight: 700; padding: 4px 9px; border-radius: 6px; cursor: pointer; }
.lang-opt.active { background: var(--primary); color: #ffffff; }

.user-avatar-btn { width: 38px; height: 38px; border-radius: 50%; background: #f3f4f6; border: 1px solid var(--border); color: var(--text-main); display: inline-flex; align-items: center; justify-content: center; }
.user-avatar-btn:hover { background: var(--primary); border-color: var(--primary); color: #ffffff; }

.hero { background: var(--bg-surface); border-bottom: 1px solid var(--border); padding: 48px 20px; text-align: center; }
.hero-inner { max-width: 680px; margin: 0 auto; }
.hero h1 { font-size: 1.95rem; font-weight: 700; letter-spacing: -0.02em; margin-bottom: 8px; }
.hero p { color: var(--text-muted); margin-bottom: 24px; }

.search-box { display: flex; align-items: center; background: var(--bg-surface); border: 1px solid #d1d5db; border-radius: 14px; padding: 6px 6px 6px 16px; box-shadow: 0 2px 6px rgba(0,0,0,0.04); }
.search-box:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(24,95,157,0.16); }
.search-box input { border: none; outline: none; width: 100%; font-size: 1rem; color: var(--text-main); background: transparent; }
.search-btn { background: var(--text-main); color: #ffffff; border: none; border-radius: 10px; padding: 10px 14px; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.search-btn:hover { background: #374151; }

.filter-row { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.pill { border: none; background: #f3f4f6; color: var(--text-muted); padding: 6px 14px; border-radius: 999px; font-size: 0.85rem; font-weight: 500; cursor: pointer; }
.pill:hover { background: #e5e7eb; }
.pill.active { background: var(--text-main); color: #ffffff; }

.container { max-width: 1120px; margin: 0 auto; padding: 36px 20px; }
.section-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; }
.section-header h2 { font-size: 1.15rem; font-weight: 600; }
.section-header span { font-size: 0.85rem; color: var(--text-muted); }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(310px, 1fr)); gap: 24px; align-items: stretch; }

.card { background: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; position: relative; }
.card { transition: box-shadow 0.18s ease; }
.card:hover { box-shadow: 0 10px 26px rgba(17, 24, 39, 0.10); }

.card-media { height: 185px; background: #e5e7eb; position: relative; flex-shrink: 0; }
.card-media img { width: 100%; height: 100%; object-fit: cover; display: block; }
.card-placeholder { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, #eff6ff, #dbeafe); color: var(--primary); font-family: "AppleMyungjo", "Palatino Linotype", Georgia, serif; font-weight: 700; font-size: 1.45rem; letter-spacing: 0.1em; padding-left: 0.1em; }

.badge { position: absolute; top: 12px; left: 12px; font-size: 0.75rem; font-weight: 600; padding: 4px 10px; border-radius: 6px; }
.badge-business { background: #eff6ff; color: #1d4ed8; }
.badge-classified { background: #ecfdf5; color: #047857; }
.badge-event { background: #fffbeb; color: #b45309; }
.badge-blog { background: #f3e8ff; color: #7e22ce; }

.price-tag { position: absolute; bottom: 12px; left: 12px; background: rgba(17,24,39,0.9); color: #ffffff; font-weight: 600; font-size: 0.88rem; padding: 4px 10px; border-radius: 6px; }
.date-badge { position: absolute; top: 12px; right: 12px; background: #ffffff; border-radius: 8px; padding: 4px 10px; text-align: center; box-shadow: 0 2px 6px rgba(0,0,0,0.08); }
.date-badge .month { display: block; font-size: 0.65rem; font-weight: 700; color: var(--primary); text-transform: uppercase; }
.date-badge .day { display: block; font-size: 0.95rem; font-weight: 700; line-height: 1.1; }

.card-body { padding: 16px; flex: 1; display: flex; flex-direction: column; justify-content: space-between; }
.card-meta { display: flex; justify-content: space-between; font-size: 0.8rem; color: var(--text-muted); margin-bottom: 6px; }
.status-open { color: #059669; font-weight: 500; }
.card-title { font-size: 1.05rem; font-weight: 600; margin-bottom: 6px; }
.card-desc { font-size: 0.9rem; color: var(--text-muted); margin-bottom: 16px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.card-footer { border-top: 1px solid #f3f4f6; padding-top: 12px; display: flex; justify-content: space-between; align-items: center; font-size: 0.8rem; color: var(--text-muted); }
.text-highlight { color: var(--text-main); font-weight: 600; }
.text-free { color: #059669; font-weight: 600; }

.floating-ai-btn { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); z-index: 50; display: inline-flex; align-items: center; gap: 8px; background: var(--primary); color: #ffffff; font-size: 0.92rem; font-weight: 600; padding: 13px 22px; border-radius: 999px; white-space: nowrap; box-shadow: 0 10px 25px rgba(24,95,157,0.35); }
.floating-ai-btn:hover { background: var(--primary-hover); }
.ai-spark { font-size: 1.25rem; line-height: 1; display: inline-flex; align-items: center; justify-content: center; transform: translateY(-1px); }

.search-box.error { border-color: #ef4444; box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.16); }
.clear-btn { display: none; border: none; background: transparent; color: var(--text-muted); font-size: 1.25rem; line-height: 1; padding: 0 10px; cursor: pointer; }
.clear-btn:hover { color: var(--text-main); }

.view-all-link { font-size: 0.85rem; font-weight: 500; color: var(--text-muted); display: inline-flex; align-items: center; gap: 4px; }
.view-all-link:hover { color: var(--text-main); }

.btn-load-more { display: inline-flex; align-items: center; gap: 6px; background: var(--bg-surface); border: 1px solid #d1d5db; color: var(--text-main); font-size: 0.9rem; font-weight: 600; padding: 10px 24px; border-radius: 999px; cursor: pointer; transition: all 0.15s ease; }
.btn-load-more:hover { border-color: var(--primary); color: var(--primary); box-shadow: 0 4px 12px rgba(0,0,0,0.05); }

.cat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
@media (max-width: 960px) { .cat-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 640px) {
  .cat-grid {
    grid-template-columns: unset;
    grid-auto-flow: column;
    grid-template-rows: repeat(2, 1fr);
    grid-auto-columns: minmax(195px, 72%);
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    gap: 10px;
    padding-bottom: 8px;
  }
  .cat-grid::-webkit-scrollbar { height: 4px; }
  .cat-grid::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 999px; }
}

.cat-card { background: var(--bg-surface); border: 1px solid var(--border); border-radius: 12px; padding: 13px 14px; display: flex; align-items: center; gap: 12px; cursor: pointer; text-align: left; scroll-snap-align: start; transition: box-shadow 0.16s ease, border-color 0.16s ease; }
.cat-card:hover { box-shadow: 0 6px 18px rgba(17,24,39,0.07); }
.cat-card.active { border-color: var(--primary); background: #eff6ff; }
.cat-icon { width: 38px; height: 38px; border-radius: 10px; background: #eff6ff; color: var(--primary); display: inline-flex; align-items: center; justify-content: center; font-size: 1.15rem; flex-shrink: 0; }
.cat-info { min-width: 0; flex: 1; }
.cat-name { font-size: 0.88rem; font-weight: 600; color: var(--text-main); line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.cat-count { font-size: 0.75rem; color: var(--text-muted); margin-top: 2px; }

.empty-ai-box { grid-column: 1 / -1; background: var(--bg-surface); border: 1px dashed #cbd5e1; border-radius: 14px; padding: 32px 24px; text-align: center; }
.empty-ai-box h3 { font-size: 1.05rem; font-weight: 600; margin-bottom: 6px; }
.empty-ai-box p { font-size: 0.9rem; color: var(--text-muted); max-width: 480px; margin: 0 auto 18px; }

.blog-section { margin-top: 48px; }
@media (max-width: 640px) { .blog-section { margin-top: 48px; } }

.ad-banner-wrap { margin: 48px auto 0; width: 100%; }
.ad-placeholder { width: 100%; min-height: 90px; background: #f3f4f6; border: 1px dashed #cbd5e1; border-radius: 12px; display: flex; align-items: center; justify-content: center; padding: 12px; text-align: center; }
.ad-tag { font-size: 0.75rem; font-weight: 600; color: var(--text-muted); letter-spacing: 0.03em; text-transform: uppercase; }
@media (max-width: 640px) {
  .ad-banner-wrap { margin-top: 32px; }
  .ad-placeholder { min-height: 100px; }
  .blog-section { margin-top: 32px; }
}

.site-footer { background: var(--bg-surface); border-top: 1px solid var(--border); margin-top: 64px; padding: 28px 20px 96px; }
.footer-container { max-width: 1120px; margin: 0 auto; display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 18px; }
.footer-cta-btn { display: inline-flex; align-items: center; justify-content: center; border: 1px solid #d1d5db; background: var(--bg-surface); color: var(--text-main); font-size: 0.88rem; font-weight: 600; padding: 9px 18px; border-radius: 10px; transition: border-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease; }
.footer-cta-btn:hover { border-color: var(--primary); color: var(--primary); box-shadow: 0 3px 10px rgba(0,0,0,0.04); }
.footer-links { display: flex; align-items: center; flex-wrap: wrap; gap: 20px; font-size: 0.86rem; color: var(--text-muted); }
.footer-links a:hover { color: var(--text-main); }
.footer-select { display: none; appearance: none; -webkit-appearance: none; border: none; background: transparent; color: var(--text-main); font-size: 0.9rem; font-weight: 600; padding: 6px 12px; cursor: pointer; font-family: inherit; text-align: center; text-align-last: center; }
.footer-select:hover, .footer-select:focus { color: var(--primary); outline: none; }
@media (max-width: 720px) {
  .footer-container { justify-content: center; }
  .footer-cta-btn, .footer-links { display: none; }
  .footer-select { display: inline-block; }
}

.footer-copy { max-width: 1120px; margin: 22px auto 0; padding-top: 16px; border-top: 1px solid #f3f4f6; text-align: center; font-size: 0.78rem; color: var(--text-muted); }

.app-banner { margin-top: 48px; background: #f3f4f6; border: 1px solid var(--border); border-radius: 12px; padding: 18px 24px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.app-banner-title { font-size: 1rem; font-weight: 600; color: var(--text-main); }
.app-badges { display: flex; align-items: center; gap: 12px; }
.store-badge { display: inline-flex; align-items: center; gap: 8px; background: var(--text-main); color: #ffffff; font-size: 0.86rem; font-weight: 600; padding: 9px 16px; border-radius: 10px; transition: background 0.15s ease; }
.store-badge:hover { background: var(--primary); }
@media (max-width: 640px) {
  .app-banner { flex-direction: column; text-align: center; padding: 20px 16px; }
  .app-badges { width: 100%; justify-content: center; flex-wrap: wrap; }
}

.search-top-bar { background: var(--bg-surface); border-bottom: 1px solid var(--border); padding: 28px 20px 22px; }
.search-pills { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.s-pill { border: 1px solid var(--border); background: #f3f4f6; color: var(--text-muted); padding: 6px 14px; border-radius: 999px; font-size: 0.84rem; font-weight: 600; cursor: pointer; transition: all 0.15s ease; }
.s-pill:hover { background: #e5e7eb; color: var(--text-main); }
.s-pill.active { background: var(--primary); border-color: var(--primary); color: #ffffff; }

.filter-text-btn { border: none; background: transparent; color: var(--text-muted); font-size: 0.85rem; font-weight: 500; cursor: pointer; font-family: inherit; display: inline-flex; align-items: center; gap: 4px; padding: 4px 0; }
.filter-text-btn:hover { color: var(--text-main); }
.filter-text-btn.active-filter { color: var(--primary); font-weight: 600; }

.filter-drawer { max-height: 0; overflow: hidden; opacity: 0; transition: max-height 0.25s ease, opacity 0.2s ease, margin-bottom 0.25s ease; margin-bottom: 0; }
.filter-drawer.open { max-height: 850px; opacity: 1; margin-bottom: 22px; }
.filter-drawer-inner { background: var(--bg-surface); border: 1px solid var(--border); border-radius: 12px; padding: 14px; display: flex; flex-wrap: wrap; gap: 8px; }
.f-chip { border: 1px solid var(--border); background: #f8f9fa; color: var(--text-main); font-size: 0.82rem; font-weight: 500; padding: 6px 12px; border-radius: 999px; cursor: pointer; font-family: inherit; transition: all 0.14s ease; }
.f-chip:hover { border-color: var(--primary); color: var(--primary); }
.f-chip.active { background: var(--primary); border-color: var(--primary); color: #ffffff; font-weight: 600; }

.user-avatar-btn.logged-in { background: var(--primary); border-color: var(--primary); color: #ffffff; font-weight: 700; font-size: 0.92rem; }

/* Desktop vertical row layout for Search, View All, Categories & Blog (mobile stays stacked card) */
@media (min-width: 769px) {
  .grid.list-grid { grid-template-columns: 1fr; gap: 16px; }
  .grid.list-grid .card { flex-direction: row; align-items: stretch; height: 185px; }
  .grid.list-grid .card-media {
    width: 265px !important;
    min-width: 265px !important;
    max-width: 265px !important;
    height: 185px !important;
    flex-shrink: 0;
  }
  .grid.list-grid .card-media img,
  .grid.list-grid .card-placeholder {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover;
  }
  .grid.list-grid .card-body { flex: 1; min-width: 0; padding: 18px 22px; justify-content: center; }
  .grid.list-grid .card-title { font-size: 1.12rem; }
  .grid.list-grid .card-desc { -webkit-line-clamp: 2; max-width: 720px; }
}


/* Promoted listing highlight in Search, Category & Directory views (not homepage) */
.grid.list-grid .card.promoted {
  border: 1.5px solid #f59e0b;
  box-shadow: 0 8px 24px rgba(245, 158, 11, 0.16), 0 2px 6px rgba(245, 158, 11, 0.08);
  background: linear-gradient(180deg, #fffbeb 0%, #ffffff 36%);
}
.grid.list-grid .card.promoted:hover {
  border-color: #d97706;
  box-shadow: 0 12px 28px rgba(245, 158, 11, 0.24), 0 4px 10px rgba(245, 158, 11, 0.12);
}


/* === ZING NATIVE APP (iOS & Android Capacitor) SAFE AREAS & POLISH === */
html.is-native-app #app-banner-wrap { display: none !important; }
@supports (padding-top: env(safe-area-inset-top)) {
  .navbar {
    padding-top: env(safe-area-inset-top);
  }
  body {
    padding-bottom: env(safe-area-inset-bottom);
  }
  .floating-ai-btn {
    bottom: calc(20px + env(safe-area-inset-bottom)) !important;
  }
}
