/* ============================================================
   RESET & BASE
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --blue-dark:   #023e8a;
  --blue-main:   #0077b6;
  --blue-mid:    #0096c7;
  --blue-light:  #00b4d8;
  --blue-pale:   #90e0ef;
  --blue-ice:    #caf0f8;
  --bg:          #f0f8ff;
  --white:       #ffffff;
  --text-dark:   #1a2e3b;
  --text-mid:    #4a6274;
  --text-soft:   #7a95a5;
  --border:      rgba(0,119,182,0.15);
  --border-mid:  rgba(0,119,182,0.25);
  --shadow-sm:   0 2px 8px rgba(0,119,182,0.10);
  --shadow-md:   0 4px 16px rgba(0,119,182,0.15);
  --radius-sm:   8px;
  --radius-md:   12px;
  --radius-lg:   18px;
  --font:        'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --header-h:    60px;
  --bottom-h:    64px;
}

html, body {
  height: 100%;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text-dark);
  overscroll-behavior: none;
  -webkit-font-smoothing: antialiased;
}

button { font-family: var(--font); cursor: pointer; border: none; background: none; }
a { text-decoration: none; color: inherit; }
input, select, textarea { font-family: var(--font); }
img { max-width: 100%; display: block; }

/* ============================================================
   APP SHELL
   ============================================================ */
#app {
  display: flex;
  flex-direction: column;
  height: 100%;
  max-width: 480px;
  margin: 0 auto;
  position: relative;
  overflow: hidden;
  background: var(--white);
  box-shadow: 0 0 40px rgba(0,0,0,0.08);
}

/* ============================================================
   HEADER
   ============================================================ */
.app-header {
  height: var(--header-h);
  background: var(--blue-main);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  flex-shrink: 0;
  position: relative;
  z-index: 100;
}

.header-logo {
  display: flex;
  align-items: center;
  gap: 9px;
}

.header-logo-icon {
  width: 34px;
  height: 34px;
  background: rgba(255,255,255,0.2);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 18px;
}

.header-logo-text {
  color: white;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.3px;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.lang-switcher {
  display: flex;
  background: rgba(255,255,255,0.15);
  border-radius: 20px;
  padding: 3px;
  gap: 2px;
}

.lang-btn {
  background: none;
  border: none;
  color: rgba(255,255,255,0.7);
  font-size: 11px;
  font-weight: 600;
  padding: 3px 7px;
  border-radius: 14px;
  cursor: pointer;
  transition: all 0.15s;
}

.lang-btn.active {
  background: white;
  color: var(--blue-main);
}

.hamburger-btn {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 22px;
  background: rgba(255,255,255,0.15);
  border-radius: var(--radius-sm);
  transition: background 0.15s;
}

.hamburger-btn:active { background: rgba(255,255,255,0.25); }

/* ============================================================
   PAGES / SCROLL CONTAINER
   ============================================================ */
.page-container {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  background: var(--bg);
}

.page { display: none; }
.page.active { display: block; }

/* ============================================================
   HOME PAGE — HERO
   ============================================================ */
.hero {
  background: var(--blue-main);
  padding: 20px 16px 36px;
  position: relative;
}

.hero::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0; right: 0;
  height: 28px;
  background: var(--bg);
  border-radius: 50% 50% 0 0 / 100% 100% 0 0;
}

.hero-title {
  color: white;
  font-size: 21px;
  font-weight: 600;
  margin-bottom: 4px;
  letter-spacing: -0.3px;
}

.hero-sub {
  color: rgba(255,255,255,0.75);
  font-size: 13px;
  margin-bottom: 16px;
}

.search-wrap {
  background: white;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  padding: 0 14px;
  height: 46px;
  gap: 10px;
  box-shadow: var(--shadow-md);
}

.search-wrap i { color: var(--blue-main); font-size: 19px; flex-shrink: 0; }

.search-wrap input {
  flex: 1;
  border: none;
  outline: none;
  font-size: 14px;
  color: var(--text-dark);
  background: transparent;
}

.search-wrap input::placeholder { color: var(--text-soft); }

.search-wrap .search-clear {
  color: var(--text-soft);
  font-size: 18px;
  display: none;
  cursor: pointer;
}

/* ============================================================
   SECTION TITLES
   ============================================================ */
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 16px 10px;
}

.section-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--blue-main);
  text-transform: uppercase;
  letter-spacing: 0.6px;
}

.section-link {
  font-size: 12px;
  color: var(--blue-light);
  font-weight: 500;
}

/* ============================================================
   CATEGORY GRID
   ============================================================ */
.cat-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  padding: 0 16px 4px;
}

.cat-card {
  background: var(--white);
  border-radius: var(--radius-md);
  padding: 14px 12px;
  display: flex;
  align-items: center;
  gap: 11px;
  border: 1px solid var(--border);
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
  -webkit-tap-highlight-color: transparent;
}

.cat-card:active {
  border-color: var(--blue-mid);
  box-shadow: var(--shadow-sm);
}

.cat-icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 19px;
  flex-shrink: 0;
  background: var(--blue-ice);
  color: var(--blue-main);
}

.cat-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-dark);
  line-height: 1.3;
}

.cat-count {
  font-size: 11px;
  color: var(--blue-mid);
  margin-top: 2px;
}

/* ============================================================
   REGION FILTER TABS
   ============================================================ */
.region-tabs {
  display: flex;
  gap: 8px;
  padding: 0 16px 12px;
  overflow-x: auto;
  scrollbar-width: none;
}
.region-tabs::-webkit-scrollbar { display: none; }

.region-tab {
  padding: 7px 16px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
  border: 1px solid var(--border-mid);
  cursor: pointer;
  background: var(--white);
  color: var(--text-mid);
  white-space: nowrap;
  transition: all 0.15s;
  flex-shrink: 0;
}

.region-tab.active {
  background: var(--blue-main);
  color: white;
  border-color: var(--blue-main);
}

/* ============================================================
   LISTING CARDS
   ============================================================ */
.listings-list {
  padding: 0 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.listing-card {
  background: var(--white);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  padding: 12px;
  display: flex;
  gap: 12px;
  cursor: pointer;
  transition: box-shadow 0.15s, border-color 0.15s;
  -webkit-tap-highlight-color: transparent;
}

.listing-card:active {
  box-shadow: var(--shadow-sm);
  border-color: var(--blue-pale);
}

.listing-logo {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
  overflow: hidden;
  background: var(--blue-ice);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--blue-main);
  font-size: 24px;
}

.listing-logo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.listing-body { flex: 1; min-width: 0; }

.listing-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-dark);
  margin-bottom: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.listing-meta {
  font-size: 12px;
  color: var(--blue-mid);
  margin-bottom: 5px;
}

.listing-location {
  font-size: 12px;
  color: var(--text-soft);
  display: flex;
  align-items: center;
  gap: 4px;
}

.listing-location i { font-size: 13px; }

.lang-badges {
  display: flex;
  gap: 4px;
  margin-top: 5px;
  flex-wrap: wrap;
}

.lang-badge {
  font-size: 10px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--blue-ice);
  color: var(--blue-dark);
}

.listing-actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
  justify-content: center;
  flex-shrink: 0;
}

.action-btn {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
  transition: opacity 0.15s;
}

.action-btn:active { opacity: 0.7; }
.action-phone { background: var(--blue-ice); color: var(--blue-main); }
.action-wa    { background: #e8f8ef; color: #25D366; }

/* ============================================================
   BOTTOM NAV
   ============================================================ */
.bottom-nav {
  height: var(--bottom-h);
  background: var(--white);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-around;
  flex-shrink: 0;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

.nav-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 6px 16px;
  color: var(--text-soft);
  font-size: 10px;
  font-weight: 500;
  border-radius: var(--radius-sm);
  transition: color 0.15s;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.nav-btn i { font-size: 22px; }

.nav-btn.active { color: var(--blue-main); }

/* ============================================================
   HAMBURGER MENU OVERLAY
   ============================================================ */
.menu-overlay {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,20,40,0.55);
  z-index: 200;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s;
}

.menu-overlay.open {
  opacity: 1;
  pointer-events: all;
}

.menu-panel {
  position: absolute;
  top: 0; right: 0; bottom: 0;
  width: 78%;
  max-width: 300px;
  background: var(--white);
  transform: translateX(100%);
  transition: transform 0.25s cubic-bezier(0.4,0,0.2,1);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

.menu-overlay.open .menu-panel {
  transform: translateX(0);
}

.menu-header {
  background: var(--blue-main);
  padding: 20px 20px 20px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.menu-header-icon {
  width: 40px;
  height: 40px;
  background: rgba(255,255,255,0.2);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 22px;
}

.menu-header-text { color: white; }
.menu-header-text .title { font-size: 16px; font-weight: 600; }
.menu-header-text .sub { font-size: 12px; opacity: 0.75; margin-top: 2px; }

.menu-section-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-soft);
  text-transform: uppercase;
  letter-spacing: 0.7px;
  padding: 16px 20px 6px;
}

.menu-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 13px 20px;
  cursor: pointer;
  transition: background 0.12s;
  -webkit-tap-highlight-color: transparent;
}

.menu-item:active { background: var(--bg); }

.menu-item-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background: var(--blue-ice);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--blue-main);
  font-size: 18px;
  flex-shrink: 0;
}

.menu-item-icon.green { background: #e8f8ef; color: #1a8a4a; }
.menu-item-icon.orange { background: #fff3e8; color: #d07020; }
.menu-item-icon.purple { background: #f0ecff; color: #6040b0; }

.menu-item-label {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-dark);
}

.menu-item-sub {
  font-size: 12px;
  color: var(--text-soft);
  margin-top: 1px;
}

.menu-divider {
  height: 1px;
  background: var(--border);
  margin: 6px 20px;
}

.menu-lang-row {
  display: flex;
  gap: 8px;
  padding: 12px 20px;
}

.menu-lang-btn {
  flex: 1;
  padding: 9px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-mid);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-mid);
  background: var(--white);
  cursor: pointer;
  transition: all 0.15s;
  text-align: center;
}

.menu-lang-btn.active {
  background: var(--blue-main);
  color: white;
  border-color: var(--blue-main);
}

.menu-footer {
  margin-top: auto;
  padding: 16px 20px;
  border-top: 1px solid var(--border);
}

.menu-footer-text {
  font-size: 11px;
  color: var(--text-soft);
  text-align: center;
  line-height: 1.6;
}

/* ============================================================
   SEARCH RESULTS
   ============================================================ */
.search-results-page {
  padding: 16px;
}

.search-results-title {
  font-size: 13px;
  color: var(--text-mid);
  margin-bottom: 14px;
}

.no-results {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-soft);
}

.no-results i {
  font-size: 48px;
  color: var(--blue-pale);
  display: block;
  margin-bottom: 12px;
}

.no-results p {
  font-size: 14px;
}

/* ============================================================
   CATEGORY PAGE
   ============================================================ */
.cat-page-header {
  background: var(--blue-main);
  padding: 16px 16px 28px;
  position: relative;
}

.cat-page-header::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0; right: 0;
  height: 24px;
  background: var(--bg);
  border-radius: 50% 50% 0 0 / 100% 100% 0 0;
}

.back-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  color: rgba(255,255,255,0.85);
  font-size: 14px;
  margin-bottom: 12px;
  cursor: pointer;
}

.back-btn i { font-size: 20px; }

.cat-page-title {
  color: white;
  font-size: 20px;
  font-weight: 600;
}

.subcat-chips {
  display: flex;
  gap: 8px;
  padding: 14px 16px 4px;
  overflow-x: auto;
  scrollbar-width: none;
}
.subcat-chips::-webkit-scrollbar { display: none; }

.subcat-chip {
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
  border: 1px solid var(--border-mid);
  background: var(--white);
  color: var(--text-mid);
  white-space: nowrap;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.15s;
}

.subcat-chip.active {
  background: var(--blue-main);
  color: white;
  border-color: var(--blue-main);
}

/* ============================================================
   ABOUT PAGE
   ============================================================ */
.about-page { padding: 24px 16px; }
.about-page h2 { font-size: 20px; font-weight: 600; color: var(--blue-main); margin-bottom: 12px; }
.about-page p { font-size: 14px; color: var(--text-mid); line-height: 1.7; margin-bottom: 14px; }

.about-highlight {
  background: var(--blue-ice);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 16px;
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.about-highlight i { font-size: 22px; color: var(--blue-main); margin-top: 1px; flex-shrink: 0; }
.about-highlight p { margin-bottom: 0; color: var(--text-dark); font-size: 13px; }

.cta-btn {
  display: block;
  background: var(--blue-main);
  color: white;
  border-radius: var(--radius-md);
  padding: 15px 20px;
  font-size: 15px;
  font-weight: 600;
  text-align: center;
  cursor: pointer;
  transition: opacity 0.15s;
  border: none;
  width: 100%;
  margin-top: 8px;
}

.cta-btn:active { opacity: 0.85; }

/* ============================================================
   EMPTY STATE / LOADING
   ============================================================ */
.loading-state {
  text-align: center;
  padding: 40px 24px;
  color: var(--text-soft);
}

.loading-state i {
  font-size: 36px;
  color: var(--blue-pale);
  display: block;
  margin-bottom: 10px;
  animation: spin 1s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ============================================================
   BOTTOM SPACER
   ============================================================ */
.bottom-spacer { height: 24px; }
