/* =========================================================
   🤖 AI-Driven Solutions — ALT Layout (Refactored, clean)
   ========================================================= */

/* ===== SECTION WRAPPER ===== */
.ai-solution-section {
  position: relative;              /* để ::before hoạt động */
  isolation: isolate;
  width: 100%;
  background: transparent;
  padding: var(--body-section-py-lg) 0;
  box-sizing: border-box;
}

/* Soft spotlight phía trên section */
.ai-solution-section::before {
  content: "";
  position: absolute;
  inset: auto 0;
  top: -40px;
  height: 380px;
  pointer-events: none;
  background: radial-gradient(
    1200px 320px at 50% 0,
    rgba(255, 255, 255, 0.16),
    rgba(255, 255, 255, 0) 70%
  );
}

/* Container chính, căn giữa theo max-width */
.ai-solution-container {
  max-width: var(--body-inner-max);
  margin: 0 auto;
  padding: 0 var(--body-px);
}

/* ===== HEADING ===== */
.ai-solution-header {
  text-align: center;
  margin-bottom: clamp(18px, 2.8vw, 28px);
}

.ai-solution-title {
  font-size: clamp(2.4rem, 3.2vw, 3.2rem);
  font-weight: 800;
  line-height: 1.15;
  margin: 0 0 10px 0;
  color: var(--section-heading-color, #0f172a);
  text-shadow: var(--section-heading-shadow, none);
}

.ai-solution-subtitle {
  font-size: clamp(1rem, 1.2vw, 1.25rem);
  margin: 0;
  max-width: 72ch;
  margin-inline: auto;
  color: var(--section-subtitle-color, #475569);
}

/* ===== AI TABS (Data Foundation / AI Gateway / AI Assistants) ===== */
.ai-solution-tabs {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;

  width: fit-content;
  max-width: 100%;
  margin: 24px auto 32px;
  padding: 8px 10px;

  border-radius: 9999px;
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.45),
    rgba(255, 255, 255, 0.25)
  );
  border: 1px solid rgba(255, 255, 255, 0.55);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.85),
    0 8px 22px rgba(36, 74, 140, 0.12);

  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);

  overflow-x: auto;
  scrollbar-width: none;
}
.ai-solution-tabs::-webkit-scrollbar {
  display: none;
}

.ai-solution-tabs .tab {
  position: relative;
  background: transparent;
  border: none;
  padding: 10px 22px;
  border-radius: 9999px;

  color: #1e293b;
  font-weight: 700;
  font-size: 1rem;

  white-space: nowrap;
  cursor: pointer;
  transition: background 0.25s, color 0.25s, box-shadow 0.25s;
}

.ai-solution-tabs .tab:hover {
  background: rgba(255, 255, 255, 0.22);
}

.ai-solution-tabs .tab.active {
  background: #fff;
  color: #0f172a;
  box-shadow:
    0 5px 16px rgba(0, 0, 0, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.95);
}

.ai-solution-tabs .tab.active::after {
  content: "";
  position: absolute;
  left: 18px;
  right: 18px;
  bottom: 2px;
  height: 1.5px;
  border-radius: 3px;
  background: linear-gradient(90deg, #1e3a8a, #2563eb);
}

/* ===== HERO GRID: 2 CỘT (Dashboard / Accordion) ===== */
.ai-solution-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
  column-gap: var(--body-grid-gap-lg);
  align-items: stretch;   /* 2 cột kéo đều theo chiều cao nội dung */
  justify-content: center;
  width: 100%;
}

.ai-solution-visual,
.ai-solution-content {
  min-width: 0;
  min-height: 0;
  box-sizing: border-box;
}

/* =========================================================
   CỘT TRÁI — VISUAL (Card + Stats overlap)
   ========================================================= */

/* Wrapper cột trái: chỉ layout, không vẽ card ở đây */
.ai-solution-visual {
  position: relative;              /* để stats absolute bám theo */
  display: flex;
  flex-direction: column;
  width: 100%;
  background: transparent;
  padding-bottom: 62px;            /* chừa chỗ cho 3 box trồi xuống */
}

/* Card thật (trắng ngọc) */
.ai-solution-card {
  flex: 1 1 auto;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;

  border-radius: 16px;
  /* padding: clamp(16px, 2vw, 22px); */
  background:
    radial-gradient(120% 90% at 50% -20%, rgba(255,255,255,.90), transparent 70%) padding-box,
    linear-gradient(180deg, #ffffff 0%, #fbfdff 46%, #f5faff 100%) padding-box,
    linear-gradient(180deg, #ffffff 0%, rgba(255,255,255,0) 100%) border-box;
  border: 1px solid rgba(255,255,255,0.9);
  background-origin: border-box;
  background-clip: padding-box, padding-box, border-box;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.96),
    0 4px 8px rgba(140,180,255,.40),
    0 16px 32px rgba(50,100,200,.24);
}

/* Dashboard image trong card */
.ai-solution-card img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 480px;       /* giữ tỷ lệ, không đẩy layout quá cao */
  border-radius: 16px;
  object-fit: contain;
  object-position: center;
}

/* Stats — 3 box nhỏ overlapped xuống dưới card */
.ai-solution-stats {
  --hero-translate-x: clamp(-50%, -42%, -36%);
  --hero-translate-y: -50%;
  position: absolute;
  bottom: 0;              /* neo tại đáy wrapper */
  left: 50%;              /* neo giữa theo trục X */
  /* transform: translate(-40%, -50%); */
  transform: translate(var(--hero-translate-x), var(--hero-translate-y));
  /*  X = -60%  = canh giữa (50%) + dịch trái thêm ~10%
      Y = -30%  = kéo khối stats lên ~30% chiều cao của chính nó */

  display: flex;
  gap: 12px;
}

/* Stats — 3 box nhỏ overlapped xuống dưới card */
.ai-solution-stats {
  position: absolute;
  bottom: 0;

  /*
    Điều khiển vị trí bằng left cho dễ responsive.
    transform X giữ -50% để luôn center theo chính khối stats.
  */
  left: clamp(42%, 46vw, 50%);

  /*
    Y = 50% nghĩa là khối stats nằm vắt qua đáy card,
    một phần lòi xuống dưới.
  */
  transform: translate(-47%, -30%);

  display: flex;
  gap: 12px;
}

/* Một stats item */
.ai-solution-stat {
  background: #ffffff;
  color: #0f172a;
  border: 1px solid rgba(148, 163, 184, 0.35);
  border-radius: 12px;     /* bo ít hơn 1 chút cho gọn */
  padding: 5px 5px;        /* padding rộng hơn cho cảm giác cao cấp */
  min-width: 135px;        /* độ rộng tối thiểu của mỗi box */
  text-align: center;
  box-shadow: 0 12px 26px rgba(15, 23, 42, 0.14);
}

.ai-solution-stat .val {
  display: block;
  font-weight: 800;
  font-size: 1rem;
}

.ai-solution-stat .lbl {
  display: block;
  opacity: 0.9;
  font-size: 0.8rem;
  color: #475569;
}

/* =========================================================
   CỘT PHẢI — ACCORDION + CTA
   ========================================================= */

.ai-solution-content {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: stretch;
  width: 100%;
}

.ai-solution-accordion {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 0;
}

/* CTA dưới accordion */
.ai-solution-cta {
  flex-shrink: 0;
  margin-top: 16px;
  display: flex;
  align-items: center;
  gap: 12px;
}

/* ===== ACCORDION ITEMS ===== */
.ai-solution-item {
  background: #ffffff;
  border: 1px solid rgba(148, 163, 184, 0.35);
  border-radius: 16px;
  overflow: hidden;
  backdrop-filter: none;
  transition: box-shadow 0.2s, transform 0.2s, background 0.2s, border-color 0.2s;
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.08);
  width: 100%;
}

.ai-solution-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.12);
}

.ai-solution-item.open {
  background: #ffffff;
  border-color: rgba(37, 99, 235, 0.35);
}

/* ===== ACCORDION HEADER (icon + text + arrow) ===== */
.ai-solution-head {
  width: 100%;
  display: flex;
  align-items: center;       /* canh giữa icon / text / arrow theo chiều dọc */
  gap: 12px;
  padding: 16px 18px;
  text-align: left;
  background: transparent;
  border: 0;
  cursor: pointer;
  color: #0f172a;
  font-weight: 700;
}

/* Icon trái (📊, 🧠, 💬) – nếu anh dùng class riêng thì map lại */
.ai-solution-head .icon,
.ai-solution-head .ai-solution-head-icon {
  font-size: 1.2rem;
}

/* Khối text (title + subtitle) – fill hết phần giữa */
.ai-solution-head__meta,
.ai-solution-head-text {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.ai-solution-head strong {
  color: #0f172a;
}

.ai-solution-head small {
  display: block;
  font-weight: 600;
  font-size: 0.86rem;
  color: #64748b;
}

/* Arrow (chevron) bên phải – canh chính xác mép phải */
.ai-solution-head .chev,
.ai-solution-head-chevron {
  margin-left: auto;                  /* đẩy arrow sát mép phải */
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 14px;                    /* giữ bề rộng cố định */
  opacity: 0.9;
  color: #475569;
  transition: transform 0.2s;
  transform-origin: center;           /* quay quanh tâm cho đẹp */
}

/* Khi mở accordion: quay 90deg (▸ → ▾) */
.ai-solution-item.open .ai-solution-head .chev,
.ai-solution-item.open .ai-solution-head .ai-solution-head-chevron {
  transform: rotate(90deg);
}

/* ===== BODY của accordion ===== */
.ai-solution-body {
  display: none;
  padding: 0 18px 16px;
  background: #f8fafc;
  border-top: 1px dashed rgba(148, 163, 184, 0.7);
  animation: aiFade 0.28s ease;
  width: 100%;
}

.ai-solution-item.open .ai-solution-body {
  display: block;
}

/* ===== LIST trong body (bullet custom) ===== */
.ai-solution-list {
  list-style: none;
  margin: 14px 0;
  padding-left: 0;
  text-align: left;
}

.ai-solution-list li {
  position: relative;
  padding-left: 18px;
  margin: 6px 0;
  line-height: 1.55;
  color: #334155;
}

/* Bullet custom tròn nhỏ */
.ai-solution-list li::before {
  content: "";
  position: absolute;
  left: 4px;
  top: 0.9em;
  width: 5px;
  height: 5px;
  border-radius: 999px;
  background: #0f172a;
  transform: translateY(-50%);
}

/* ===== BUTTONS ===== */
.ai-solution-btn {
  display: inline-block;
  align-self: flex-start;
  background: linear-gradient(135deg, #38bdf8, #2563eb);
  color: #fff;
  font-weight: 700;
  font-size: .95rem;
  padding: 10px 20px;
  border-radius: 8px;
  text-decoration: none;
  transition: background .2s, transform .2s;
}

.ai-solution-btn:hover {
  background: linear-gradient(135deg, #60c8f8, #3b82f6);
  transform: translateY(-1px);
}

.ai-solution-cta-btn {
  display: inline-block;
  align-self: flex-start;
  background: linear-gradient(135deg, #38bdf8, #2563eb);
  color: #fff;
  font-weight: 700;
  font-size: .95rem;
  padding: 10px 20px;
  border-radius: 8px;
  text-decoration: none;
  transition: background .2s, transform .2s;
}

.ai-solution-cta-btn:hover {
  background: linear-gradient(135deg, #60c8f8, #3b82f6);
  transform: translateY(-1px);
}

.ai-solution-badge {
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid rgba(148, 163, 184, 0.6);
  color: #0f172a;
  padding: 6px 10px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.85rem;
}

/* ===== FEATURED ITEM ===== */
.ai-solution-item.is-featured {
  border-color: rgba(37, 99, 235, 0.5);
  box-shadow: 0 12px 30px rgba(37, 99, 235, 0.18);
}

.ai-solution-item.is-featured .ai-solution-body {
  background: #f1f5f9;
  border-top-color: rgba(37, 99, 235, 0.35);
}

/* ===== ANIMATION ===== */
.ai-hero-fade-out {
  animation: aiHeroFadeOut 0.18s ease forwards;
}
.ai-hero-fade-in {
  animation: aiHeroFadeIn 0.24s ease forwards;
}

@keyframes aiFade {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes aiHeroFadeOut {
  from { opacity: 1; }
  to   { opacity: 0; }
}
@keyframes aiHeroFadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* ===== RESPONSIVE ===== */
@media (min-width: 641px) and (max-width: 1024px) {
  .ai-solution-container {
    max-width: var(--body-tablet-rail-max);
    padding: 0px;
  }

  .ai-solution-hero {
    grid-template-columns: 1fr;
    row-gap: 28px;
    width: 100%;
    max-width: none;
    margin-inline: 0;
  }

  .ai-solution-visual,
  .ai-solution-content {
    width: 100%;
    max-width: none;
    margin-inline: 0;
  }
  .ai-solution-card {
    aspect-ratio: 3 / 2;
  }
  .ai-solution-card img {
    height: 100%;
    max-height: none;
  }
  .ai-solution-stats {
    transform: translate(-40%, -50%);
  }
}

/* Mobile: bỏ overlap stats, cho xuống dưới card cho dễ đọc */
@media (max-width: 640px) {
  .ai-solution-container {
    padding: 0 var(--body-px);
  }
  .ai-solution-hero {
    grid-template-columns: 1fr;
    row-gap: 28px;
    width: 100%;
    max-width: none;
    margin-inline: 0;
  }
  .ai-solution-visual,
  .ai-solution-content {
    width: 100%;
    max-width: none;
    margin-inline: 0;
  }
  .ai-solution-visual {
    padding-bottom: 0;
  }
  .ai-solution-card {
    aspect-ratio: 3 / 2;
  }
  .ai-solution-card img {
    height: 100%;
    max-height: none;
  }
  .ai-solution-stats {
    position: static;
    transform: translate(6%, -45%); /* last wins: block 2 overrides transform: none */
    margin-top: 16px;
    justify-content: center;
    gap: 8px;
  }
  .ai-solution-stat {
    padding: 8px 10px;
    min-width: 0; /* cho phép co lại thêm trên màn nhỏ */
  }
}
