/* ==========================================================================
   sai-effects.css — HIEU UNG LUCIAN (Worker W3, 24/11/2026)
   Component chung + asset dung chung cho web AI Gateway sai-marine.com.
   Quy tac: uu tien transform/opacity cho animation (tranh layout shift).
   Ngoai le co chu dich (khong gay CLS vi phan tu absolute hoac theo
   dung ky thuat brief yeu cau): width cua .se-pill-ind (absolute),
   grid-template-rows cua .se-faq-a (0fr->1fr theo mau 044),
   filter hover cua .se-btn-glass.
   Cuoi file co khoi prefers-reduced-motion tat het animation/transition.
   ========================================================================== */

/* --- Nut chinh theme SANG: nen trang mo, vien gradient indigo -> cyan --- */
.se-btn-glass {
    background: rgba(255, 255, 255, .55);
    -webkit-backdrop-filter: blur(14px) saturate(1.4);
    backdrop-filter: blur(14px) saturate(1.4);
    border: 1px solid transparent;
    border-image: linear-gradient(90deg, #4f46e5, #06b6d4) 1;
    color: #4f46e5;
    font-weight: 700;
    transition: filter .25s ease, opacity .25s ease;
}
.se-btn-glass:hover {
    filter: brightness(1.08);
    opacity: .95;
}

/* --- Nut vien conic-gradient chay vong --- */
@property --se-angle {
    syntax: "<angle>";
    initial-value: 0deg;
    inherits: false;
}
.se-btn-glow {
    /* Fallback: vien gradient TINH khi trinh duyet khong ho tro @property
       (bien --se-angle khong chay animation -> conic dung yen o 0deg,
       van la vien gradient dep, khong vo giao dien). */
    border: 2px solid transparent;
    border-color: transparent !important; /* thang .border-dark !important cua Bootstrap de conic hien ra */
    border-radius: 8px;
    background:
        linear-gradient(#fff, #fff) padding-box,
        conic-gradient(from var(--se-angle, 0deg), #4f46e5, #06b6d4, #14b8a6, #4f46e5) border-box;
    animation: se-spin-angle 3s linear infinite;
}
@keyframes se-spin-angle {
    to { --se-angle: 360deg; }
}

/* --- (v2, 24/11) Nut glass + glow tren bien the btn-primary ---
   NGUYEN NHAN GOC (kiem chung live 24/11): <style> inline trong header.php
   (nap SAU moi <link>, khoang dong 515) co:
     .btn-primary { background-color:#6366F1 !important; border:2px solid #000 !important; color:#fff !important; }
     .btn-primary:hover { background-color:#4F46E5 !important; color:#fff !important; }
   (1) .se-btn-glass { color:#4f46e5 } khong !important nen thua
       color:#fff !important -> chu trang.
   (2) background cua .se-btn-glow ve lop trang duc linear-gradient(#fff,#fff)
       padding-box PHU LEN background-color indigo (background-color chi la lop
       duoi cung; background-image ve tren no) -> mat nut trang.
       Trang-tren-trang = nut trong chu. Nut btn-light/btn-warning khong bi
       vi luat !important cua header chi nham .btn-primary.
   (3) border-image cua .se-btn-glass phu len lop conic border-box cua
       .se-btn-glow nen vien khong chay duoc.
   (4) border:2px solid #000 !important cua header thang
       border-color:transparent !important cua .se-btn-glow (cung (0,1,0),
       <style> inline nap sau) nen vien den dac che luon conic.
   SUA (chi trong file nay; luat !important cua header anh huong TOAN SITE nen
   khong sua o do; override o day co chu dich, specificity cao hon nen thang
   bat ke thu tu nap — !important o day la bat buoc vi doi phuong cung
   !important, khong phai them mu): chu indigo cho moi nut primary glass
   (ca :hover/:focus/:active); nut vua glass vua glow bo border-image +
   border-color transparent de lop conic hien ra va chay vong. */
.btn-primary.se-btn-glass,
.btn-primary.se-btn-glass:hover,
.btn-primary.se-btn-glass:focus,
.btn-primary.se-btn-glass:active,
.btn-gradient-primary.se-btn-glass,
.btn-gradient-primary.se-btn-glass:hover,
.btn-gradient-primary.se-btn-glass:focus,
.btn-gradient-primary.se-btn-glass:active {
    color: #4f46e5 !important;
}
.se-btn-glass.se-btn-glow { border-image: none; }
.btn-primary.se-btn-glass.se-btn-glow,
.btn-gradient-primary.se-btn-glass.se-btn-glow {
    border-color: transparent !important;
}

/* --- Chu gradient indigo -> cyan -> teal --- */
.se-grad-text {
    background: linear-gradient(90deg, #4f46e5, #06b6d4, #14b8a6);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent !important; /* thang .text-primary !important cua Bootstrap */
}

/* --- Hero stagger: CHI kich hoat khi html co class .se-js (JS bat) ---
   Tat JS -> khong an, noi dung hien du nhu thuong. */
@keyframes se-rise {
    from { opacity: 0; transform: translateY(18px); }
    to { opacity: 1; transform: translateY(0); }
}
html.se-js .se-hero-stagger > * {
    animation: se-rise .7s cubic-bezier(.22, 1, .36, 1) both;
    animation-delay: calc(var(--se-i, 0) * 90ms);
}

/* --- Reveal khi cuon toi (IntersectionObserver them .se-in) ---
   CHI an khi html.se-js; tat JS -> hien ngay. */
html.se-js .se-reveal {
    opacity: 0;
    transform: translateY(18px);
    transition: opacity .7s ease, transform .7s cubic-bezier(.22, 1, .36, 1);
}
/* (v2, 24/11) Rule HIEN phai manh hon rule AN: rule an la
   `html.se-js .se-reveal` (0,2,1), rule hien cu `.se-reveal.se-in` chi
   (0,2,0) nen thua — moi khoi reveal opacity 0 vinh vien khi JS bat
   (kiem chung live 24/11: giua landing trang tron, 12 the /docs bien mat).
   Nang len (0,3,1). Khong dung !important. */
html.se-js .se-reveal.se-in {
    opacity: 1;
    transform: none;
}

/* --- Count-up: khong can CSS dac biet (JS doi textContent) --- */

/* --- Bento grid 6 cot --- */
.se-bento {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 16px;
    margin-left: 0;
    margin-right: 0; /* trung hoa margin am cua .row Bootstrap */
}
.se-bento-item { width: auto; /* thang .col-md-4 width 33.33% khi lam grid item */ }
.se-span-2 { grid-column: span 2; }
.se-span-4 { grid-column: span 4; }
@media (max-width: 767px) {
    .se-bento { grid-template-columns: 1fr; }
    .se-span-2, .se-span-4 { grid-column: span 1; }
}

/* --- Marquee: track chua 2 ban sao giong nhau nen -50% la khop vong ---
   Khong dung gap flex: dung margin-right tung badge de tong rong track
   = dung 2 lan ban sao (gap flex lam lech nua gap ~4px moi vong). */
.se-marquee { overflow: hidden; }
.se-marquee-track {
    display: flex;
    width: max-content;
    animation: se-marquee 30s linear infinite;
}
.se-marquee-track > * { margin-right: .5rem; }
.se-marquee:hover .se-marquee-track { animation-play-state: paused; }
@keyframes se-marquee {
    to { transform: translateX(-50%); }
}

/* --- Pill (bo chuyen VND/USD): chi dung transform + width cho indicator --- */
.se-pill { position: relative; }
.se-pill-ind {
    position: absolute;
    left: 0;
    top: 4px;
    bottom: 4px;
    border-radius: 999px;
    background: rgba(79, 70, 229, .12);
    border: 1px solid rgba(79, 70, 229, .25);
    transition: transform .3s cubic-bezier(.22, 1, .36, 1), width .3s cubic-bezier(.22, 1, .36, 1);
    pointer-events: none;
}
.se-pill-btn { position: relative; z-index: 1; }
.se-pill-btn.is-active { color: #4f46e5; }
@media (max-width: 767px) {
    /* Loc model xuong nhieu hang (flex-wrap): an indicator truot de
       khong thanh thanh doc cao; trang thai active van thay bang
       .is-active (chu indigo) + .active cua Bootstrap. */
    #modelFilters .se-pill-ind { display: none; }
}

/* --- FAQ accordion (grid-template-rows 0fr -> 1fr) --- */
.se-faq-a {
    display: grid;
    grid-template-rows: 0fr;
    transition: grid-template-rows .35s ease;
}
.se-faq-a > div { overflow: hidden; }
.se-faq-item.is-open .se-faq-a { grid-template-rows: 1fr; }
/* (v2, 24/11) Luoi an toan: Bootstrap noi .show la dap an phai hien, ke ca
   khi .is-open lech (bam nhanh giua transition). Specificity (0,2,0) thua
   luat .is-open (0,3,0) nen luong chay binh thuong khong doi. */
.se-faq-a.show { grid-template-rows: 1fr; }

/* --- Nut copy: doi icon copy -> check (opacity/scale) ---
   .se-copy-ic-wrap xep chong 2 icon cung 1 o grid de khong dich layout
   khi doi icon. */
.se-copy-ic-wrap {
    display: inline-grid;
    vertical-align: middle;
}
.se-copy-ic-wrap > * { grid-area: 1 / 1; }
.se-copy-ic-copy,
.se-copy-ic-check {
    display: inline-block;
    transition: opacity .2s ease, transform .2s ease;
}
.se-copy-ic-check { opacity: 0; transform: scale(.5); }
.se-copy.is-copied .se-copy-ic-copy { opacity: 0; transform: scale(.5); }
.se-copy.is-copied .se-copy-ic-check { opacity: 1; transform: scale(1); }

/* --- Back-to-top: z-index 1030 THAP hon modal Bootstrap (1055,
   --bs-modal-zindex trong app.min.css) va SweetAlert2 (1060, container
   .swal2-container trong sweetalert2.min.css) — nut khong bao gio de len
   modal/popup. Cao hon topbar sticky (1020) de luon bam duoc. */
.se-to-top {
    position: fixed;
    right: 20px;
    bottom: 20px;
    z-index: 1030;
    opacity: 0;
    pointer-events: none;
    transform: translateY(8px);
    transition: opacity .3s ease, transform .3s ease;
}
.se-to-top.is-visible {
    opacity: 1;
    pointer-events: auto;
    transform: none;
}

/* --- Thanh tien do doc: cung z-index 1030 (duoi modal 1055 / Swal 1060) --- */
.se-read-progress {
    position: fixed;
    top: 0;
    left: 0;
    height: 3px;
    width: 100%;
    transform-origin: 0 50%;
    transform: scaleX(var(--se-p, 0));
    background: linear-gradient(90deg, #4f46e5, #06b6d4, #14b8a6);
    z-index: 1030;
    pointer-events: none;
}

/* --- Toast: KHONG co CSS o day.
   Toast hien co la SweetAlert2 (window.showToast trong footer.php goi
   Swal.fire({toast:true, position:'top-end', ...})); Swal tu quan ly
   container .swal2-container, moi toast moi thay toast cu (khong xep
   chong), khong co container rieng cua site de xep doc. Viet lai he
   thong toast nam ngoai pham vi W3 nen muc nay BO QUA co chu dich. --- */

/* --- Ton trong nguoi dung tat chuyen dong --- */
@media (prefers-reduced-motion: reduce) {
    .se-btn-glass,
    .se-btn-glow,
    .se-hero-stagger > *,
    .se-reveal,
    .se-marquee-track,
    .se-pill-ind,
    .se-faq-a,
    .se-copy-ic-copy,
    .se-copy-ic-check,
    .se-to-top,
    .se-read-progress {
        animation: none !important;
        transition: none !important;
    }
    html.se-js .se-hero-stagger > *,
    html.se-js .se-reveal {
        opacity: 1;
        transform: none;
    }
    .se-marquee-track { transform: none; }
}
