/* GAMEIOS_FEATURE_RESPONSIVE_V3
   Đồng bộ phần tính năng mới: Affiliate, Dashboard realtime, AI Support, chat nổi và form admin trên mobile/PC. */

:root{--gio-safe-bottom:env(safe-area-inset-bottom,0px)}

/* Cards / tables from feature pages */
.ui-card,.feature-card,.gio-card{max-width:100%;overflow:hidden}
.ui-card input,.ui-card select,.ui-card textarea,
.feature-card input,.feature-card select,.feature-card textarea,
.gio-card input,.gio-card select,.gio-card textarea{min-width:0;max-width:100%}
.btn-primary,.btn-secondary{min-height:42px;touch-action:manipulation}

/* Affiliate user */
#refLink,#profileAffiliateLink{min-width:0;width:100%;overflow:hidden;text-overflow:ellipsis}
@media(max-width:640px){
  .ui-card{border-radius:18px!important;padding:18px!important}
  .ui-card h1{font-size:clamp(24px,8vw,34px)!important;line-height:1.12!important}
  .ui-card .flex.justify-between{align-items:flex-start;gap:10px;flex-wrap:wrap}
  .ui-card .flex.justify-between b{margin-left:auto;white-space:nowrap}
  .ui-card .font-mono{font-size:12px!important}
}

/* Admin realtime dashboard */
#rt-filter-form{max-width:100%;overflow:hidden}
#rt-filter-form input,#rt-filter-form button{min-width:0;width:100%}
#rt-cards,#rt-selected-cards{min-width:0}
#rt-series,#rt-series-month,#rt-series-year{min-width:0;overflow-x:hidden}
#rt-series .grid,#rt-series-month .grid,#rt-series-year .grid{min-width:0}
@media(max-width:767px){
  #rt-filter-form{grid-template-columns:1fr!important;border-radius:18px!important;padding:14px!important}
  #rt-filter-form button{justify-content:center!important}
  #rt-cards,#rt-selected-cards{grid-template-columns:1fr!important}
  #rt-series .grid,#rt-series-month .grid,#rt-series-year .grid{grid-template-columns:52px minmax(0,1fr)!important;gap:8px!important}
  #rt-series .grid>div:last-child,#rt-series-month .grid>div:last-child,#rt-series-year .grid>div:last-child{grid-column:1/-1;text-align:right!important;width:100%!important}
  #rt-series .h-2,#rt-series-month .h-2,#rt-series-year .h-2{height:7px!important}
  .admin-content,.main-content{min-width:0!important;overflow-x:hidden!important}
}
@media(min-width:768px) and (max-width:1180px){
  #rt-filter-form{grid-template-columns:repeat(3,minmax(0,1fr))!important}
  #rt-filter-form button{grid-column:auto!important}
}

/* Admin feature tables/forms */
.bg-dark-card table{min-width:720px}
.bg-dark-card .overflow-x-auto{-webkit-overflow-scrolling:touch}
@media(max-width:768px){
  .bg-dark-card.border.border-dark-border.rounded-2xl.p-5,
  .bg-dark-card.border.border-dark-border.rounded-2xl.p-6{padding:16px!important;border-radius:18px!important}
  .bg-dark-card form.grid{grid-template-columns:1fr!important}
  .bg-dark-card form input,.bg-dark-card form select,.bg-dark-card form textarea,.bg-dark-card form button{width:100%!important;min-width:0!important}
  .sidebar-link .link-text{white-space:normal!important}
}

/* Floating chat: AI Support sync + mobile fit */
.chat-window{max-width:calc(100vw - 24px)}
.chat-bubble.ai{align-self:flex-start;background:linear-gradient(135deg,rgba(34,211,238,.12),rgba(168,85,247,.10));border:1px solid rgba(34,211,238,.26);color:#e0f7fa;border-bottom-left-radius:4px}
.chat-bubble.ai .chat-time{text-align:left;color:#8bdce9}
.chat-ai-badge{display:inline-flex;align-items:center;gap:5px;padding:3px 8px;margin-bottom:5px;border-radius:999px;background:rgba(34,211,238,.12);border:1px solid rgba(34,211,238,.24);color:#67e8f9;font-size:10px;font-weight:800;text-transform:uppercase;letter-spacing:.04em}
@media(max-width:640px){
  .chat-window{left:8px!important;right:8px!important;bottom:calc(74px + var(--gio-safe-bottom))!important;width:auto!important;height:min(72vh,620px)!important;max-height:calc(100vh - 118px - var(--gio-safe-bottom))!important;border-radius:18px!important}
  .chat-toggle{right:14px!important;bottom:calc(154px + var(--gio-safe-bottom))!important;width:50px!important;height:50px!important}
  .chat-badge{right:10px!important;bottom:calc(196px + var(--gio-safe-bottom))!important}
  .chat-input-area{gap:6px!important;padding:10px!important}
  .chat-img-btn,.chat-send-btn{width:38px!important;height:38px!important;border-radius:11px!important}
  .chat-input-area input{font-size:16px!important;padding:10px 11px!important}
  .chat-messages{padding:12px!important;gap:8px!important}
  .chat-bubble{max-width:88%!important;font-size:13px!important;padding:9px 12px!important}
}
@media(max-width:380px){
  .chat-window{left:6px!important;right:6px!important}
  .chat-input-area{gap:4px!important}
  .chat-img-btn,.chat-send-btn{width:34px!important;height:34px!important}
  .chat-bubble{max-width:92%!important}
}

/* Avoid horizontal jitter from newly added nav items */
.mobile-nav-item,.mobile-bottom-item,.nav-dropdown-item{min-width:0}
.mobile-nav-label,.nav-dropdown-title{overflow:hidden;text-overflow:ellipsis}

/* Utility for JS generated bars */
.gio-bar{height:8px;border-radius:999px;overflow:hidden;background:rgba(255,255,255,.06)}
.gio-bar>span{display:block;height:100%;border-radius:999px;background:linear-gradient(90deg,rgb(var(--neon-cyan-rgb,0 240 255)),rgb(var(--neon-purple-rgb,168 85 247)))}

.api-shell,
.profile-shell,
.gameios-realtime-dashboard .rt-hero,
.api-layout-grid,
.profile-main-grid {
  max-width: 100%;
  min-width: 0;
}

/* Profile/Bảo mật: cố định icon trái và nút xem mật khẩu về đúng vị trí trong input. */
.gameios-profile-page .profile-password-field {
  position: relative;
  width: 100%;
  max-width: 100%;
}

.gameios-profile-page .profile-password-input {
  width: 100%;
  min-width: 0;
  padding-left: 2.75rem !important;
  padding-right: 3rem !important;
}

.gameios-profile-page .profile-password-leading-icon {
  position: absolute !important;
  left: 1rem !important;
  right: auto !important;
  top: 50% !important;
  width: 1rem !important;
  height: 1rem !important;
  transform: translateY(-50%) !important;
  z-index: 2;
  pointer-events: none;
  flex: 0 0 auto;
}

.gameios-profile-page .profile-password-toggle {
  position: absolute !important;
  right: .75rem !important;
  left: auto !important;
  top: 50% !important;
  width: 2rem !important;
  height: 2rem !important;
  padding: 0 !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  transform: translateY(-50%) !important;
  z-index: 3;
}

.gameios-profile-page .profile-password-toggle svg,
.gameios-profile-page .profile-password-toggle i {
  width: 1rem !important;
  height: 1rem !important;
  flex: 0 0 auto !important;
}

.gameios-profile-page .profile-password-input::-ms-reveal,
.gameios-profile-page .profile-password-input::-ms-clear {
  display: none;
}

.gameios-profile-page .profile-password-input::-webkit-credentials-auto-fill-button,
.gameios-profile-page .profile-password-input::-webkit-contacts-auto-fill-button {
  visibility: hidden;
  display: none !important;
  pointer-events: none;
}

/* Dashboard realtime: card headers và form tự co đúng trên mobile, không văng ở desktop. */
.gameios-realtime-dashboard #rt-filter-form {
  width: 100%;
  max-width: 100%;
  overflow: hidden;
}

.gameios-realtime-dashboard #rt-filter-form input,
.gameios-realtime-dashboard #rt-filter-form button {
  width: 100%;
  min-width: 0;
}

.gameios-realtime-dashboard .rt-section-head,
.gameios-realtime-dashboard .rt-section-head h2 {
  min-width: 0;
  max-width: 100%;
}

.gameios-realtime-dashboard #rt-cards,
.gameios-realtime-dashboard #rt-selected-cards,
.gameios-realtime-dashboard #rt-hourly,
.gameios-realtime-dashboard #rt-series,
.gameios-realtime-dashboard #rt-series-month,
.gameios-realtime-dashboard #rt-series-year,
.gameios-realtime-dashboard #rt-extra {
  min-width: 0;
  max-width: 100%;
}

.gameios-realtime-dashboard #rt-series,
.gameios-realtime-dashboard #rt-series-month,
.gameios-realtime-dashboard #rt-series-year {
  overflow-x: hidden;
}

@media (min-width: 1280px) {
  .gameios-realtime-dashboard #rt-filter-form {
    width: auto;
  }
}

@media (max-width: 767px) {

  .gameios-profile-page .flex.items-center.justify-between,
  .gameios-realtime-dashboard .flex.items-center.justify-between {
    flex-wrap: wrap;
    align-items: flex-start;
    gap: .5rem;
  }

  .gameios-profile-page h1,
  .gameios-realtime-dashboard h1 {
    max-width: 100%;
    overflow-wrap: anywhere;
  }

  .gameios-profile-page .profile-password-input {
    font-size: 16px !important;
  }

  .gameios-realtime-dashboard #rt-filter-form {
    grid-template-columns: 1fr !important;
    padding: 14px !important;
    border-radius: 18px !important;
    gap: .85rem !important;
  }

  .gameios-realtime-dashboard #rt-filter-form button {
    justify-content: center !important;
    min-height: 46px;
  }

  .gameios-realtime-dashboard #rt-filter-form input {
    min-height: 46px;
    font-size: 16px !important;
  }

  .gameios-realtime-dashboard .rt-section-head {
    align-items: flex-start !important;
  }

  .gameios-realtime-dashboard #rt-series .grid,
  .gameios-realtime-dashboard #rt-series-month .grid,
  .gameios-realtime-dashboard #rt-series-year .grid {
    grid-template-columns: 52px minmax(0, 1fr) !important;
    gap: .5rem !important;
  }

  .gameios-realtime-dashboard #rt-series .grid > div:last-child,
  .gameios-realtime-dashboard #rt-series-month .grid > div:last-child,
  .gameios-realtime-dashboard #rt-series-year .grid > div:last-child {
    grid-column: 1 / -1;
    width: 100% !important;
    text-align: right !important;
  }
}

@media (max-width: 380px) {
}
