/* ==========================================================================
   components.css — thành phần dùng lại: pill, link, slider giải pháp,
   accordion FAQ, field/form, album ảnh
   ========================================================================== */

:root {
  /* Mũi tên dùng làm mask (đổi màu bằng background-color) */
  --arrow-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12h14M13 6l6 6-6 6'/%3E%3C/svg%3E");
  --chevron-down: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23182B53' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  --check-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m5 12 4 4L19 6'/%3E%3C/svg%3E");
}

/* ---- Pill trạng thái ---- */
.pill {
  display: inline-flex; align-items: center; gap: 0.4em;
  padding: 0.12em 0.75em; border-radius: var(--radius-pill);
  font-size: 0.9em; font-weight: 600; line-height: 1.6; white-space: nowrap;
}
.pill--green  { background: var(--viai-success-soft); color: #0B7D5C; }
.pill--blue   { background: var(--viai-blue-soft);    color: var(--viai-blue-bright); }
.pill--orange { background: var(--viai-orange-soft);  color: var(--viai-orange-strong); }

/* ---- Link có mũi tên ---- */
.link-arrow { display: inline-flex; align-items: center; gap: 8px; font-size: 15px; font-weight: 700; color: var(--viai-blue-bright); }
.link-arrow .icon { width: 18px; height: 18px; stroke-width: 2.3; transition: transform var(--duration-fast) var(--ease-standard); }
.link-arrow:hover .icon { transform: translateX(4px); }
.link-arrow:hover { text-decoration: underline; text-underline-offset: 4px; }

/* ---- Slider "3 giải pháp" (js/slider.js) ---- */
.sol { --foot: 62px; position: relative; container-type: inline-size; max-width: 1140px; margin: clamp(28px, 3vw, 40px) auto 0; padding-bottom: var(--foot); }
.sol__viewport { overflow: hidden; border-radius: 24px; background: #fff; box-shadow: 0 26px 70px rgba(9, 53, 160, 0.2); touch-action: pan-y; }
.sol__track { display: flex; transition: transform 0.75s var(--ease-standard); will-change: transform; }
.sol-slide { flex: 0 0 100%; min-width: 0; display: flex; flex-direction: column; }   /* cột + ảnh flex:1 → slide ngắn hơn (tiêu đề 1 dòng) vẫn được ảnh lấp đầy, không lộ dải trắng dưới ảnh */

.sol-slide__head { padding: 22px clamp(20px, 2.8vw, 34px) 20px; color: #fff; background: linear-gradient(115deg, #082b78 0%, var(--viai-blue) 55%, #0e43c8 100%); border-bottom: 3px solid var(--viai-orange); }
.sol-slide__row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; }
.sol-slide__tag { flex: none; padding: 6px 14px; border-radius: var(--radius-pill); background: var(--viai-cta-bg); color: #fff; font-size: 12px; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; }
.sol-slide__title { flex: 1 1 300px; min-width: 0; color: #fff; font-size: clamp(18px, 1.9vw, 24px); font-weight: 800; line-height: 1.25; letter-spacing: -0.015em; text-wrap: balance; }
.sol-slide__solves { flex: none; display: inline-flex; align-items: center; gap: 8px; padding: 5px 13px; border-radius: var(--radius-pill); background: rgba(255, 255, 255, 0.14); color: #fff; font-size: 12.5px; font-weight: 600; }
.sol-slide__solves .icon { width: 15px; height: 15px; }
.sol-slide__desc { max-width: 62em; margin-top: 10px; color: rgba(255, 255, 255, 0.92); font-size: 14.5px; line-height: 1.6; }

.sol-slide__media { position: relative; flex: 1 1 auto; aspect-ratio: 16 / 9; overflow: hidden; background: var(--viai-surface-ice); }
.sol-slide__media > img { display: block; width: 100%; height: 100%; object-fit: cover; }

/* Chuyển slide: chữ hiện lần lượt + ảnh zoom nhẹ */
.sol-slide.is-active .sol-slide__tag { animation: sol-rise 0.6s 0.2s var(--ease-standard) both; }
.sol-slide.is-active .sol-slide__title { animation: sol-rise 0.6s 0.3s var(--ease-standard) both; }
.sol-slide.is-active .sol-slide__solves { animation: sol-rise 0.6s 0.4s var(--ease-standard) both; }
.sol-slide.is-active .sol-slide__desc { animation: sol-rise 0.6s 0.5s var(--ease-standard) both; }
.sol-slide.is-active .sol-slide__media > :first-child { animation: sol-zoom 9s ease-out both; }
@keyframes sol-rise { from { opacity: 0; transform: translateY(14px); } }
@keyframes sol-zoom { from { transform: scale(1.07); } }

/* Mũi tên: nằm giữa chiều cao ảnh (ảnh 16:9 → nửa chiều cao = 28.125cqw) */
.sol__nav {
  position: absolute; z-index: 2; bottom: calc(var(--foot) + 28.125cqw - 22px); width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center;
  background: var(--viai-blue); color: #fff; border: 2px solid rgba(255, 255, 255, 0.85); box-shadow: 0 10px 24px rgba(9, 53, 160, 0.4);
  transition: transform var(--duration-fast) var(--ease-standard), background-color var(--duration-fast);
}
.sol__nav:hover { transform: scale(1.08); background: var(--viai-blue-bright); }
.sol__nav .icon { width: 22px; height: 22px; stroke-width: 2.4; }
.sol__nav--prev { left: 16px; }
.sol__nav--next { right: 16px; }

/* Chấm phân trang: chấm active là viên thuốc cam có thanh tiến độ chạy tới lúc chuyển slide */
.sol__foot { position: absolute; left: 0; right: 0; bottom: 0; height: var(--foot); display: flex; align-items: center; justify-content: center; gap: 16px; }
.sol__dots { display: flex; align-items: center; }
.sol__dot { position: relative; flex: none; width: 24px; height: 24px; transition: width 0.35s var(--ease-standard); }
.sol__dot::before { content: ""; position: absolute; left: 7px; right: 7px; top: 8px; bottom: 8px; border-radius: 999px; background: #c3cfe6; transition: background-color var(--duration-fast); }
.sol__dot:hover::before { background: #9db0d6; }
.sol__dot.is-active { width: 54px; }
.sol__dot.is-active::before { background: rgba(243, 107, 38, 0.28); }
.sol__dot-fill { position: absolute; left: 7px; top: 8px; bottom: 8px; width: 0; border-radius: 999px; background: var(--viai-orange); }
.sol.is-playing .sol__dot.is-active .sol__dot-fill { animation: sol-fill var(--sol-dur, 7000ms) linear forwards; }
.sol.is-static .sol__dot.is-active .sol__dot-fill { width: calc(100% - 14px); }
.sol.is-paused .sol__dot.is-active .sol__dot-fill { animation-play-state: paused; }
@keyframes sol-fill { to { width: calc(100% - 14px); } }
.sol__pause { flex: none; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: #fff; color: var(--viai-blue); box-shadow: 0 6px 16px rgba(9, 53, 160, 0.16); transition: background-color var(--duration-fast); }
.sol__pause:hover { background: var(--viai-blue-soft); }
.sol__pause .icon { width: 15px; height: 15px; fill: currentColor; stroke-width: 1.6; grid-area: 1 / 1; }
.sol__pause .icon--play { display: none; }
.sol__pause[aria-pressed="true"] .icon--play { display: block; }
.sol__pause[aria-pressed="true"] .icon--pause { display: none; }
.sol__pause[hidden] { display: none; }

@media (max-width: 600px) {
  .sol { --foot: 56px; }
  .sol__viewport { border-radius: 18px; }
  .sol__nav { width: 36px; height: 36px; bottom: calc(var(--foot) + 28.125cqw - 18px); }
  .sol__nav--prev { left: 8px; }
  .sol__nav--next { right: 8px; }
}
/* Giảm chuyển động (class .reduce-motion do công tắc ở <head> index.html bật) */
.reduce-motion .sol__track { transition: none; }
.reduce-motion .sol-slide.is-active .sol-slide__tag, .reduce-motion .sol-slide.is-active .sol-slide__title, .reduce-motion .sol-slide.is-active .sol-slide__solves,
.reduce-motion .sol-slide.is-active .sol-slide__desc, .reduce-motion .sol-slide.is-active .sol-slide__media > :first-child { animation: none; }

/* ---- Accordion FAQ ---- */
.faq-item {
  background: #fff; border: 1px solid var(--viai-border); border-radius: 14px;
  box-shadow: 0 8px 24px rgba(11, 29, 71, 0.05);
  transition: box-shadow var(--duration-normal) var(--ease-standard), border-color var(--duration-normal);
}
.faq-item.is-open { box-shadow: 0 14px 34px rgba(11, 29, 71, 0.09); }
.faq-item h3 { font-size: inherit; letter-spacing: 0; font-weight: inherit; }
.faq-q {
  display: flex; width: 100%; align-items: flex-start; justify-content: space-between; gap: 16px;
  padding: 20px 22px; text-align: left; border-radius: 14px;
  font-size: 15.5px; font-weight: 700; line-height: 1.45; color: var(--viai-navy);
}
.faq-toggle {
  flex: none; width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center;
  background: var(--viai-blue-soft); color: var(--viai-blue-bright);
  transition: background-color var(--duration-fast), color var(--duration-fast);
}
.faq-toggle .icon { width: 16px; height: 16px; stroke-width: 2.6; grid-area: 1 / 1; }
.faq-toggle .icon--minus { display: none; }
.faq-item.is-open .faq-toggle { background: var(--viai-orange); color: #fff; }
.faq-item.is-open .icon--plus { display: none; }
.faq-item.is-open .icon--minus { display: block; }
.faq-a {
  display: grid; grid-template-rows: 0fr; visibility: hidden;
  transition: grid-template-rows var(--duration-normal) var(--ease-standard), visibility 0s linear var(--duration-normal);
}
.faq-item.is-open .faq-a { grid-template-rows: 1fr; visibility: visible; transition-delay: 0s; }
.faq-a__inner { overflow: hidden; }
.faq-a__inner p { padding: 0 22px 22px; font-size: 15px; line-height: 1.65; color: var(--viai-muted-strong); }
/* Không có JS: hiển thị hết đáp án */
html:not(.js-ready) .faq-a { grid-template-rows: 1fr; visibility: visible; }

/* ---- Field / input ---- */
.input {
  width: 100%; min-height: 52px; padding: 0 16px;
  border: 1px solid #D9E2F1; border-radius: 12px; background: #F9FBFF;
  color: var(--viai-navy); font-size: 15px;
  transition: border-color var(--duration-fast), box-shadow var(--duration-fast), background-color var(--duration-fast);
}
.input::placeholder { color: var(--viai-muted-strong); opacity: 1; }
.input:hover { border-color: #B9C8E4; }
.input:focus, .input:focus-visible { outline: none; border-color: var(--viai-blue-bright); background: #fff; box-shadow: 0 0 0 4px rgba(21, 83, 224, 0.16); }
.input[aria-invalid="true"] { border-color: #D92D20; background: #FFF8F7; }
.input[aria-invalid="true"]:focus { box-shadow: 0 0 0 4px rgba(217, 45, 32, 0.16); }
.select {
  appearance: none; -webkit-appearance: none;
  background-image: var(--chevron-down); background-repeat: no-repeat; background-position: right 16px center; background-size: 18px;
  padding-right: 44px; color: var(--viai-muted-strong); cursor: pointer; text-overflow: ellipsis;
}
.select.has-value { color: var(--viai-navy); }
.select option { color: var(--viai-navy); }
.textarea { display: block; padding: 14px 16px; min-height: 124px; line-height: 1.55; resize: vertical; }
.field__error { margin-top: 6px; font-size: 13px; line-height: 1.4; font-weight: 500; color: #C0271B; }
.field__error[hidden] { display: none; }

.consent { display: flex; align-items: flex-start; gap: 10px; font-size: 13.5px; line-height: 1.5; color: var(--viai-muted-strong); cursor: pointer; }
.consent input { flex: none; width: 18px; height: 18px; margin: 2px 0 0; accent-color: var(--viai-blue-bright); cursor: pointer; }
.consent input[aria-invalid="true"] { outline: 2px solid #D92D20; outline-offset: 2px; }

/* Honeypot: ẩn khỏi người dùng và trình đọc màn hình */
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* Nút gửi: trạng thái loading */
.btn--submit { min-height: 56px; font-size: 16px; letter-spacing: 0.03em; }
.btn--submit .btn__spinner { display: none; }
.btn--submit[data-loading="true"] { pointer-events: none; opacity: 0.85; }
.btn--submit[data-loading="true"] .btn__arrow { display: none; }
.btn--submit[data-loading="true"] .btn__spinner { display: block; animation: spin 900ms linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.form-note { margin-top: 14px; font-size: 13px; line-height: 1.5; color: var(--viai-muted-strong); text-align: center; text-wrap: balance; }
.form-note .icon { display: inline-block; width: 16px; height: 16px; margin-right: 6px; vertical-align: -3px; stroke-width: 2.2; color: var(--viai-blue); }

.form-status { margin-top: 14px; padding: 12px 14px; border-radius: 12px; font-size: 14px; line-height: 1.55; font-weight: 500; }
.form-status[hidden] { display: none; }
.form-status--success { background: var(--viai-success-soft); color: #0B6B4F; }
.form-status--error { background: #FEECEA; color: #A32017; }
.form-status--info { background: var(--viai-blue-soft); color: var(--viai-blue); }

/* ---- Album (mục "Album hoạt động & khách hàng") ---- */
/* 3 ảnh/lần (2 ở ≤900px, 1 ở ≤600px); cuộn ngang bằng scroll-snap nên vuốt cảm ứng dùng được; mỗi lần bấm mũi tên trượt 1 ảnh (js/main.js). */
.album { --per: 3; --gap: clamp(12px, 1.4vw, 16px); margin-top: 28px; }
.album__stage { position: relative; }
.album__track {
  display: flex; gap: var(--gap); overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none;
  overscroll-behavior-x: contain; border-radius: 16px;
}
.album__track::-webkit-scrollbar { display: none; }
.album__item {
  flex: 0 0 calc((100% - (var(--per) - 1) * var(--gap)) / var(--per)); scroll-snap-align: start;
  aspect-ratio: 16 / 9; border-radius: 16px; overflow: hidden; background: var(--viai-surface-ice);
  transition: opacity 0.5s var(--ease-standard), scale 0.5s var(--ease-standard);
}
/* Ảnh nằm ngoài khung nhìn (đang trượt vào/ra) mờ và nhỏ hơn một chút; JS (main.js) gắn .is-on cho ảnh đang xem */
.js-ready .album__item:not(.is-on) { opacity: 0.45; scale: 0.95; }
/* Ảnh gốc 1000×525 (hơi rộng hơn 16:9) → canh trái + phóng to từ góc trên-trái để không cắt logo ViAI */
.album__item img { width: 100%; height: 100%; object-fit: cover; object-position: 0 50%; transform-origin: 0 0; transition: transform 500ms var(--ease-standard); }
.album__item:hover img { transform: scale(1.04); }
.album__btn {
  position: absolute; top: 50%; z-index: 2; width: 46px; height: 46px; margin-top: -23px; border-radius: 50%;
  display: grid; place-items: center; background: #fff; color: var(--viai-blue);
  box-shadow: 0 6px 18px rgba(11, 29, 71, 0.22);
  transition: transform var(--duration-fast) var(--ease-standard), box-shadow var(--duration-fast), color var(--duration-fast);
}
.album__btn .icon { width: 22px; height: 22px; stroke-width: 2.6; transition: translate var(--duration-fast) var(--ease-standard); }
.album__btn--prev:hover .icon { translate: -2px 0; }
.album__btn--next:hover .icon { translate: 2px 0; }
.album__btn:hover { transform: scale(1.08); color: var(--viai-blue-bright); box-shadow: 0 8px 22px rgba(11, 29, 71, 0.3); }
.album__btn--prev { left: 12px; }
.album__btn--next { right: 12px; }
.album__dots { display: flex; justify-content: center; align-items: center; gap: 2px; margin-top: 18px; }
/* Chấm đang xem giãn thành viên thuốc; khi tự chạy thì viên thuốc được lấp dần theo thời gian (css/motion.css, biến --auto) */
.album__dot { position: relative; display: grid; place-items: center; width: 20px; height: 20px; transition: width 0.4s var(--ease-out-expo); }
.album__dot::before, .album__dot::after { content: ""; grid-area: 1 / 1; height: 8px; border-radius: 999px; }
.album__dot::before { width: 8px; background: #D3D9E8; transition: width 0.4s var(--ease-out-expo), background-color var(--duration-fast); }
.album__dot::after { width: 0; background: var(--viai-blue); }
.album__dot:hover::before { background: #A9B5D3; }
.album__dot[aria-current="true"] { width: 44px; }
.album__dot[aria-current="true"]::before { width: 32px; background: var(--viai-blue); }
/* Chỉ có 1 vị trí (ít ảnh hơn số ô hiển thị) → ẩn mũi tên + chấm */
.album.is-static .album__btn, .album.is-static .album__dots { display: none; }
@media (max-width: 900px) { .album { --per: 2; } }
@media (max-width: 600px) {
  .album { --per: 1; }
  .album__btn { width: 40px; height: 40px; margin-top: -20px; }
  .album__btn--prev { left: 8px; }
  .album__btn--next { right: 8px; }
}
