/* Mobile & Performance Optimization Stylesheet */
html, body {
  max-width: 100vw;
  overflow-x: hidden;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

/* Smooth mobile scrolling for lotto tables */
.result-board,
.table-responsive,
.table-lotto {
  -webkit-overflow-scrolling: touch;
}

/* Ensure lotto tables never break out of container on small screens */
.table-lotto {
  table-layout: fixed;
  width: 100% !important;
  max-width: 100% !important;
}

/* Mobile optimizations for small screens <= 480px */
@media (max-width: 480px) {
  /* Province result tables with 3-4 columns (Miền Nam, Miền Trung) */
  .table-4-provinces .txt-normal-prize,
  .table-4-provinces .txt-special-prize {
    font-size: 13px !important;
    letter-spacing: -0.3px;
    padding: 2px 1px !important;
  }
  
  .table-lotto td,
  .table-lotto th {
    padding: 4px 1px !important;
  }
  
  /* Numbers on single region table (Miền Bắc) */
  .txt-special-prize {
    font-size: 22px !important;
  }
  .txt-normal-prize {
    font-size: 16px !important;
  }
  
  /* Sidebar menu touch targets & dropdown styling */
  #sidebar-menu {
    max-width: 85vw;
    box-shadow: 2px 0 16px rgba(0, 0, 0, 0.25);
  }
  #sidebar-menu .sidebar-header {
    padding: 16px 16px 12px 16px;
    background: #ffffff;
    border-bottom: 1px solid #e9ecef;
  }
  #sidebar-menu .sidebar-header .sidebar-close {
    width: 44px;
    height: 44px;
    top: 6px;
    right: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  #sidebar-menu .sidebar-header .sidebar-close i {
    width: 22px !important;
    height: 22px !important;
    background-color: #6c757d !important;
    transition: opacity 0.2s ease;
  }
  #sidebar-menu .sidebar-header .sidebar-close:hover i {
    background-color: var(--brand-color, #bb2e28) !important;
  }
  #sidebar-menu .nav-items {
    position: relative;
    border-bottom: 1px solid #f1f3f5;
  }
  #sidebar-menu .nav-links {
    height: 48px;
    padding-left: 16px;
    padding-right: 54px;
    font-size: 15px;
    font-weight: 500;
  }
  /* Mobile Dropdown Caret Button */
  .nav-bar .sidebar-dropdown {
    height: 48px !important;
    width: 54px !important;
    position: absolute !important;
    right: 0 !important;
    top: 0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: flex-end !important;
    padding-right: 18px !important;
    cursor: pointer !important;
    background: transparent !important;
    border: none !important;
    outline: none !important;
    -webkit-mask-image: none !important;
    mask-image: none !important;
    z-index: 5;
    -webkit-tap-highlight-color: transparent;
  }
  .nav-bar .sidebar-dropdown i,
  .nav-bar .sidebar-dropdown .fa,
  .nav-bar .sidebar-dropdown .fas {
    display: inline-block !important;
    width: 12px !important;
    height: 12px !important;
    font-size: 12px !important;
    background-color: #6c757d !important;
    transition: transform 0.25s ease, background-color 0.2s ease !important;
    transform: rotate(0deg);
    pointer-events: none;
  }
  .nav-bar .sidebar-dropdown.open-sidebar-dropdown i,
  .nav-bar .sidebar-dropdown.open-sidebar-dropdown .fa,
  .nav-bar .sidebar-dropdown.open-sidebar-dropdown .fas {
    transform: rotate(180deg) !important;
    background-color: var(--brand-color, #bb2e28) !important;
  }
  /* Fallback if sidebar-dropdown is still an <i> */
  i.sidebar-dropdown {
    height: 48px !important;
    width: 54px !important;
    background-color: transparent !important;
    -webkit-mask-size: 12px 12px !important;
    mask-size: 12px 12px !important;
    -webkit-mask-position: right 18px center !important;
    mask-position: right 18px center !important;
    background-color: #6c757d !important;
    transition: transform 0.25s ease !important;
  }
  i.sidebar-dropdown.open-sidebar-dropdown {
    transform: rotate(180deg) !important;
    background-color: var(--brand-color, #bb2e28) !important;
  }
  /* Mobile dropdown sub-items */
  #sidebar-menu .dropdown-list {
    background-color: #f8f9fa;
    border-top: 1px solid #e9ecef;
  }
  #sidebar-menu .dropdown-links {
    height: 42px;
    padding: 0 16px 0 36px;
    font-size: 14px;
    color: #495057;
  }
  #sidebar-menu .dropdown-links:hover {
    color: var(--brand-color, #bb2e28);
    background-color: #eef2f6;
  }
  
  /* Search & Dò vé số form controls touch friendly */
  .form-control, .form-select, .btn {
    min-height: 44px;
    font-size: 15px;
  }
  
  /* Keyword tag pills */
  .keyword-group {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
  }
  .keyword-group li {
    font-size: 11px;
    padding: 2px 6px;
    margin-right: 4px;
  }
}

/* Ultra small devices (iPhone SE, <= 360px) */
@media (max-width: 360px) {
  .table-4-provinces .txt-normal-prize,
  .table-4-provinces .txt-special-prize {
    font-size: 11.5px !important;
  }
  .table-4-provinces th {
    font-size: 11px !important;
  }
}

/* Sidebar Calendar Active Date Styling */
.table-calendar td.bg-btn a,
.table-calendar td.active a {
  color: #fff !important;
  font-weight: 700 !important;
}
.table-calendar td.bg-btn a:hover,
.table-calendar td.active a:hover {
  background-color: transparent !important;
  color: #fff !important;
}

