﻿/* Giao dien kieu app tren dien thoai (< 992px): app bar 56px, thanh tab duoi 5 muc, bottom sheet; footer may tinh.
   Giao dien may tinh giu nguyen (tru footer). JS: js/ctmt-mobile.js */

:root { --ct-tab-h: 64px; }

/* ===== Footer (may tinh + dien thoai) ===== */
.ct-footer { background: linear-gradient(135deg, #8E1A1D 0%, #6E1013 100%); border-top: 4px solid var(--ct-gold, #E3B341); color: #F6D6D3; } /* cung tong do - vang voi header */
.ct-footer__in { max-width: 1360px; margin: 0 auto; padding: 28px 24px; display: flex; flex-wrap: wrap; gap: 16px 48px; justify-content: space-between; }
.ct-footer__ten { font-size: 17px; font-weight: 800; color: #FFFFFF; }
.ct-footer__lh { font-size: 14px; margin-top: 8px; line-height: 1.7; }
.ct-footer__chu { font-size: 13px; max-width: 380px; line-height: 1.7; }
.ct-footer__lk { margin-top: 6px; }
body.ctmt-app .ct-footer a { color: #FBE7C2; }
body.ctmt-app .ct-footer a:hover { color: #FFFFFF; }

/* An tren may tinh */
.ct-portal-hdr__t3, .ct-appbar__act, .ct-locchip { display: none; }
.ct-sheet { display: none; }
/* Chi hien tren dien thoai (vi du muc chon kieu thanh tab o vn/CaiDat.aspx) */
@media (min-width: 992px) { .ct-chi-dt { display: none !important; } }

@media (max-width: 991.98px) {
    body.ctmt-app { padding-bottom: calc(var(--ct-tab-h) + env(safe-area-inset-bottom, 0px)); }

    /* ----- App bar ----- */
    body.ctmt-app .ct-hdr-live,
    body.ctmt-app .ct-portal-nav,
    body.ctmt-app .breadcrumb-bar,
    body.ctmt-app header.ct-portal-hdr .ct-portal-hdr__login,
    body.ctmt-app .ct-ticker:not(.is-trong),
    body.ctmt-app header.ct-portal-hdr .ct-portal-hdr__t2 { display: none !important; }
    body.ctmt-app header.ct-portal-hdr.site-header {
        position: sticky !important; top: 0; z-index: 1020;
        transition: transform .22s ease; will-change: transform;
    }
    body.ctmt-app header.ct-portal-hdr.site-header.is-an { transform: translateY(-100%); }
    /* Logo sat le trai, 2 nut sat le phai, sat nhau: danh het chieu rong cho ten chuong trinh mot dong */
    body.ctmt-app header.ct-portal-hdr .ct-portal-hdr__in {
        flex-wrap: nowrap; align-items: center; gap: 4px; min-height: 56px; max-width: none; margin: 0;
        padding: calc(6px + env(safe-area-inset-top, 0px)) max(2px, env(safe-area-inset-right, 0px)) 6px max(6px, env(safe-area-inset-left, 0px));
    }
    body.ctmt-app header.ct-portal-hdr .ct-portal-hdr__phai { display: none !important; }
    body.ctmt-app header.ct-portal-hdr .ct-portal-hdr__brand { flex: 1 1 auto; gap: 7px; min-width: 0; }
    body.ctmt-app header.ct-portal-hdr .ct-portal-hdr__brand > span { flex: 1 1 auto; min-width: 0; }
    body.ctmt-app header.ct-portal-hdr .ct-portal-hdr__logo { width: 36px; height: 36px; flex: none; }
    /* Co chu tu co gian theo chieu rong con lai (logo + 2 nut ~ 160px; ~18,5em cho 30 ky tu in hoa); js/ctmt-mobile.js tinh chinh cho vua khit */
    body.ctmt-app header.ct-portal-hdr .ct-portal-hdr__t1 {
        font-size: clamp(11px, calc((100vw - 130px) / 18.5), 22px); letter-spacing: .2px; line-height: 1.2;
        white-space: nowrap; overflow: hidden; text-overflow: clip;
    }
    body.ctmt-app header.ct-portal-hdr .ct-portal-hdr__t1.is-2dong { white-space: normal; font-size: 12.5px; line-height: 1.15; }
    /* May tinh bang: phu de day du (js them .is-phude khi tieu de da o co toi da ma con thua cho) */
    body.ctmt-app header.ct-portal-hdr.is-phude .ct-portal-hdr__t2 { display: block !important; white-space: nowrap; overflow: hidden; margin-top: 2px; }
    body.ctmt-app header.ct-portal-hdr.is-phude .ct-portal-hdr__t3 { display: none; }
    body.ctmt-app header.ct-portal-hdr .ct-portal-hdr__t3 { font-size: clamp(11px, calc((100vw - 160px) / 26), 16px); }
    body.ctmt-app header.ct-portal-hdr .ct-portal-hdr__t3 { display: block; font-size: 12px; font-weight: 700; color: #F6C453; line-height: 1.3; }
    .ct-appbar__act { display: flex; flex-shrink: 0; gap: 0; margin-left: auto; }
    body.ctmt-app .ct-appbar__btn {
        position: relative; width: 38px; height: 44px; border: 0; border-radius: 12px; background: transparent;
        display: inline-flex; align-items: center; justify-content: center; color: #FFFFFF !important; font-size: 1.25rem; text-decoration: none;
    }
    body.ctmt-app .ct-appbar__btn:active { background: rgba(255, 255, 255, .15); }
    .ct-appbar__so {
        position: absolute; top: 5px; right: 0; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
        background: #F6C453; color: #5A1010; font-size: 11px; font-weight: 800; line-height: 18px; text-align: center;
    }

    /* ----- Noi dung ----- */
    body.ctmt-app .main-content > .container-fluid { padding-left: 12px !important; padding-right: 12px !important; padding-top: 12px !important; }
    /* Dai "Moi cap nhat": chi trang chu, mot dong, dat dau noi dung (JS chuyen vao) */
    .ct-ticker.is-trong { margin: -12px -12px 12px; }
    .ct-ticker.is-trong .ct-ticker__in { padding: 6px 12px; gap: 8px; }
    .ct-ticker.is-trong .ct-ticker__badge { font-size: 10px; padding: 3px 7px; }
    .ct-ticker.is-trong .ct-ticker__more { display: none; }
    /* Chip bo loc ky, dia ban */
    body.ctmt-app .ct-locchip {
        display: inline-flex; align-items: center; gap: 8px; max-width: 100%; margin: 0 0 12px; padding: 0 14px; min-height: 40px;
        border: 1.5px solid #E7C9C6; border-radius: 999px; background: #FFFFFF; color: var(--ct-red, #9F1C1F); font-weight: 700; font-size: 14px;
    }
    .ct-locchip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    #shLocThan .ct-portal-nav__filters { display: flex; flex-direction: column; align-items: stretch; gap: 8px; }
    #shLocThan label { font-weight: 700; font-size: 14px; margin: 4px 0 0; }
    #shLocThan select { width: 100% !important; max-width: none !important; min-height: 46px; font-size: 16px; }
    /* Thanh dieu huong con: hang chip cuon ngang */
    body.ctmt-app .pub-quick { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding: 4px 8px; border-radius: 12px; }
    body.ctmt-app .pub-quick::-webkit-scrollbar { display: none; }
    body.ctmt-app .pub-quick > * { flex-shrink: 0; white-space: nowrap; }
    body.ctmt-app .pub-quick__pill { min-height: 36px; padding: 0 12px; font-size: 13px; }
    .pub-page { gap: 14px; }
    .pub-h1 { font-size: 24px; }
    /* KPI 2 x 2 */
    body.ctmt-app .ct-kpi { display: grid !important; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
    body.ctmt-app .ct-kpi__card { flex-direction: column; align-items: flex-start; gap: 2px; padding: 12px 14px; min-width: 0; }
    body.ctmt-app .ct-kpi__card .num { font-size: 24px; }
    body.ctmt-app .ct-kpi__card .lbl { font-size: 12.5px; line-height: 1.3; margin-top: 2px; }
    /* Banner cai app: the noi tren thanh tab, chi tu lan mo thu 2 */
    body.ctmt-app > .pwa-ios-hint:not([hidden]) {
        position: fixed; left: 10px; right: 10px; bottom: calc(var(--ct-tab-h) + env(safe-area-inset-bottom, 0px) + 10px); z-index: 1031;
        border-radius: 14px; box-shadow: 0 10px 28px rgba(0, 0, 0, .25); background: linear-gradient(90deg, #9F1C1F, #7A1416);
    }
    html.ct-pwa-sau body.ctmt-app > .pwa-ios-hint { display: none !important; }
    /* Footer gon */
    .ct-footer__in { padding: 20px 16px; gap: 12px; }
    .ct-footer__ten { font-size: 15px; }
    .ct-footer__lh, .ct-footer__chu { font-size: 13px; }

    /* ----- Thanh tab duoi ----- */
    body.ctmt-app .ct-tabbar { height: calc(var(--ct-tab-h) + env(safe-area-inset-bottom, 0px)); border-top-color: #E6E9ED; box-shadow: 0 -2px 12px rgba(15, 27, 42, .06); }
    body.ctmt-app .ct-tabbar > a, body.ctmt-app .ct-tabbar > button {
        flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; min-width: 0;
        border: 0; background: transparent; font: inherit; font-size: 11px; font-weight: 600; color: #5F6B77; text-decoration: none; position: relative;
    }
    body.ctmt-app .ct-tabbar > * i { font-size: 1.3rem; line-height: 1; }
    body.ctmt-app .ct-tabbar > * span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; padding: 0 2px; }
    body.ctmt-app .ct-tabbar > .is-active, body.ctmt-app .ct-tabbar > [aria-expanded="true"] { color: var(--ct-red, #9F1C1F); }
    /* Dang chuyen trang (js/ctmt-mobile.js): icon xoay o tab vua bam, tab khac mo di */
    body.ctmt-app .ct-tabbar > .is-loading { pointer-events: none; }
    body.ctmt-app .ct-tabbar.is-dang-chuyen > :not(.is-loading) { opacity: .5; }
    .ct-tab-xoay { display: inline-block; animation: ct-tab-xoay .7s linear infinite; }
    @keyframes ct-tab-xoay { to { transform: rotate(360deg); } }
    body.ctmt-app .ct-tabbar > .is-active::before {
        content: ""; position: absolute; top: 0; left: 30%; right: 30%; height: 3px; border-radius: 0 0 3px 3px; background: var(--ct-red, #9F1C1F);
    }
    html[data-tabbar-style="brand"] body.ctmt-app .ct-tabbar { background: #9F1C1F; border-color: #9F1C1F; }
    html[data-tabbar-style="brand"] body.ctmt-app .ct-tabbar > * { color: rgba(255, 255, 255, .78); }
    html[data-tabbar-style="brand"] body.ctmt-app .ct-tabbar > .is-active,
    html[data-tabbar-style="brand"] body.ctmt-app .ct-tabbar > [aria-expanded="true"] { color: #FFFFFF; }
    html[data-tabbar-style="brand"] body.ctmt-app .ct-tabbar > .is-active::before { background: #F6C453; }
    html[data-tabbar-style="minimal"] body.ctmt-app .ct-tabbar > * span { display: none; }
    html[data-tabbar-style="minimal"] body.ctmt-app .ct-tabbar { background: rgba(255, 255, 255, .98); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
        border-top: 1px solid #E6E9ED; box-shadow: 0 -2px 12px rgba(15, 27, 42, .08); }
    html[data-tabbar-style="minimal"] body.ctmt-app .ct-tabbar > * i { font-size: 1.45rem; }
    /* Ban phim dang mo: an thanh tab */
    body.ctmt-app.ct-kb-mo .ct-tabbar { display: none; }
    body.ctmt-app.ct-kb-mo { padding-bottom: 0; }

    /* ----- Bottom sheet ----- */
    .ct-sheet { display: block; position: fixed; inset: 0; z-index: 1045; }
    .ct-sheet[hidden] { display: none; }
    .ct-sheet__nen { position: absolute; inset: 0; background: rgba(15, 27, 42, .45); opacity: 0; transition: opacity .2s; }
    .ct-sheet__khung {
        position: absolute; left: 0; right: 0; bottom: 0; max-height: 86vh; display: flex; flex-direction: column;
        background: #FFFFFF; border-radius: 20px 20px 0 0; box-shadow: 0 -10px 30px rgba(0, 0, 0, .2);
        transform: translateY(100%); transition: transform .24s cubic-bezier(.2, .8, .2, 1); padding-bottom: env(safe-area-inset-bottom, 0px);
    }
    .ct-sheet.is-mo .ct-sheet__nen { opacity: 1; }
    .ct-sheet.is-mo .ct-sheet__khung { transform: translateY(0); }
    .ct-sheet__dau { position: relative; display: flex; align-items: center; justify-content: space-between; padding: 18px 12px 8px 18px; touch-action: none; }
    .ct-sheet__keo { position: absolute; top: 7px; left: 50%; width: 40px; height: 4px; margin-left: -20px; border-radius: 2px; background: #D3D9DF; }
    .ct-sheet__dau h2 { margin: 0; font-size: 18px; font-weight: 800; }
    .ct-sheet__dong { width: 40px; height: 40px; border: 0; border-radius: 50%; background: #F2F4F7; color: #3B4652; }
    .ct-sheet__than { overflow-y: auto; overscroll-behavior: contain; padding: 4px 14px 18px; -webkit-overflow-scrolling: touch; }
    .ct-sheet__h { margin: 14px 4px 8px; font-size: 12px; font-weight: 800; letter-spacing: .4px; text-transform: uppercase; color: #6B7A86; }
    .ct-sheet__luoi { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
    .ct-sheet__luoi--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    body.ctmt-app a.ct-sheet__o {
        display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; min-height: 78px; padding: 8px 4px;
        border-radius: 14px; background: #F7F8FA; color: #1F2A36; text-align: center; font-size: 12.5px; font-weight: 600; line-height: 1.25; text-decoration: none;
    }
    .ct-sheet__o i { font-size: 1.35rem; color: var(--ct-red, #9F1C1F); }
    body.ctmt-app a.ct-sheet__lv {
        display: flex; gap: 10px; align-items: center; padding: 12px; min-height: 72px; border-radius: 14px; border: 1px solid #E6E9ED;
        color: #1F2A36; text-decoration: none;
    }
    .ct-sheet__ic {
        flex-shrink: 0; width: 40px; height: 40px; border-radius: 12px; display: inline-flex; align-items: center; justify-content: center;
        background: color-mix(in srgb, var(--lv) 14%, #FFFFFF); color: var(--lv); font-size: 1.2rem;
    }
    .ct-sheet__lv b { display: block; font-size: 14px; line-height: 1.25; }
    .ct-sheet__lv small { display: block; font-size: 11px; color: #6B7A86; line-height: 1.3; margin-top: 2px; }
    .ct-sheet__toi { display: flex; gap: 10px; align-items: center; padding: 10px 12px; margin-bottom: 4px; border-radius: 14px; background: #FCEDEA; }
    .ct-sheet__toi > i { font-size: 1.8rem; color: var(--ct-red, #9F1C1F); }
    .ct-sheet__toi span { flex: 1; min-width: 0; }
    .ct-sheet__toi b { display: block; font-size: 14px; }
    .ct-sheet__toi small { color: #6B7A86; font-size: 12px; }
    body.ctmt-app .ct-sheet__toi a { font-weight: 700; color: var(--ct-red, #9F1C1F); }
    .ct-sheet__nhom { margin-top: 10px; border: 1px solid #E6E9ED; border-radius: 14px; overflow: hidden; }
    .ct-sheet__nhom summary {
        display: flex; justify-content: space-between; align-items: center; padding: 12px 14px; min-height: 46px; cursor: pointer; list-style: none;
        font-weight: 800; font-size: 14px; background: #F7F8FA;
    }
    .ct-sheet__nhom summary::-webkit-details-marker { display: none; }
    .ct-sheet__nhom summary span { font-size: 12px; color: #6B7A86; font-weight: 700; }
    .ct-sheet__nhom summary span::after { content: " ▾"; }
    .ct-sheet__nhom[open] summary span::after { content: " ▴"; }
    .ct-sheet__ds { display: flex; flex-direction: column; }
    .ct-sheet__ds--khung { border: 1px solid #E6E9ED; border-radius: 14px; overflow: hidden; }
    body.ctmt-app .ct-sheet__ds a {
        display: flex; align-items: center; gap: 12px; min-height: 46px; padding: 8px 14px; border-top: 1px solid #F0F2F5;
        color: #1F2A36; text-decoration: none; font-size: 14px;
    }
    .ct-sheet__ds--khung a:first-child { border-top: 0; }
    .ct-sheet__ds a i { width: 20px; text-align: center; color: #6B7A86; }
    body.ct-sheet-mo { overflow: hidden; }
}

@media (max-width: 991.98px) and (prefers-reduced-motion: reduce) {
    body.ctmt-app header.ct-portal-hdr.site-header, .ct-sheet__khung, .ct-sheet__nen { transition: none; }
}

/* Mobile: footer chỉ hiện ở trang chủ — trang khác dành chỗ cho nội dung */
@media (max-width: 991.98px) {
    body.ctmt-app:not(.ct-home) .ct-footer { display: none; }
}

/* Sheet "Giao dien trang chu" (CtmtMauGiaoDien.VeSheet): moi mau mot dong, mau dang dung co dau check */
@media (max-width: 991.98px) {
    .ct-mgd-sheet__goi-y { margin: 0 0 10px; font-size: 13px; color: #5B6672; }
    .ct-mgd-sheet__muc {
        display: flex; align-items: center; gap: 12px; width: 100%; min-height: 50px; padding: 8px 14px;
        border: 0; border-top: 1px solid #F0F2F5; background: #fff; color: #1F2A36; font-size: 14px; text-align: left;
    }
    .ct-sheet__ds--khung .ct-mgd-sheet__muc:first-child { border-top: 0; }
    .ct-mgd-sheet__muc > i { width: 20px; text-align: center; font-size: 18px; color: #1B6B2A; visibility: hidden; }
    .ct-mgd-sheet__muc span { display: flex; flex-direction: column; min-width: 0; }
    .ct-mgd-sheet__muc small { font-size: 12px; color: #6B7A86; }
    .ct-mgd-sheet__muc.is-chon { background: #E8F5E9; font-weight: 700; }
    .ct-mgd-sheet__muc.is-chon > i { visibility: visible; }
    .ct-mgd-sheet__muc:active { background: #F4F6F8; }
}

/* Sheet "Them" › Tai khoan, ung dung: mot hang ngang, icon tren chu ngan (vn/Site.Master.vb SheetsHtml) */
@media (max-width: 991.98px) {
    .ct-sheet__ds--ngang { flex-direction: row; }
    body.ctmt-app .ct-sheet__ds--ngang a {
        flex: 1 1 0; min-width: 0; flex-direction: column; justify-content: center; gap: 4px;
        min-height: 62px; padding: 8px 4px; border-top: 0; border-left: 1px solid #F0F2F5;
        font-size: 12.5px; text-align: center; line-height: 1.2;
    }
    body.ctmt-app .ct-sheet__ds--ngang a:first-child { border-left: 0; }
    .ct-sheet__ds--ngang a i { width: auto; font-size: 20px; }
}
