/* /assets/css/bottom_nav.css — bottom nav + safe-area (smart) */

:root {
  --bottom-nav-height: 62px;
  --safe-bottom-native: env(safe-area-inset-bottom, 0px);
  --safe-bottom: var(--safe-bottom-native);
  --lk-bottom-nav-min-safe: 0px;
  --lk-bottom-nav-owner-strip-h: 0px;
  --lk-bottom-nav-extra-lift: 0px;
  --lk-bottom-nav-hide-y: calc(100% + var(--safe-bottom, 0px) + var(--lk-bottom-nav-owner-strip-h, 0px) + 36px);
  /* LK24H_BOTTOM_NAV_SAFE_CONTENT_RESERVE_V20260613 */
  --lk-bottom-nav-content-gap: 30px;
  --lk-bottom-nav-total-height: calc(var(--bottom-nav-height) + var(--lk-bottom-nav-owner-strip-h) + var(--safe-bottom) + var(--lk-bottom-nav-extra-lift));
  --lk-bottom-nav-content-reserve: calc(var(--lk-bottom-nav-measured-height, var(--lk-bottom-nav-total-height)) + var(--lk-bottom-nav-content-gap));
  --bottom-nav-side-gap: 4px;
  --bottom-nav-active-color: #c62828;
  --bottom-nav-icon-size: 22px;
  --bottom-nav-label-size: 11px;
}

.bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  height: calc(var(--bottom-nav-height) + var(--lk-bottom-nav-owner-strip-h) + var(--safe-bottom) + var(--lk-bottom-nav-extra-lift));
  padding-bottom: calc(var(--safe-bottom) + var(--lk-bottom-nav-extra-lift));
  background: rgba(255, 255, 255, 0.98);
  border-top: 1px solid rgba(15, 23, 42, 0.08);
  box-shadow: 0 -10px 28px rgba(15, 23, 42, 0.08);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 9000;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  will-change: transform, opacity;
  transform: translateY(0);
  opacity: 1;
  transition: transform .22s cubic-bezier(.2,.7,.2,1), opacity .18s ease, box-shadow .18s ease;
}

.bottom-nav .nav-inner {
  height: var(--bottom-nav-height);
  flex: 0 0 var(--bottom-nav-height);
  display: flex;
  justify-content: space-between;
  align-items: stretch;
  gap: 2px;
  padding: 4px var(--bottom-nav-side-gap) 0;
}

.bn-owner-strip {
  display: none;
  height: var(--lk-bottom-nav-owner-strip-h);
  min-height: var(--lk-bottom-nav-owner-strip-h);
  align-items: center;
  justify-content: center;
  padding: 0 12px;
  box-sizing: border-box;
  color: #9ca3af;
  font-size: 10px;
  line-height: 1;
  letter-spacing: .01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: none;
  user-select: none;
}

html.has-bottom-nav body {
  padding-bottom: var(--lk-bottom-nav-content-reserve);
  scroll-padding-bottom: var(--lk-bottom-nav-content-reserve);
}

html.has-bottom-nav.has-bottom-nav-spacer body {
  padding-bottom: 0;
}

html.has-bottom-nav,
html.has-bottom-nav body {
  scroll-padding-bottom: var(--lk-bottom-nav-content-reserve);
}

.lk-bottom-nav-content-spacer {
  display: block;
  width: 100%;
  height: var(--lk-bottom-nav-content-reserve);
  min-height: var(--lk-bottom-nav-content-reserve);
  flex: 0 0 var(--lk-bottom-nav-content-reserve);
  pointer-events: none;
  user-select: none;
  visibility: hidden;
}

@media print {
  .bottom-nav,
  .lk-bottom-nav-content-spacer {
    display: none !important;
  }
  html.has-bottom-nav body {
    padding-bottom: 0 !important;
  }
}

.bottom-nav a {
  flex: 1 1 0;
  min-width: 0;
  text-align: center;
  color: #666;
  text-decoration: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 4px 0 6px;
  position: relative;
  border-radius: 14px;
  -webkit-tap-highlight-color: transparent;
  transition: background-color 0.18s ease, color 0.18s ease, transform 0.12s ease;
}

.bottom-nav a i {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  font-size: var(--bottom-nav-icon-size);
  margin-bottom: 0;
  border-radius: 999px;
  transition: transform 0.18s ease, color 0.18s ease, background-color 0.18s ease, box-shadow 0.18s ease;
}

.bottom-nav a > span:not(.badge) {
  font-size: var(--bottom-nav-label-size);
  line-height: 1.05;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: none !important;
}

.bottom-nav a.active,
.bottom-nav a.is-current {
  color: var(--bottom-nav-active-color);
  font-weight: 700;
}

.bottom-nav a.active i,
.bottom-nav a.is-current i {
  color: var(--bottom-nav-active-color);
  background: rgba(198, 40, 40, 0.12);
  box-shadow: inset 0 0 0 1px rgba(198, 40, 40, 0.08);
}

.bottom-nav a:hover {
  background: rgba(198, 40, 40, 0.05);
}

.bottom-nav a:active {
  transform: translateY(1px);
}

.bottom-nav a:active i {
  transform: scale(0.94);
}

.badge {
  position: absolute;
  top: 5px;
  left: calc(50% + 5px);
  transform: translateX(8px);
  min-width: 18px;
  height: 18px;
  background: #c62828;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
  border-radius: 999px;
  padding: 0 5px;
  display: none;
  border: 2px solid #fff;
  box-shadow: 0 3px 8px rgba(198, 40, 40, 0.26);
}

.badge.bn-badge-on {
  display: inline-block !important;
}

@media (max-width: 380px) {
  :root {
    --bottom-nav-height: 60px;
    --bottom-nav-icon-size: 20px;
  }

  .bottom-nav .nav-inner {
    gap: 1px;
    padding-inline: 2px;
  }

  .bottom-nav a i {
    width: 32px;
    height: 32px;
  }
}

@media (min-width: 768px) {
  :root {
    --bottom-nav-height: 64px;
    --bottom-nav-label-size: 12px;
  }

  .bottom-nav .nav-inner {
    max-width: 860px;
    margin: 0 auto;
    gap: 6px;
    padding-inline: 8px;
  }

  .bottom-nav a {
    gap: 2px;
    padding-top: 5px;
  }

  .bottom-nav a > span:not(.badge) {
    display: block !important;
  }
}

@media (min-width: 1024px) {
  :root {
    --bottom-nav-height: 66px;
    --bottom-nav-label-size: 12px;
  }

  .bottom-nav .nav-inner {
    max-width: 920px;
  }
}

/* ===================================================================== */
/*  BOTTOM NAV SETTINGS PANEL (Th�0�0ng b��o + Chatbot + Cu�6�1c g�6�9i)           */
/*  �0�3�0�6�6�1c b�6�7t khi JS th��m .bn-settings-open v��o .bn-settings-backdrop     */
/*  T�5�9t c�5�7 class �0�4�6�7u prefix bn-* �0�4�6�9 tr��nh xung �0�4�6�1t v�6�3i trang kh��c        */
/* ===================================================================== */

.bn-settings-backdrop {
  position: fixed;
  inset: 0;
  z-index: 9500; /* > bottom-nav, < chatbot */
  display: none;
  align-items: flex-end;
  justify-content: center;
  padding: 0 10px calc(var(--bottom-nav-height) + var(--safe-bottom) + 10px);
  min-height: 100vh;
  min-height: 100dvh;
  overflow: hidden;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(4px);
}

/* Khi m�6�7 panel */
.bn-settings-backdrop.bn-settings-open {
  display: flex;
}

/* Panel ch��nh */
.bn-settings-panel {
  width: 100%;
  max-width: 420px;
  background: #ffffff;
  border-radius: 18px;
  box-shadow:
    0 18px 40px rgba(15, 23, 42, 0.25),
    0 0 0 1px rgba(148, 163, 184, 0.35);
  padding: 10px 14px 10px;
  max-height: calc(100dvh - var(--bottom-nav-height) - var(--safe-bottom) - 20px);
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  touch-action: pan-y;
  color: #111827;
  font-family: system-ui, -apple-system, "Be Vietnam Pro", Segoe UI, Roboto, sans-serif;
  font-size: 13px;
}

/* Header panel */
.bn-settings-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-bottom: 4px;
  border-bottom: 1px solid #e5e7eb;
}

.bn-settings-title {
  font-size: 14px;
  font-weight: 600;
  color: #111827;
}

.bn-settings-subtitle {
  font-size: 12px;
  color: #6b7280;
}

.bn-settings-close-btn {
  border: none;
  background: transparent;
  color: #6b7280;
  cursor: pointer;
  font-size: 18px;
  padding: 4px;
  line-height: 1;
  border-radius: 999px;
  transition: background 0.12s ease-out, color 0.12s ease-out;
}

.bn-settings-close-btn:hover {
  background: #f3f4f6;
  color: #111827;
}

/* Section */
.bn-settings-section {
  padding-top: 6px;
  margin-top: 6px;
  border-top: 1px solid #f3f4f6;
}

.bn-settings-section:first-of-type {
  border-top: none;
  padding-top: 6px;
  margin-top: 4px;
}

.bn-settings-section-title {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: #9ca3af;
  margin-bottom: 4px;
}

/* H��ng setting */
.bn-settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 6px 0;
}

.bn-settings-row-main {
  min-width: 0;
}

.bn-settings-label {
  font-size: 13px;
  color: #111827;
}

.bn-settings-desc {
  font-size: 12px;
  color: #6b7280;
  margin-top: 2px;
}

/* Switch (toggle) nh�6�1 b��n ph�5�7i */
.bn-switch {
  position: relative;
  width: 40px;
  height: 22px;
  border-radius: 999px;
  border: 1px solid #d1d5db;
  background: #f3f4f6;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s ease-out, border-color 0.15s ease-out, box-shadow 0.15s ease-out;
}

.bn-switch-thumb {
  position: absolute;
  top: 1px;
  left: 1px;
  width: 18px;
  height: 18px;
  border-radius: 999px;
  background: #ffffff;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.25);
  transition: transform 0.15s ease-out;
}

/* tr�5�5ng th��i b�6�7t */
.bn-switch.bn-switch--on {
  background: #22c55e;
  border-color: #22c55e;
  box-shadow: 0 0 0 1px rgba(34, 197, 94, 0.25);
}

.bn-switch.bn-switch--on .bn-switch-thumb {
  transform: translateX(18px);
}

/* Input gi�6�5 quiet-time */
.bn-settings-time-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
  flex-wrap: wrap;
}

.bn-settings-time-label-inline {
  font-size: 12px;
  color: #6b7280;
}

.bn-settings-time-input {
  flex: 1;
  min-width: 0;
  max-width: 120px;
  padding: 4px 8px;
  font-size: 12px;
  border-radius: 999px;
  border: 1px solid #d1d5db;
  color: #111827;
  background: #f9fafb;
  outline: none;
  transition: border-color 0.12s ease-out, box-shadow 0.12s ease-out, background 0.12s ease-out;
}

.bn-settings-time-input:focus {
  border-color: #c62828;
  box-shadow: 0 0 0 1px rgba(198, 40, 40, 0.15);
  background: #ffffff;
}

/* Ghi ch�� nh�6�1 cu�6�3i panel */
.bn-settings-note {
  margin-top: 6px;
  font-size: 11px;
  color: #9ca3af;
}

/* Responsive panel nh�6�1 h�0�1n m��n h��nh */
@media (max-width: 480px) {
  .bn-settings-backdrop {
    padding: 0 6px calc(var(--bottom-nav-height) + var(--safe-bottom) + 8px);
  }
  .bn-settings-panel {
    padding: 8px 10px 8px;
    border-radius: 16px;
  }
}


/* 7-item nav fit */
.bottom-nav .nav-inner {
  gap: 0;
}

.bottom-nav a {
  min-width: 0;
  padding: 6px 0;
}

.badge {
  right: calc(50% - 18px);
}

@media (max-width: 480px) {
  .bottom-nav a i {
    font-size: 24px;
  }
}


/* =====================================================================
 * LK24H_BOTTOM_NAV_SMART_SCROLL_SAFE_AREA_V2
 * - Kéo xuống: hiện bottom nav, header ẩn.
 * - Kéo lên/đầu trang: ẩn bottom nav, header hiện.
 * - Mobile/App: nâng vùng bấm bằng safe-area + dải sở hữu dưới nav để tránh nút hệ thống.
 * ===================================================================== */
@media (max-width: 768px) {
  :root {
    --lk-bottom-nav-min-safe: 22px;
    --lk-bottom-nav-owner-strip-h: 20px;
    --lk-bottom-nav-extra-lift: 6px;
    --lk-bottom-nav-content-gap: 44px;
  }
  @supports (padding-bottom: max(0px)) {
    :root {
      --safe-bottom: max(env(safe-area-inset-bottom, 0px), var(--lk-bottom-nav-min-safe));
    }
  }
  .bottom-nav {
    border-radius: 18px 18px 0 0;
  }
  .bottom-nav .nav-inner {
    padding-top: 5px;
  }
  .bottom-nav .bn-owner-strip {
    display: flex;
  }
}

.bottom-nav.lk-bottom-nav-hidden,
body.lk-bottomnav-is-hidden .bottom-nav {
  transform: translate3d(0, var(--lk-bottom-nav-hide-y), 0) !important;
  opacity: 0 !important;
  pointer-events: none !important;
  box-shadow: none;
}

.bottom-nav.lk-bottom-nav-visible,
body.lk-bottomnav-is-visible .bottom-nav,
.bottom-nav:focus-within,
body.lk-bottomnav-panel-open .bottom-nav {
  transform: translateY(0);
  opacity: 1;
  pointer-events: auto;
}

@media (prefers-reduced-motion: reduce) {
  .bottom-nav {
    transition: none !important;
  }
}
