/* =========================================================
   Typography: ITC Fenice Std (Aldo Novarese) + Noto Serif Thai
   Bespoke Luxury Real Estate Editorial Aesthetic
   ========================================================= */
@font-face {
  font-family: "Fenice Std";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../fonts/FeniceStd-Regular.woff2") format("woff2"),
       url("../fonts/FeniceStd-Regular.woff") format("woff");
}

@font-face {
  font-family: "Fenice Std";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("../fonts/FeniceStd-Bold.woff2") format("woff2"),
       url("../fonts/FeniceStd-Bold.woff") format("woff");
}

@font-face {
  font-family: "Fenice Std";
  font-style: normal;
  font-weight: 800;
  font-display: swap;
  src: url("../fonts/FeniceStd-Bold.woff2") format("woff2"),
       url("../fonts/FeniceStd-Bold.woff") format("woff");
}

:root {
  --font-editorial: "Fenice Std", "Noto Serif Thai", "Pridi", "Bodoni MT", "Didot", Georgia, serif;
}

body:not(.member-portal-body) {
  font-family: "Fenice Std", "Noto Serif Thai", "Prompt", "Inter", -apple-system, system-ui, serif !important;
}

body:not(.member-portal-body) h1,
body:not(.member-portal-body) h2,
body:not(.member-portal-body) h3,
body:not(.member-portal-body) h4,
body:not(.member-portal-body) h5,
body:not(.member-portal-body) h6,
body:not(.member-portal-body) .section-title,
body:not(.member-portal-body) .hero-title,
body:not(.member-portal-body) .card-title,
body:not(.member-portal-body) .site-shell-title,
body:not(.member-portal-body) .dash-hero h1,
body:not(.member-portal-body) .stat-card-value {
  font-family: "Fenice Std", "Noto Serif Thai", "Pridi", serif !important;
  letter-spacing: -0.015em;
}

/* Never display floating controls on home page, search catalog, category listing, property detail, forms, or admin workspace */
body.home-page .site-controls,
body.page-home .site-controls,
body.search-page-body .site-controls,
body:has(.search-page) .site-controls,
body.page-category .site-controls,
body.page-property .site-controls,
body.page-project .site-controls,
body.member-portal-body .site-controls,
body:has(.portal-workspace) .site-controls,
body:has(.project-main) .site-controls,
body:has([data-property-carousel]) .site-controls,
body:has(#propertyGalleryTrack) .site-controls,
body.has-admin-sidebar .site-controls,
body:has(.admin-sidebar) .site-controls,
body:has(.admin-desktop-navbar) .site-controls,
body:has(.dd-navbar) .site-controls,
body:has(.dd-hero) .site-controls,
body:has(.member-edit-page) .site-controls,
body:has(.listing-form) .site-controls,
.site-controls.home-hidden {
  display: none !important;
}

.site-controls {
  position: fixed;
  left: 14px;
  right: auto;
  bottom: calc(14px + env(safe-area-inset-bottom, 0px));
  z-index: 1000;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  width: auto;
  max-width: max-content;
}

.site-control-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 0 14px;
  border: 1px solid rgba(197, 160, 89, 0.4);
  border-radius: 999px;
  background: rgba(11, 28, 51, 0.9);
  backdrop-filter: blur(12px) saturate(1.4);
  -webkit-backdrop-filter: blur(12px) saturate(1.4);
  color: #E2E8F0;
  box-shadow: 0 4px 16px rgba(6, 15, 28, 0.28);
  font: 700 12.5px/1.2 "Prompt", "Inter", system-ui, sans-serif;
  text-decoration: none;
  cursor: pointer;
  transition: all .2s ease;
  white-space: nowrap;
}

.site-control-button:hover {
  background: #0B1C33;
  border-color: #C5A059;
  color: #C5A059;
  box-shadow: 0 6px 20px rgba(197, 160, 89, 0.25);
  transform: translateY(-1px);
}

.cookie-consent {
  position: fixed;
  z-index: 9998;
  right: 16px;
  /* เคยใช้ bottom:74px เพื่อหลบปุ่ม site-controls แต่ดันลอยขึ้นไปบังการ์ด/
     กล่องค้นหาที่อยู่กลางจอ — ตอนนี้ชิดขอบล่างและย่อลง (ปุ่ม site-controls อยู่มุมซ้าย) */
  bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  width: min(340px, calc(100vw - 24px));
  max-height: 46vh;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 15px 16px;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  background: #fff;
  color: #24384b;
  box-shadow: 0 12px 38px rgba(15, 35, 55, .2);
  font: 13.5px/1.55 "Prompt", "Inter", system-ui, sans-serif;
  -webkit-tap-highlight-color: transparent;
}

@media (max-width: 480px) {
  .cookie-consent {
    right: 10px;
    left: 10px;
    width: auto;
    max-height: 40vh;
    padding: 13px 14px;
    /* ยกขึ้นเหนือ glass footnavbar (สูง ~67px + 10px เว้นล่าง) */
    bottom: calc(88px + env(safe-area-inset-bottom, 0px));
  }
}

/* ปุ่มใน banner: ให้สูง 44px แตะง่าย */
.cookie-consent-actions button,
.cookie-consent button,
.cookie-consent .btn {
  min-height: 44px;
  border-radius: 12px;
  -webkit-tap-highlight-color: transparent;
}
.cookie-consent button:active,
.cookie-consent .btn:active { transform: scale(.97); }

.cookie-consent[hidden] { display: none; }

/* หน้า login/register: กล่องฟอร์มอยู่กึ่งกลางจอและยาวเกือบเต็มความสูง
   banner มุมขวาล่างจึงทับปุ่ม Facebook/LINE — ย่อ banner และชิดขอบล่างมากขึ้น */
.login-wrap ~ .cookie-consent,
.auth-page ~ .cookie-consent,
body:has(.login-wrap) .cookie-consent {
  width: min(340px, calc(100vw - 24px));
  right: 12px;
  bottom: 12px;
  padding: 14px;
  border-radius: 14px;
  max-height: 42vh;
}
@media (max-width: 480px) {
  body:has(.login-wrap) .cookie-consent {
    width: calc(100vw - 24px);
    max-height: 38vh;
  }
}
.cookie-consent h2 { margin: 0 0 8px; color: #2b2150; font-size: 18px; }
.cookie-consent p { margin: 0 0 12px; }
.cookie-consent .cookie-consent-error { color: #b42318; font-weight: 700; }
.cookie-consent-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.cookie-consent-actions button {
  flex: 1 1 170px;
  min-height: 42px;
  padding: 9px 12px;
  border: 1px solid #dce2e9;
  border-radius: 10px;
  background: #fff;
  color: #2b2150;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}
.cookie-consent-actions .cookie-consent-accept { border-color: #ef8950; background: #ef8950; color: #fff; }
.cookie-consent-actions .cookie-consent-accept:hover { border-color:#d96d39; background:#d96d39; }
.cookie-consent-actions button:disabled { cursor: wait; opacity: .65; }

@media (max-width: 480px) {
  .site-controls { right: 12px; bottom: 12px; }
  .site-control-button { min-height: 40px; padding: 0 13px; }
  .cookie-consent { right: 12px; bottom: 12px; width: calc(100vw - 24px); padding: 16px; }
  .cookie-consent-actions button { flex-basis: 100%; }
}

/* =========================================================
   KASA Logo Display Rules (Global in site-controls.css)
   Ensures only one logo is shown even if style.css is not loaded
   ========================================================= */
.kasa-logo-img--light { display: block !important; height: 52px; width: auto; max-width: 220px; object-fit: contain; }
.kasa-logo-img--dark { display: none !important; height: 52px; width: auto; max-width: 220px; object-fit: contain; }

/* Dark mode / dark background surfaces */
.kasa-logo--dark .kasa-logo-img--light,
.sp-logo--dark .kasa-logo-img--light,
.admin-sidebar-brand .kasa-logo-img--light,
.admin-navbar-brand .kasa-logo-img--light,
.admin-desktop-navbar .kasa-logo-img--light,
.site-shell-nav .kasa-logo-img--light,
.site-header .kasa-logo-img--light,
.site-shell-drawer-footer .kasa-logo-img--light,
.seo-footer .kasa-logo-img--light {
  display: none !important;
}

.kasa-logo--dark .kasa-logo-img--dark,
.sp-logo--dark .kasa-logo-img--dark,
.admin-sidebar-brand .kasa-logo-img--dark,
.admin-navbar-brand .kasa-logo-img--dark,
.admin-desktop-navbar .kasa-logo-img--dark,
.site-shell-nav .kasa-logo-img--dark,
.site-header .kasa-logo-img--dark,
.site-shell-drawer-footer .kasa-logo-img--dark,
.seo-footer .kasa-logo-img--dark {
  display: block !important;
}

/* The mobile drawer lives inside <header class="site-header"> but sits on a
   white panel, so it must keep the DARK logo even though its ancestor is the
   dark header. Matches index.php, where the drawer is outside the header. */
.mobile-drawer .kasa-logo-img--light { display: block !important; }
.mobile-drawer .kasa-logo-img--dark  { display: none !important; }

/* =========================================================
   KASA Luxury Logo Accent Glow & Enhancements (disabled for clean look)
   ========================================================= */
.kasa-logo-glow {
  display: none !important;
}

/* Prevent logo glow pseudo/child elements from creating horizontal scrollbars on narrow screens */
.kasa-logo, .sp-logo { position: relative; max-width: 100%; }
