/* Khung mô phỏng 3 giá trị cốt lõi ở Hero Trang chủ (wwwroot/js/home-sim.js).
   Chưa có JavaScript: .hsim-window bị ẩn, 3 mục hiển thị như danh sách cũ (.hero-panel-item). */

.hsim.hsim-ready { padding: 1rem; }

/* ---- Cửa sổ phần mềm mini ---- */
.hsim-window {
    overflow: hidden;
    border-radius: 10px;
    background: #fff;
    box-shadow: 0 14px 34px rgba(0, 0, 0, .28);
}
.hsim-window[hidden] { display: none; }
.hsim-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    height: 30px;
    padding: 0 10px;
    border-bottom: 1px solid #e2e8f0;
    background: #f8fafc;
}
.hsim-title {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    color: #64748b;
    font-size: .72rem;
    font-weight: 600;
    text-align: center;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.hsim-live {
    display: inline-flex;
    flex: none;
    align-items: center;
    gap: 4px;
    padding: 1px 8px;
    border-radius: 999px;
    background: #ecfdf5;
    color: #047857;
    font-size: .66rem;
    font-weight: 700;
    white-space: nowrap;
}
.hsim-live i { width: 6px; height: 6px; border-radius: 50%; background: #10b981; animation: hsim-pulse 1.6s ease-in-out infinite; }
.hsim-live.is-paused { background: #fef3c7; color: #92400e; }
.hsim-live.is-paused i { background: #f59e0b; animation: none; }
@keyframes hsim-pulse { 50% { opacity: .35; } }

.hsim-viewport { position: relative; overflow: hidden; height: 214px; background: #f1f5f9; touch-action: manipulation; }
.hsim-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 420px;
    height: 214px;
    transform-origin: 0 0;
    color: #0f172a;
    font-family: var(--font-body, system-ui, sans-serif);
    font-size: 11px;
    line-height: 1.35;
    text-align: left;
    user-select: none;
}
.hsim-stage { position: absolute; inset: 0; padding: 10px; }
/* Chuyển giữa 3 màn hình: mờ dần rồi hiện dần (JS đổi nội dung giữa 2 pha). */
.hsim-canvas { transition: opacity .25s ease; }
.hsim-canvas.is-fading { opacity: 0; }

/* Con trỏ ảo + gợn sóng khi bấm */
.hsim-cursor {
    position: absolute;
    top: 0;
    left: 0;
    z-index: 6;
    width: 18px;
    height: 18px;
    transition: transform .6s cubic-bezier(.45, .05, .25, 1);
    pointer-events: none;
}
.hsim-cursor svg { position: relative; z-index: 1; display: block; filter: drop-shadow(0 1px 2px rgba(0, 0, 0, .3)); }
.hsim-ripple {
    position: absolute;
    top: -9px;
    left: -9px;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: rgba(217, 119, 6, .35);
    opacity: 0;
}
.hsim-cursor.is-click .hsim-ripple { animation: hsim-ripple .45s ease-out; }
@keyframes hsim-ripple { from { opacity: 1; transform: scale(.3); } to { opacity: 0; transform: scale(1.4); } }
.hsim-canvas .is-pressed { transform: scale(.95); }

.hsim-toast {
    position: absolute;
    bottom: 10px;
    left: 50%;
    z-index: 5;
    padding: 6px 12px;
    border-radius: 8px;
    background: #0f172a;
    color: #fff;
    font-size: 10.5px;
    font-weight: 600;
    white-space: nowrap;
    opacity: 0;
    transform: translate(-50%, 8px);
    transition: opacity .25s ease, transform .25s ease;
    pointer-events: none;
}
.hsim-toast.is-show { opacity: 1; transform: translate(-50%, 0); }
/* Kịch bản 1: thông báo nằm trên cùng để không che hàng món và ô số liệu. */
.hsim-scene-1 ~ .hsim-toast { top: 7px; bottom: auto; }

/* ---- Thành phần dùng chung trong màn hình ---- */
.hs-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 7px; }
.hs-head b { font-size: 12px; }
.hs-chip { padding: 1px 7px; border-radius: 999px; background: #e6f0eb; color: #005331; font-size: 9.5px; font-weight: 700; }
.hs-kpi { display: flex; flex-direction: column; padding: 7px 9px; border: 1px solid #e2e8f0; border-radius: 8px; background: #fff; }
.hs-kpi span { color: #64748b; font-size: 9.5px; }
.hs-kpi b { color: #0f172a; font-size: 15px; font-variant-numeric: tabular-nums; }
.hs-kpi em { color: #059669; font-size: 9.5px; font-style: normal; font-weight: 700; min-height: 1em; }
.hs-kpi b.is-flash { color: #b45309; }

/* Kịch bản 1: sơ đồ bàn + món + KPI */
.hs-ops { display: grid; grid-template-columns: 1fr 132px; gap: 9px; height: 100%; }
.hs-col { display: flex; flex-direction: column; }
.hs-tables { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.hs-table {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 44px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    background: #fff;
    font-weight: 700;
    transition: background .25s ease, border-color .25s ease, transform .15s ease;
}
.hs-table small { color: #64748b; font-size: 9px; font-weight: 600; }
.hs-table.is-busy { border-color: #f59e0b; background: #fffbeb; }
.hs-table.is-busy small { color: #b45309; }
.hs-menu { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-top: auto; }
.hs-item {
    display: flex;
    flex-direction: column;
    padding: 6px 7px;
    border-radius: 8px;
    background: #005331;
    color: #fff;
    font-weight: 700;
    transition: transform .15s ease;
}
.hs-item small { color: #fcd34d; font-size: 9.5px; }
.hs-side { display: flex; flex-direction: column; gap: 6px; }
/* Cột số liệu: nhãn trên, số + đơn vị cùng 1 hàng để vừa 3 ô trong chiều cao màn hình. */
.hs-side .hs-kpi { flex: 1; flex-direction: row; flex-wrap: wrap; align-content: center; align-items: baseline; gap: 0 4px; padding: 4px 9px; }
.hs-side .hs-kpi span { flex-basis: 100%; }
.hs-side .hs-kpi b { font-size: 14px; }

/* Kịch bản 2: bảng chứng từ + bút toán + thuế */
.hs-btn { padding: 3px 9px; border-radius: 6px; background: #005331; color: #fff; font-size: 10px; font-weight: 700; transition: background .2s ease, transform .15s ease; }
.hs-btn.is-on { background: #d97706; }
.hs-grid { overflow: hidden; border: 1px solid #e2e8f0; border-radius: 8px; background: #fff; }
.hs-tr { display: grid; grid-template-columns: 56px 1fr 74px 82px; align-items: center; gap: 6px; height: 22px; padding: 0 8px; border-top: 1px solid #f1f5f9; font-size: 10px; transition: background .25s ease; }
.hs-tr span:nth-child(2) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hs-tr span:nth-child(3) { text-align: right; font-variant-numeric: tabular-nums; }
.hs-th { border-top: 0; background: #f8fafc; color: #64748b; font-size: 9.5px; font-weight: 700; }
.hs-tr.is-scan { background: #ecfdf5; }
.hs-st { justify-self: start; padding: 1px 6px; border-radius: 999px; background: #f1f5f9; color: #64748b; font-size: 9px; font-weight: 700; white-space: nowrap; }
.hs-st.is-ok { background: #d1fae5; color: #047857; }
.hs-foot { display: grid; grid-template-columns: 1fr 140px; gap: 8px; margin-top: 7px; }
.hs-journal { display: flex; flex-direction: column; gap: 4px; }
.hs-journal span { padding: 4px 8px; border-left: 3px solid #005331; border-radius: 4px; background: #fff; font-size: 10px; font-weight: 600; opacity: 0; transform: translateX(-6px); transition: opacity .3s ease, transform .3s ease; }
.hs-journal span.is-show { opacity: 1; transform: none; }
.hs-kpi-sm { padding: 5px 8px; }
.hs-kpi-sm b { font-size: 13.5px; }
.hs-banner {
    position: absolute;
    top: 8px;
    right: 10px;
    left: 10px;
    padding: 6px 10px;
    border-radius: 8px;
    background: #047857;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    text-align: center;
    opacity: 0;
    transform: translateY(-6px);
    transition: opacity .3s ease, transform .3s ease;
}
.hs-banner.is-show { opacity: 1; transform: none; }

/* Kịch bản 3: hộp thoại hỗ trợ KTV */
.hs-chat { display: flex; flex-direction: column; height: 100%; overflow: hidden; border: 1px solid #e2e8f0; border-radius: 8px; background: #fff; }
.hs-chat-head { display: flex; align-items: center; gap: 7px; padding: 6px 9px; border-bottom: 1px solid #f1f5f9; }
.hs-chat-head > div { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.hs-chat-head b { font-size: 11px; }
.hs-chat-head small { color: #64748b; font-size: 9px; }
.hs-chat-head small i { display: inline-block; width: 6px; height: 6px; margin-right: 2px; border-radius: 50%; background: #10b981; }
/* Avatar KTV: tai nghe tổng đài trên nền tròn xanh ngọc dịu + chấm trực tuyến. */
.hs-ava { position: relative; display: inline-flex; align-items: center; justify-content: center; flex: none; width: 26px; height: 26px; border-radius: 50%; background: #ccfbf1; color: #0f766e; box-shadow: inset 0 0 0 1px #99f6e4; }
.hs-ava svg { display: block; }
.hs-ava-dot { position: absolute; right: -1px; bottom: -1px; width: 8px; height: 8px; border: 2px solid #fff; border-radius: 50%; background: #22c55e; }
.hs-tag { flex: none; padding: 1px 6px; border-radius: 5px; color: #fff; font-size: 9px; font-weight: 700; }
.hs-zalo { background: #0068ff; }
.hs-uv { background: #0f766e; }
.hs-msgs { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; gap: 5px; padding: 6px 9px; overflow: hidden; background: #f8fafc; }
.hs-msg { max-width: 78%; padding: 5px 8px; border-radius: 10px; font-size: 10.5px; animation: hsim-msg .3s ease; }
.hs-msg small { display: block; margin-top: 1px; color: inherit; font-size: 8.5px; opacity: .65; }
.hs-me { align-self: flex-end; border-bottom-right-radius: 3px; background: #005331; color: #fff; }
.hs-emd { align-self: flex-start; border-bottom-left-radius: 3px; background: #fff; box-shadow: 0 1px 2px rgba(15, 23, 42, .12); }
@keyframes hsim-msg { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.hs-uvcard { display: inline-block; padding: 1px 6px; border-radius: 5px; background: rgba(255, 255, 255, .16); }
.hs-typing { display: inline-flex; gap: 3px; padding: 2px 0; }
.hs-typing i { width: 5px; height: 5px; border-radius: 50%; background: #94a3b8; animation: hsim-dot 1s ease-in-out infinite; }
.hs-typing i:nth-child(2) { animation-delay: .15s; }
.hs-typing i:nth-child(3) { animation-delay: .3s; }
@keyframes hsim-dot { 50% { opacity: .3; transform: translateY(-2px); } }
.hs-conn { display: none; padding: 5px 9px 32px; border-top: 1px solid #f1f5f9; font-size: 10px; font-weight: 700; color: #0f766e; }
.hs-conn.is-show { display: block; }
.hs-conn i { display: block; height: 3px; margin-top: 3px; overflow: hidden; border-radius: 999px; background: #e2e8f0; }
.hs-conn i b { display: block; width: 0; height: 100%; background: #0f766e; transition: width 1s linear; }
.hs-conn.is-ok { color: #047857; }

/* ---- 3 thẻ giá trị: thẻ đang chạy sáng viền + thanh tiến trình ---- */
.hsim-ready .hsim-cards { display: flex; flex-direction: column; gap: 6px; margin-top: .85rem; }
.hsim-ready .hsim-card {
    position: relative;
    gap: .75rem;
    padding: .6rem .75rem .7rem;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, .14);
    border-radius: 10px;
    background: rgba(255, 255, 255, .04);
    cursor: pointer;
    transition: background var(--emd-ease), border-color var(--emd-ease), box-shadow var(--emd-ease);
}
.hsim-ready .hsim-card + .hsim-card { border-top: 1px solid rgba(255, 255, 255, .14); }
.hsim-ready .hsim-card i { font-size: 1.3rem; line-height: 1.3; }
.hsim-ready .hsim-card h2 { font-size: .95rem; }
/* Mô tả: thẻ đang chạy mở ra, thẻ khác thu gọn (chữ vẫn nằm trong trang cho SEO / trình đọc màn hình). */
.hsim-ready .hsim-card p {
    max-height: 0;
    overflow: hidden;
    font-size: .82rem;
    line-height: 1.5;
    opacity: 0;
    transition: max-height .35s ease, opacity .3s ease, margin .35s ease;
}
.hsim-ready .hsim-card.is-active p { max-height: 9em; margin-top: .15rem; opacity: 1; }
.hsim-ready .hsim-card h2 { margin-bottom: 0; }
.hsim-ready .hsim-card:hover { background: rgba(255, 255, 255, .08); }
.hsim-ready .hsim-card:focus-visible { outline: 2px solid var(--emd-accent-light); outline-offset: 2px; }
.hsim-ready .hsim-card.is-active {
    border-color: var(--emd-accent-light);
    background: rgba(255, 255, 255, .1);
    box-shadow: 0 0 0 1px rgba(252, 211, 77, .35), 0 8px 20px rgba(0, 0, 0, .18);
}
.hsim-progress { position: absolute; right: 0; bottom: 0; left: 0; height: 3px; background: rgba(255, 255, 255, .08); }
.hsim-progress i { display: block; width: 0; height: 100%; background: var(--emd-accent-light); }
.hsim-card:not(.is-active) .hsim-progress { opacity: 0; }

/* JS đang đo chiều cao lớn nhất của vùng 3 thẻ: tắt chuyển động để số đo chính xác. */
.hsim-measuring .hsim-card,
.hsim-measuring .hsim-card p { transition: none !important; }

/* ---- Cột trái Hero: dải 3 chỉ số tin cậy + dòng hệ sinh thái luân chuyển ---- */
/* Cột trái Hero căn giữa một trục: nhãn vàng, H1, đoạn mô tả, cụm 2 nút, dải chỉ số, dòng giải pháp. */
.hero .hero-main { text-align: center; }
/* Đoạn mô tả: căn đều 2 bên thực sự (dòng cuối căn trái → 2 mép vuông vức), sát H1 (~13px). */
.hero .hero-main .hero-lead { margin-top: 13px !important; margin-bottom: 0 !important; text-align: justify; text-align-last: left; text-justify: inter-word; }
.hero .hero-cta-group { justify-content: center; }
/* Cụm 2 nút + 3 chỉ số + dòng giải pháp nối liền đoạn mô tả (~26px), không tách thành 2 mảng.
   Máy tính: lưới 2 cột giữ align-items: center → cả cột trái gom thành một khối nằm giữa theo trục dọc so với khung mô phỏng. */
.hero .hero-bottom { margin-top: 26px; }
.hero-stats {
    display: grid;
    grid-template-columns: repeat(3, auto);
    justify-content: center;
    margin: 1.75rem 0 0;
    padding: 0;
    list-style: none;
}
.hero-stats li { display: flex; flex-direction: column; align-items: center; padding: 0 1.75rem; border-left: 1px solid rgba(255, 255, 255, .15); text-align: center; }
.hero-stats li:first-child { border-left: 0; }
.hero-stats b {
    color: var(--emd-accent-light);
    font-family: var(--font-heading);
    font-size: 1.75rem;
    font-weight: 800;
    line-height: 1.15;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}
.hero-stats span { color: rgba(255, 255, 255, .85); font-size: .85rem; line-height: 1.4; text-wrap: balance; }
/* Máy tính rộng: nhãn nằm gọn 1 dòng; màn hẹp hơn chia đều 2 dòng (text-wrap: balance), không rớt 1 chữ lẻ. */
@media (min-width: 1200px) {
    .hero-stats li { padding: 0 1.5rem; }
    .hero-stats span { white-space: nowrap; }
}
.hero-eco {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    margin: 1.1rem 0 0;
    text-align: center;
    color: rgba(255, 255, 255, .78);
    font-size: .85rem;
    line-height: 1.5;
}
.hero-eco > i { flex: none; color: #34d399; font-size: .55rem; animation: hsim-pulse 1.8s ease-in-out infinite; }
.hero-eco strong { flex: none; color: #fff; font-weight: 600; }
/* JS bật luân chuyển: mỗi lần hiện 1 mảng, mờ + trượt nhẹ (không JS: hiện đủ cả câu). */
.hero-eco-text { min-width: 0; }
.hero-eco-item { color: var(--emd-accent-light); font-weight: 600; }
/* JS bật luân chuyển: ẩn danh sách đầy đủ, chỉ hiện MỘT phần tử chữ (.hero-eco-current).
   Đổi tên: mờ về 0 (250ms) → thay chữ → hiện lại (250ms); không bao giờ có 2 chữ chồng nhau.
   Bề rộng tối thiểu = tên dài nhất (JS đo) để dòng không xê dịch khi đổi tên. */
.hero-eco.is-rotating .hero-eco-items { display: none; }
.hero-eco-current {
    display: inline-block;
    max-width: 100%;
    overflow: hidden;
    color: var(--emd-accent-light);
    font-weight: 600;
    text-align: left;
    text-overflow: ellipsis;
    white-space: nowrap;
    vertical-align: top;
    transition: opacity .25s ease;
}
.hero-eco-current.is-fading { opacity: 0; }
@media (max-width: 575.98px) {
    /* Cột giữa (mô tả dài hơn) rộng hơn để 3 nhãn cùng 2 dòng. */
    .hero-stats { grid-template-columns: 1fr 1.25fr 1fr; margin-top: 1.4rem; }
    .hero-stats li { padding: 0 .5rem; }
    .hero-stats b { font-size: 1.35rem; }
    .hero-stats span { font-size: .74rem; }
    /* Điện thoại: nhãn và tên xuống 2 dòng căn giữa → bỏ chấm xanh để không lơ lửng bên trái. */
    .hero-eco { font-size: .8rem; }
    .hero-eco > i { display: none; }
}

@media (max-width: 575.98px) {
    .hsim.hsim-ready { padding: .75rem; }
    .hsim-ready .hsim-card p { font-size: .8rem; }
}
@media (prefers-reduced-motion: reduce) {
    .hsim-stage, .hs-msg, .hsim-live i, .hs-typing i, .hero-eco > i { animation: none !important; }
    .hsim-canvas, .hero-eco-current { transition: none !important; }
    .hsim-cursor { display: none; }
    .hsim-toast, .hs-journal span, .hs-banner, .hs-conn i b, .hsim-ready .hsim-card { transition: none !important; }
}
