/* ==========================================================================
   SAI-RESPONSIVE — sua responsive theme (dot theme-fix, 24/11/2026)
   Nap SAU app.min.css + sai-effects.css (xem header.php) de thang rule cu.
   Khong sua file vendor. Chi them rule, khong doi noi dung / gia / so lieu.
   Breakpoint: xs <=575.98px | sm 576-767.98px | md 768-991.98px
               lg 992-1199.98px | xl 1200-1399.98px | xxl >=1400px
   LUU Y: trinh duyet cloud viewport co dinh 1919x998, khong gia lap dien
   thoai duoc — TV KIEM LAI BANG DIEN THOAI THAT sau deploy (xem bien ban).
   ========================================================================== */

/* --------------------------------------------------------------------------
   A. TOPBAR (yeu cau TV 24/11/2026: bo chu/logo SAI Marine tren dien thoai)
   -------------------------------------------------------------------------- */
/* An HAN brand topbar (logo + chu SAI Marine) tu <=767px.
   Selector chi trung dung link brand mobile: no co class d-lg-none, trong
   khi link tim kiem co d-none d-lg-flex nen khong bi an nham.
   Logo van giu o 768px tro len. Khong sua nav.php (nav.php la cua goi
   status-hide) — dung CSS thuan. */
@media (max-width: 767.98px) {
    .app-topbar .topbar-menu > div:first-child > a.d-lg-none {
        display: none !important;
    }
    /* Topbar Boron cao 85px qua phi dien thoai — ha xuong 56px (nut 36px). */
    :root {
        --bs-topbar-height: 56px;
    }
}
/* Khong cho nut topbar ngat 2 dong (nut "Bat dau" tung ngat giua chu). */
.app-topbar .btn {
    white-space: nowrap;
}
/* So du topbar: cat ngan co dau ... tren dien thoai hep. */
@media (max-width: 575.98px) {
    .app-topbar .user-balance-val {
        display: inline-block;
        max-width: 96px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        vertical-align: bottom;
    }
}

/* --------------------------------------------------------------------------
   B. Class fs-md-* CHET: dung o landing (fs-md-28/36/48) nhung khong dinh
      nghia o dau — dinh nghia lai o day (>=768px).
   -------------------------------------------------------------------------- */
@media (min-width: 768px) {
    .fs-md-28 { font-size: 28px !important; }
    .fs-md-36 { font-size: 36px !important; }
    .fs-md-48 { font-size: 48px !important; }
}

/* --------------------------------------------------------------------------
   C. LANDING
   -------------------------------------------------------------------------- */
@media (max-width: 575.98px) {
    /* H1 "SAI-MARINE.COM" ~300-310px @36px > 288px ruot card @360px. */
    .se-hero-stagger h1 {
        font-size: 28px !important;
    }
    .se-hero-stagger h1 .se-grad-text {
        overflow-wrap: anywhere;
    }
}
@media (min-width: 992px) and (max-width: 1199.98px) {
    /* Luoi model @1024px: hang gia ~145px > ruot card ~135px — cho wrap. */
    .landing-models .d-flex.justify-content-between {
        flex-wrap: wrap;
    }
}

/* --------------------------------------------------------------------------
   D. FAQ — guard chong race collapse (click nhanh 2 lan de .show ma mat
      .is-open => than rong). Khong thiet ke lai FAQ.
   -------------------------------------------------------------------------- */
.se-faq-a.collapse.show {
    grid-template-rows: 1fr !important;
}

/* --------------------------------------------------------------------------
   E. PILL INDICATOR (JS chi set width + translateX, khong set top/height)
   -------------------------------------------------------------------------- */
/* Tat ca pill <=767px: #modelFilters xuong 2 hang tu <=1399px nen indicator
   thanh thanh doc; pill tien te (nav) cung an theo. */
@media (max-width: 767.98px) {
    .se-pill-ind {
        display: none !important;
    }
}
@media (max-width: 1399.98px) {
    #modelFilters .se-pill-ind {
        display: none !important;
    }
}

/* --------------------------------------------------------------------------
   F. NUT LEN DAU TRANG (inline 44px, sat mep tren mobile)
   -------------------------------------------------------------------------- */
@media (max-width: 575.98px) {
    .se-to-top {
        right: 12px !important;
        bottom: 12px !important;
        width: 40px !important;
        height: 40px !important;
    }
}

/* --------------------------------------------------------------------------
   G. PLAYGROUND (trang trong anh TV gui — uu tien cao nhat)
   -------------------------------------------------------------------------- */
/* Toolbar: cho wrap + item duoc thu nho (khong flex-wrap/min-width:0 cu). */
.pg-toolbar-left {
    flex-wrap: wrap;
    min-width: 0;
}
/* O chon model: label cat ngan co dau ... (ten model dai, vd deepseek-...). */
#selectedModelBtn {
    min-width: 0;
    max-width: 100%;
}
#selectedModelBtn #currentModelLabel {
    display: inline-block;
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    vertical-align: bottom;
}
/* Menu dropdown model: width inline 320px co dinh — gioi han theo viewport. */
#modelDropdownList {
    max-width: calc(100vw - 24px) !important;
}
@media (max-width: 575.98px) {
    /* Dropdown xuong hang rieng (flex-basis:100%) de menu bat dau tu mep
       trai card: neu o cung hang voi tab Chat/Workspace, menu lech phai
       ~150px va tran viewport. */
    .pg-model-dropdown {
        flex-basis: 100%;
    }
    #selectedModelBtn #currentModelLabel {
        max-width: 120px;
    }
}
/* Header tin nhan AI + bong bong user: ten model dai + noi dung dai tu
   cat chu (chat dai, URL dai) — cho be xuong, ten model cat ngan. */
.pg-ai-head {
    min-width: 0;
    flex-wrap: wrap;
    row-gap: 4px;
}
.pg-ai-head > div {
    min-width: 0;
}
/* Card AI la flex-item cua .ai-msg-row: cho phep thu nho duoi min-content
   (neu khong, ten model dai + noi dung dai day card tran ra ngoai). */
.ai-msg-row > .flex-grow-1 {
    min-width: 0;
}
.pg-ai-model {
    display: inline-block;
    min-width: 0;
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    vertical-align: bottom;
}
.ai-content-body,
.pg-user-text {
    overflow-wrap: anywhere;
    word-break: break-word;
}
@media (max-width: 575.98px) {
    .pg-ai-model {
        max-width: 110px;
    }
}
/* Dong trang thai duoi composer: cho wrap + ten model cat ngan. */
.pg-status-line {
    flex-wrap: wrap;
    row-gap: 2px;
}
#statusModelDisplay {
    display: inline-block;
    max-width: 45vw;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    vertical-align: bottom;
}

/* --------------------------------------------------------------------------
   H. MODELS — hang badge trong the model: cho wrap (badge "Gia Re"/"Mo Rong"
      tung tran the khi che do xem thu hep).
   -------------------------------------------------------------------------- */
.model-item .d-flex.gap-1 {
    flex-wrap: wrap;
    justify-content: flex-end;
}

/* --------------------------------------------------------------------------
   I. SMART ROUTER
   -------------------------------------------------------------------------- */
/* 3 nut che do (col-4): label ngan/dai khac nhau => cao lech nhau. */
#autoOptions .row .btn {
    height: 100%;
}
#autoOptions .row .btn .fs-11 {
    line-height: 1.3;
}
/* Hang cong tac Auto: label dai + switch — label duoc thu nho, switch giu. */
.sr-auto-row > div:first-child {
    min-width: 0;
}
.sr-auto-row .form-switch {
    flex-shrink: 0;
}

/* --------------------------------------------------------------------------
   J. API KEYS — danh sach model trong modal tao/sua key: ten model dai
      day code model_id ra khoi modal.
   -------------------------------------------------------------------------- */
#createModelList label > span:first-of-type,
#editModelList label > span:first-of-type {
    min-width: 0;
    flex: 1 1 auto;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
#createModelList label > code,
#editModelList label > code {
    max-width: 45%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex-shrink: 0;
}
#createModelList,
#editModelList {
    overflow-x: hidden;
}

/* --------------------------------------------------------------------------
   K. API DOCS — bang #parameters: key/auth dai khong be duoc.
   -------------------------------------------------------------------------- */
#parameters td .font-mono {
    overflow-wrap: anywhere;
    word-break: break-all;
}

/* --------------------------------------------------------------------------
   L. USAGE
   -------------------------------------------------------------------------- */
@media (max-width: 575.98px) {
    /* Cum nut khoang thoi gian + Xuat CSV ~433px > 336px ruot @360px. */
    .usage-period-group {
        flex-wrap: wrap;
    }
    .usage-period-group .btn {
        flex: 1 1 auto;
    }
}
@media (max-width: 1199.98px) {
    /* Nut Loc / Xoa loc trong col-md-2 (~124px @768px): xuong hang rieng. */
    .usage-filter-actions {
        flex: 0 0 100%;
        max-width: 100%;
    }
    .usage-filter-actions .btn {
        flex: 1;
    }
}

/* --------------------------------------------------------------------------
   M. USER PROFILE — nhom input API token: input bi ep ve ~0 vi 3 nut
      (mat / Copy / Doi Token Moi) khong thu nho duoc. Dung :has() de
      KHONG sua markup (file nay co the bi GĐ1 Gmail cham).
   -------------------------------------------------------------------------- */
.input-group:has(#api_token) {
    flex-wrap: wrap;
}
.input-group:has(#api_token) #api_token {
    flex: 1 1 100%;
    min-width: 0;
}

/* --------------------------------------------------------------------------
   N. TAB (recharge 5 tab / security 4 tab / lien-he 3 tab): khong wrap,
      tab bi ep hep tren dien thoai.
   -------------------------------------------------------------------------- */
@media (max-width: 575.98px) {
    #rechargeTabs {
        flex-wrap: wrap;
    }
    #rechargeTabs .nav-item {
        flex: 1 1 45%;
    }
    #securityTabs {
        flex-wrap: wrap;
    }
    #securityTabs .nav-item {
        flex: 1 1 45%;
    }
    #supportTabs {
        flex-direction: column;
    }
    #supportTabs .nav-item {
        width: 100%;
    }
}

/* --------------------------------------------------------------------------
   O. STATUS — tieu de luoi 90 ngay ~730px: xuong cot <=767px.
   -------------------------------------------------------------------------- */
@media (max-width: 767.98px) {
    .status-90d-head {
        flex-direction: column;
        align-items: flex-start !important;
        gap: 2px;
    }
}

/* --------------------------------------------------------------------------
   P. BUDGET — hang "Da dung / Con lai": xuong cot <=575px.
   -------------------------------------------------------------------------- */
@media (max-width: 575.98px) {
    .budget-used-row {
        flex-direction: column;
        align-items: flex-start !important;
        gap: 1px;
    }
}

/* --------------------------------------------------------------------------
   Q. BLOG / BLOG CHI TIET
   -------------------------------------------------------------------------- */
.blog-content table {
    display: block;
    overflow-x: auto;
    max-width: 100%;
}
.blog-content img {
    max-width: 100%;
    height: auto;
}
.blog-content pre {
    max-width: 100%;
}
@media (max-width: 575.98px) {
    /* Breadcrumb chi tiet blog: max-width inline 320px co dinh. */
    .breadcrumb-item.active {
        max-width: 180px !important;
    }
}

/* --------------------------------------------------------------------------
   R. HOME — stat h3 ~192px @1024px: thu nho nhe 992-1199px.
   -------------------------------------------------------------------------- */
@media (min-width: 992px) and (max-width: 1199.98px) {
    .page-container h3.font-mono {
        font-size: 1.4rem !important;
    }
}

/* --------------------------------------------------------------------------
   S. PHAN TRANG (nhat ky user-profile render het so trang): cho wrap
      phong ngua tran tren dien thoai hep.
   -------------------------------------------------------------------------- */
@media (max-width: 575.98px) {
    .pagination {
        flex-wrap: wrap;
    }
}

/* --------------------------------------------------------------------------
   T. PRICING — hang ket qua may tinh: nut "Nap Tien Ngay" xuong hang rieng,
      rong 100% tren dien thoai hep (gia $X.XX + nut chen nhau).
   -------------------------------------------------------------------------- */
@media (max-width: 575.98px) {
    .pricing-calc-result .btn {
        flex: 1 1 100%;
    }
}

/* --------------------------------------------------------------------------
   U. 1280x800 DESKTOP TOPBAR & SIDEBAR CLIPPING FIX (01/12/2026)
   -------------------------------------------------------------------------- */
@media (max-width: 1399.98px) {
    .app-topbar .page-container {
        padding-left: 14px !important;
        padding-right: 14px !important;
    }
    .app-topbar .topbar-menu {
        gap: 6px !important;
    }
    .app-topbar .topbar-menu > div:last-child {
        gap: 6px !important;
        flex-shrink: 0;
    }
    .app-topbar .free-ai-label {
        display: none !important;
    }
    .app-topbar .topbar-search {
        min-width: 135px !important;
        max-width: 195px !important;
    }
    .app-topbar .topbar-search span {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
}

/* Flex column sidebar so [data-simplebar] scrolls cleanly above sticky user box without overlap or clipping at 800px height */
.sidenav-menu {
    display: flex !important;
    flex-direction: column !important;
    height: 100vh !important;
    height: 100dvh !important;
    overflow: hidden !important;
}
.sidenav-menu .brand-logo-custom {
    flex-shrink: 0 !important;
}
.sidenav-menu [data-simplebar] {
    flex: 1 1 0% !important;
    min-height: 0 !important;
    height: auto !important;
    max-height: none !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    padding-bottom: 0 !important;
}
.sidenav-menu .simplebar-wrapper,
.sidenav-menu .simplebar-mask {
    height: 100% !important;
    max-height: 100% !important;
}
.sidenav-menu .simplebar-offset {
    position: relative !important;
    height: 100% !important;
    max-height: 100% !important;
    right: 0 !important;
    bottom: 0 !important;
}
.sidenav-menu .simplebar-content-wrapper {
    height: 100% !important;
    max-height: 100% !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    -webkit-overflow-scrolling: touch !important;
    scrollbar-width: thin !important;
    scrollbar-color: rgba(129, 140, 248, 0.55) transparent !important;
    -ms-overflow-style: auto !important;
}
.sidenav-menu .simplebar-content-wrapper::-webkit-scrollbar,
.sidenav-menu [data-simplebar]::-webkit-scrollbar {
    display: block !important;
    width: 6px !important;
    height: 0 !important;
}
.sidenav-menu .simplebar-content-wrapper::-webkit-scrollbar-track,
.sidenav-menu [data-simplebar]::-webkit-scrollbar-track {
    background: transparent !important;
}
.sidenav-menu .simplebar-content-wrapper::-webkit-scrollbar-thumb,
.sidenav-menu [data-simplebar]::-webkit-scrollbar-thumb {
    background: rgba(129, 140, 248, 0.5) !important;
    border-radius: 999px !important;
}
.sidenav-menu .simplebar-content-wrapper::-webkit-scrollbar-thumb:hover,
.sidenav-menu [data-simplebar]::-webkit-scrollbar-thumb:hover {
    background: rgba(129, 140, 248, 0.85) !important;
}
.sidenav-menu .sidenav-user-box {
    position: relative !important;
    top: auto !important;
    bottom: auto !important;
    left: auto !important;
    right: auto !important;
    flex-shrink: 0 !important;
    margin: 6px 8px !important;
    padding: 8px 10px !important;
    z-index: 10 !important;
    background: var(--bs-card-bg, #ffffff) !important;
}

/* Mobile 390px topbar & hero pill polish (01/12/2026) */
@media (max-width: 767.98px) {
    .app-topbar .topbar-menu {
        gap: 6px !important;
        padding-left: 10px !important;
        padding-right: 10px !important;
    }
    .app-topbar .topbar-menu > div:first-child {
        flex-shrink: 0 !important;
        margin-right: 6px !important;
    }
    .app-topbar .topbar-menu > div:last-child {
        gap: 6px !important;
        flex-shrink: 1 !important;
        min-width: 0 !important;
    }
    .app-topbar #light-dark-mode {
        margin-left: 4px !important;
        flex-shrink: 0 !important;
    }
}
@media (max-width: 430px) {
    .app-topbar .topbar-menu > div:last-child .btn {
        padding-left: 8px !important;
        padding-right: 8px !important;
        font-size: 12px !important;
    }
    .app-topbar #light-dark-mode,
    .app-topbar .sidenav-toggle-button {
        width: 34px !important;
        height: 34px !important;
        padding: 0 !important;
    }
}
@media (max-width: 576px) {
    .se-hero-stagger .rounded-pill {
        border-radius: 14px !important;
        padding: 8px 14px !important;
        line-height: 1.4 !important;
        white-space: normal !important;
        display: inline-block !important;
        text-align: center !important;
        max-width: 100% !important;
    }
}
/* ==========================================================================
   SAI Marine Boron Neubrutalism Mobile App Dock (2026-12-04m1)
   Fixed 5-Tab Bottom App Dock (Light/Dark + VI/EN) + Floating Button Lift
   ========================================================================== */
.sm-mobile-dock {
    display: none;
}

@media (max-width: 991.98px) {
    .sm-mobile-dock {
        position: fixed;
        inset-inline: 0;
        bottom: 0;
        z-index: 1036;
        display: grid;
        grid-template-columns: repeat(5, minmax(0, 1fr));
        align-items: end;
        gap: 4px;
        background: #FFFFFF;
        border-top: 2px solid #000000;
        box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.08);
        padding: 6px 6px calc(6px + env(safe-area-inset-bottom, 0px));
    }
    [data-bs-theme="dark"] .sm-mobile-dock {
        background: #161821;
        border-top: 2px solid rgba(255, 255, 255, 0.22);
        box-shadow: 0 -8px 26px rgba(0, 0, 0, 0.48);
    }

    .sm-dock-item {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 2px;
        min-height: 48px;
        padding: 4px 2px;
        border-radius: 8px;
        border: 1.5px solid transparent;
        color: #475569 !important;
        text-decoration: none !important;
        font-family: 'Lexend', sans-serif;
        font-size: 10.5px;
        font-weight: 700;
        line-height: 1.15;
        text-align: center;
        min-width: 0;
        transition: transform 0.15s ease, background-color 0.15s ease;
    }
    [data-bs-theme="dark"] .sm-dock-item {
        color: #94A3B8 !important;
    }
    .sm-dock-item i {
        font-size: 19px;
        line-height: 1;
    }
    .sm-dock-item span {
        display: block;
        max-width: 100%;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    .sm-dock-item.is-active {
        background: #EEF2FF;
        color: #312E81 !important;
        border-color: #000000;
        box-shadow: 2px 2px 0 #000000;
    }
    [data-bs-theme="dark"] .sm-dock-item.is-active {
        background: rgba(99, 102, 241, 0.22);
        color: #C7D2FE !important;
        border-color: rgba(129, 140, 248, 0.55);
        box-shadow: none;
    }

    .sm-dock-item.sm-dock-primary {
        background: transparent !important;
        border-color: transparent !important;
        box-shadow: none !important;
        padding-top: 0;
    }
    .sm-dock-fab {
        width: 44px;
        height: 44px;
        margin-top: -18px;
        border-radius: 12px;
        background: #6366F1;
        color: #FFFFFF !important;
        border: 2px solid #000000;
        box-shadow: 2px 2px 0 #000000;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        transition: transform 0.15s ease;
    }
    [data-bs-theme="dark"] .sm-dock-fab {
        border-color: #FFFFFF;
        box-shadow: 2px 2px 0 rgba(0, 0, 0, 0.85);
    }
    .sm-dock-fab i {
        font-size: 20px;
        color: #FFFFFF !important;
    }
    .sm-dock-item.sm-dock-primary:active .sm-dock-fab {
        transform: translate(1px, 1px);
    }
    .sm-dock-item.sm-dock-primary > span:last-child {
        color: #4F46E5 !important;
        font-weight: 800;
        margin-top: 2px;
    }
    [data-bs-theme="dark"] .sm-dock-item.sm-dock-primary > span:last-child {
        color: #A5B4FC !important;
    }

    .se-to-top {
        bottom: calc(78px + env(safe-area-inset-bottom, 0px)) !important;
        right: 12px !important;
        z-index: 1034 !important;
    }
    .footer {
        padding-bottom: calc(84px + 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;
    }
}
/* QA Polish (2026-12-04m2): Dark mode hero badge contrast + drawer z-index + select picker-icon */
[data-bs-theme="dark"] .se-hero-stagger .badge.bg-dark {
    background-color: #0F172A !important;
    color: #FFFFFF !important;
}
select.form-select {
    -webkit-appearance: none !important;
    appearance: none !important;
    white-space: nowrap !important;
}
select.form-select::picker-icon,
select::picker-icon {
    display: none !important;
}
@media (max-width: 991.98px) {
    .sidenav-menu {
        z-index: 1045 !important;
    }
    #custom-backdrop {
        z-index: 1040 !important;
    }
}
