/* Pichforest Webadmin - TaiVPS Compatibility & Responsive Polish */
html, body { max-width: 100%; overflow-x: hidden; background-color: var(--bs-body-bg, #f5f6f8); }
.page-content { min-height: calc(100vh - 70px); }
img, video, canvas, iframe { max-width: 100%; }
pre { max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table-responsive { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.page-title-box h4 { font-size: 18px; font-weight: 600; }

/* Avatar centering across all sizes */
.avatar-sm { height: 2.5rem; width: 2.5rem; flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center; }
.avatar-xs { height: 1.75rem; width: 1.75rem; flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center; }
.avatar-md { height: 3.5rem; width: 3.5rem; flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center; }
.avatar-lg { height: 4.5rem; width: 4.5rem; flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center; }
.avatar-title {
  align-items: center; display: flex; font-weight: 500;
  height: 100%; justify-content: center; width: 100%;
}
/* Fallback bridge for any dynamic DB HTML or JS fragments */
.avtar { display: inline-flex; align-items: center; justify-content: center; border-radius: .5rem; width: 2.5rem; height: 2.5rem; flex-shrink: 0; }
.avtar-xs { width: 1.75rem; height: 1.75rem; font-size: .875rem; }
.avtar-s { width: 2.5rem; height: 2.5rem; font-size: 1.125rem; }
.avtar-lg, .avtar-xl { width: 3.5rem; height: 3.5rem; font-size: 1.5rem; }
.bg-light-primary { background-color: rgba(31,88,199,.12) !important; color: #1f58c7 !important; }
.bg-light-success { background-color: rgba(40,183,101,.12) !important; color: #28b765 !important; }
.bg-light-warning { background-color: rgba(244,194,56,.15) !important; color: #a07000 !important; }
.bg-light-danger  { background-color: rgba(237,85,85,.12) !important; color: #ed5555 !important; }
.bg-light-info    { background-color: rgba(82,198,234,.14) !important; color: #0e86ad !important; }
.bg-light-secondary { background-color: rgba(164,169,180,.15) !important; color: #495057 !important; }
.btn-light-primary { background-color: rgba(31,88,199,.12); color: #1f58c7; border-color: transparent; }
.btn-light-primary:hover { background-color: #1f58c7; color: #fff; }
.btn-light-secondary { background-color: rgba(164,169,180,.18); color: #495057; border-color: transparent; }
.btn-light-secondary:hover { background-color: #495057; color: #fff; }
.btn-light-danger { background-color: rgba(237,85,85,.12); color: #ed5555; border-color: transparent; }
.btn-light-danger:hover { background-color: #ed5555; color: #fff; }
.btn-icon { width: 34px; height: 34px; padding: 0; display: inline-flex; align-items: center; justify-content: center; }
.btn-soft-primary { background-color: rgba(31,88,199,.12); color: #1f58c7; border: 0; }
.btn-soft-primary:hover { background-color: #1f58c7; color: #fff; }
.btn-soft-success { background-color: rgba(40,183,101,.12); color: #28b765; border: 0; }
.btn-soft-danger { background-color: rgba(237,85,85,.12); color: #ed5555; border: 0; }
.f-10 { font-size: 10px !important; } .f-12 { font-size: 12px !important; }
.f-14 { font-size: 14px !important; } .f-16 { font-size: 16px !important; }
.f-18 { font-size: 18px !important; } .f-20 { font-size: 20px !important; }
.f-24 { font-size: 24px !important; } .f-30 { font-size: 30px !important; }
.plan-card .card-body { padding-top: 2.2rem !important; }
.active-badge { top: 0 !important; right: 0 !important; z-index: 2; }
.f-w-500 { font-weight: 500 !important; } .f-w-600, .f-w-700 { font-weight: 600 !important; }
.wid-35 { width: 35px; height: 35px; } .wid-45 { width: 45px; height: 45px; }
.card { border-radius: .75rem; box-shadow: 0 2px 6px rgba(18,32,51,.04); border: 1px solid #eff0f2; margin-bottom: 24px; }
.card-header { background-color: transparent; border-bottom: 1px solid #eff0f2; padding: 1rem 1.25rem; }
.table thead th { font-weight: 600; font-size: 13px; text-transform: uppercase; letter-spacing: .02em; color: #495057; }
#sidebar-menu ul li a i.bx, #sidebar-menu ul li a i.mdi { font-size: 18px; min-width: 1.75rem; vertical-align: middle; }
#sidebar-menu ul li a .badge { float: right; margin-top: 2px; }
.header-profile-user { object-fit: cover; }
.authentication-bg .bg-overlay { opacity: .88; }

/* Single-line auth buttons & topbar spacing */
.header-auth-btns .btn { white-space: nowrap; flex-shrink: 0; }
.navbar-header > .d-flex:first-child { min-width: 0; flex: 1; }
.navbar-header .page-title-box { min-width: 0; flex: 1; overflow: hidden; }
.navbar-header .page-title-box h4 { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.navbar-header > .d-flex:last-child { flex-shrink: 0; }

/* Desktop: only sidebar shows logo; Mobile/Tablet (<992px): only topbar shows ONE single logo */
@media (min-width: 992px) {
  .vertical-menu .navbar-brand-box { padding: 0 1.25rem; height: 70px; display: flex; align-items: center; }
}
@media (max-width: 991.98px) {
  .main-content { margin-left: 0 !important; }
  .footer { left: 0 !important; text-align: center; }
  .navbar-header { padding: 0 12px; gap: 6px; }
  /* CRITICAL: Hide sidebar brand box so opening mobile menu NEVER shows a 2nd logo */
  .vertical-menu .navbar-brand-box,
  .vertical-menu .vertical-menu-btn { display: none !important; }
  /* Keep topbar logo crisp & visible on ALL mobile/tablet screens (even 360-380px) without getting squished on 768px */
  #page-topbar .navbar-brand-box,
  .ishorizontal-topbar .navbar-brand-box {
    display: inline-flex !important;
    align-items: center;
    flex-shrink: 0;
    padding: 0 6px 0 0 !important;
    width: auto !important;
    position: relative !important;
  }
  #page-topbar .logo span.logo-lg,
  .ishorizontal-topbar .logo span.logo-lg { display: none !important; }
  #page-topbar .logo span.logo-sm,
  .ishorizontal-topbar .logo span.logo-sm { display: inline-flex !important; align-items: center; }
  #page-topbar .logo img,
  .ishorizontal-topbar .logo img { max-height: 28px; width: auto; max-width: 110px; object-fit: contain; }
}
@media (max-width: 575.98px) {
  .page-content { padding: calc(70px + 12px) 6px 60px; }
  .card-body { padding: 1rem; }
  .page-title-box { flex-wrap: wrap; gap: .5rem; }
  .nav-tabs, .nav-pills { flex-wrap: wrap; gap: .25rem; }
  .dataTables_wrapper .dataTables_filter input { width: 130px !important; }
  .modal-dialog { margin: .5rem; }
  .header-auth-btns { gap: 4px !important; }
  .header-auth-btns .btn { font-size: 12px; padding: .3rem .55rem; }
  .header-item.noti-icon { padding: 0 6px !important; }
}

/* Mobile Topbar Compact Fit (<576px) & Interactive Form Polish */
@media (max-width: 575.98px) {
  .navbar-header { padding: 0 8px !important; gap: 4px !important; }
  #page-topbar .logo img { max-height: 22px !important; max-width: 82px !important; }
  #page-topbar .vertical-menu-btn { padding-left: 6px !important; padding-right: 6px !important; font-size: 20px !important; }
  #page-topbar .header-item.noti-icon { padding: 0 4px !important; width: 30px !important; min-width: 30px !important; }
  .header-auth-btns .btn { font-size: 11px !important; padding: .24rem .45rem !important; }
}
#calcScaleBadge { white-space: nowrap !important; flex-shrink: 0 !important; align-self: center !important; }
select.form-select {
  -webkit-appearance: none !important;
  -moz-appearance: none !important;
  appearance: none !important;
  height: 38px !important;
  min-height: 38px !important;
  max-height: 38px !important;
  padding-top: .42rem !important;
  padding-bottom: .42rem !important;
  padding-right: 2.25rem !important;
  line-height: 1.45 !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
}
select.form-select.form-select-sm {
  height: 33px !important;
  min-height: 33px !important;
  max-height: 33px !important;
  padding-top: .26rem !important;
  padding-bottom: .26rem !important;
}
select.form-select::picker-icon { display: none !important; }
/* ==========================================================================
   Pichforest Mobile App Suite (2026-12-04m1)
   Fixed 5-Tab Bottom App Dock + Slide-Over Drawer Backdrop + Safe-Area Polish
   ========================================================================== */
.tv-mobile-dock,
#tv-sidebar-backdrop {
  display: none;
}

@media (max-width: 991.98px) {
  #tv-sidebar-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.46);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    z-index: 1040 !important;
    opacity: 0;
    transition: opacity 0.2s ease;
  }
  body.sidebar-enable #tv-sidebar-backdrop {
    display: block !important;
    opacity: 1 !important;
  }
  body.sidebar-enable {
    overflow: hidden;
  }
  .vertical-menu {
    z-index: 1042 !important;
    box-shadow: 12px 0 32px rgba(15, 23, 42, 0.18) !important;
  }
  .topnav .navbar-collapse {
    max-height: 74vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 0.65rem 0.25rem !important;
  }
  .topnav .navbar-nav .nav-link {
    padding: 0.65rem 0.85rem !important;
    border-radius: 0.5rem;
  }
  .topnav .navbar-nav .nav-link:active,
  .topnav .navbar-nav .nav-link:hover {
    background: rgba(3, 142, 220, 0.07);
  }

  .tv-mobile-dock {
    position: fixed;
    inset-inline: 0;
    bottom: 0;
    z-index: 1038;
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    align-items: end;
    gap: 2px;
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-top: 1px solid #e2e8f0;
    box-shadow: 0 -6px 24px rgba(15, 23, 42, 0.08);
    padding: 6px 6px calc(6px + env(safe-area-inset-bottom, 0px));
  }
  .tv-dock-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    min-height: 48px;
    padding: 4px 2px;
    border-radius: 10px;
    color: #5b6679 !important;
    text-decoration: none !important;
    font-size: 10.5px;
    font-weight: 600;
    line-height: 1.15;
    text-align: center;
    transition: color 0.18s ease, background-color 0.18s ease;
    min-width: 0;
  }
  .tv-dock-item i {
    font-size: 20px;
    line-height: 1;
  }
  .tv-dock-item span {
    display: block;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .tv-dock-item.active,
  .tv-dock-item:hover {
    color: #038edc !important;
    background: rgba(3, 142, 220, 0.08);
  }
  .tv-dock-item.tv-dock-primary {
    background: transparent !important;
    padding-top: 0;
  }
  .tv-dock-item.tv-dock-primary .tv-dock-fab {
    width: 44px;
    height: 44px;
    margin-top: -18px;
    border-radius: 14px;
    background: linear-gradient(135deg, #1f58c7 0%, #038edc 100%);
    color: #ffffff !important;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 18px rgba(3, 142, 220, 0.34);
    border: 3px solid #ffffff;
    transition: transform 0.18s ease, box-shadow 0.18s ease;
  }
  .tv-dock-item.tv-dock-primary .tv-dock-fab i {
    font-size: 21px;
    color: #ffffff !important;
  }
  .tv-dock-item.tv-dock-primary:active .tv-dock-fab {
    transform: scale(0.95);
  }
  .tv-dock-item.tv-dock-primary span {
    color: #1f58c7 !important;
    font-weight: 700;
    margin-top: 2px;
  }

  .pf-footer-landing {
    padding-bottom: calc(84px + env(safe-area-inset-bottom, 0px)) !important;
  }
  .footer {
    padding-bottom: calc(80px + env(safe-area-inset-bottom, 0px)) !important;
  }
  .page-content {
    padding-bottom: calc(82px + env(safe-area-inset-bottom, 0px)) !important;
  }
  #chat-widget-container,
  .crisp-client .cc-1brb6,
  .tawk-min-container {
    bottom: calc(74px + env(safe-area-inset-bottom, 0px)) !important;
  }
}

@media (max-width: 767.98px) {
  input.form-control,
  textarea.form-control,
  select.form-select {
    font-size: 16px !important;
  }
}
