/* ============================================================
   CiCC Platform v4.0.0 — SINGLE PHAN HE (VIP PRO UI/UX)
   Thiết kế mới cho trang con module LeanERP.
   Dùng design token từ v4-tokens.css → dual-mode auto.
   ============================================================ */

.phan-he-single {
  --ph-accent: #7c3aed;      /* AI purple */
  --ph-accent-2: #6366f1;    /* indigo */
  --ph-accent-3: #06b6d4;    /* cyan */
  --ph-grad: linear-gradient(135deg, #7c3aed 0%, #6366f1 50%, #06b6d4 100%);
  --ph-glass: rgba(255,255,255,0.08);
  --ph-border: rgba(124,58,237,0.25);
}

/* DARK MODE override cho accent giữ nguyên rực */
[data-theme="dark"] .phan-he-single {
  --ph-glass: rgba(255,255,255,0.06);
  --ph-border: rgba(124,58,237,0.4);
}

/* ============ HERO ============ */
.phan-he-hero {
  position: relative;
  padding: 72px 0 56px;
  background:
    radial-gradient(1200px 600px at 80% -10%, rgba(124,58,237,0.18), transparent 60%),
    radial-gradient(900px 500px at 0% 110%, rgba(6,182,212,0.14), transparent 55%),
    var(--bg-primary);
  overflow: hidden;
}
.phan-he-hero::before {
  content: "";
  position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(124,58,237,0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(124,58,237,0.05) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(circle at 50% 30%, #000 30%, transparent 75%);
  pointer-events: none;
}
.phan-he-hero-grid {
  position: relative;
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 48px;
  align-items: center;
  z-index: 1;
}
.phan-he-badge { display: flex; gap: 10px; align-items: center; margin-bottom: 18px; flex-wrap: wrap; }
.phan-he-badge .pillar-tag {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 14px; border-radius: 9999px;
  background: var(--ph-grad); color: #fff; font-weight: 700; font-size: 13px;
  letter-spacing: .3px;
}
.status-badge {
  padding: 6px 12px; border-radius: 9999px; font-size: 12px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .5px;
}
.badge-active { background: rgba(34,197,94,.15); color: #16a34a; border: 1px solid rgba(34,197,94,.3); }
[data-theme="dark"] .badge-active { color: #4ade80; }

.phan-he-hero h1 {
  font-size: clamp(28px, 4vw, 46px);
  line-height: 1.15; font-weight: 800; letter-spacing: -0.5px;
  margin: 0 0 16px;
  background: var(--ph-grad);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
[data-theme="dark"] .phan-he-hero h1 {
  background: linear-gradient(135deg,#c4b5fd,#a5b4fc,#67e8f9);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.phan-he-subtitle { font-size: 18px; line-height: 1.6; color: var(--text-secondary); margin: 0 0 28px; max-width: 92%; }

.phan-he-hero img {
  width: 100%; height: auto; border-radius: 16px;
  border: 1px solid var(--ph-border);
  box-shadow: 0 20px 50px -20px rgba(124,58,237,.45);
  margin: 4px 0 28px !important;
}

/* Hero stats */
.phan-he-hero-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin: 8px 0 28px; }
.hero-stat {
  background: var(--ph-glass); border: 1px solid var(--ph-border);
  border-radius: 14px; padding: 16px 14px; text-align: center;
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  transition: transform .25s ease, box-shadow .25s ease;
}
.hero-stat:hover { transform: translateY(-4px); box-shadow: 0 12px 30px -12px rgba(124,58,237,.5); }
.hero-stat-icon { display: inline-flex; color: var(--ph-accent); margin-bottom: 6px; }
.hero-stat-value { display: block; font-size: 22px; font-weight: 800; color: var(--text-primary); line-height: 1.1; }
.hero-stat-label { font-size: 12px; color: var(--text-secondary); }

.phan-he-hero-cta { display: flex; gap: 14px; flex-wrap: wrap; }
.phan-he-hero-cta .btn { padding: 14px 28px; border-radius: 12px; font-weight: 700; font-size: 15px; }
.phan-he-hero-cta .btn-primary { background: var(--ph-grad); color: #fff; border: none; box-shadow: 0 10px 30px -10px rgba(124,58,237,.6); }
.phan-he-hero-cta .btn-primary:hover { filter: brightness(1.08); transform: translateY(-2px); }
.phan-he-hero-cta .btn-outline { border: 1.5px solid var(--ph-border); color: var(--text-primary); background: transparent; }
.phan-he-hero-cta .btn-outline:hover { background: var(--ph-glass); }

/* Hero visual card */
.phan-he-hero-visual { position: relative; }
.hero-visual-card {
  background: var(--ph-glass); border: 1px solid var(--ph-border);
  border-radius: 24px; padding: 32px; backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 30px 80px -30px rgba(124,58,237,.55);
}
.hero-visual-card .visual-badge {
  display: inline-block; padding: 6px 14px; border-radius: 9999px;
  background: var(--ph-grad); color: #fff; font-weight: 700; font-size: 12px; margin-bottom: 16px;
}
.hero-visual-card .visual-title { font-size: 20px; font-weight: 800; color: var(--text-primary); margin-bottom: 8px; }
.hero-visual-card .visual-desc { color: var(--text-secondary); font-size: 14px; margin-bottom: 20px; }
.visual-stats-mini { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.mini-stat {
  background: var(--bg-card); border: 1px solid var(--border-color);
  border-radius: 12px; padding: 12px; font-size: 13px; color: var(--text-secondary);
}
.mini-stat span { display: block; font-size: 20px; font-weight: 800; color: var(--ph-accent); }

/* ============ SECTION COMMON ============ */
.phan-he-content, .phan-he-comparison, .phan-he-edge, .phan-he-integration,
.phan-he-case-study, .phan-he-pricing {
  padding: 72px 0;
  position: relative;
}
.section-header { text-align: center; max-width: 760px; margin: 0 auto 48px; }
.section-header .section-tag {
  display: inline-block; padding: 5px 16px; border-radius: 9999px;
  background: var(--ph-glass); color: var(--ph-accent); font-weight: 800; font-size: 12px;
  letter-spacing: 1.5px; text-transform: uppercase; margin-bottom: 14px;
  border: 1px solid var(--ph-border);
}
.section-header h2 { font-size: clamp(24px,3vw,36px); font-weight: 800; margin: 0 0 14px; line-height: 1.2; }
.section-header p { font-size: 16px; color: var(--text-secondary); line-height: 1.7; }

/* ============ OVERVIEW BODY ============ */
.phanhe-content-body { max-width: 860px; margin: 0 auto; }
.phanhe-content-body h3 { font-size: 22px; font-weight: 700; margin: 36px 0 14px; color: var(--text-primary); }
.phanhe-content-body p { font-size: 16px; line-height: 1.8; color: var(--text-secondary); margin: 0 0 16px; }
.feature-list { list-style: none; padding: 0; margin: 16px 0; display: grid; gap: 12px; }
.feature-list li {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 18px; background: var(--bg-card); border: 1px solid var(--border-color);
  border-radius: 12px; font-size: 15px; color: var(--text-primary);
  transition: transform .2s ease, border-color .2s ease;
}
.feature-list li:hover { transform: translateX(6px); border-color: var(--ph-border); }
.feature-list .icon-check, .feature-list .icon-zap {
  flex: 0 0 auto; width: 22px; height: 22px; color: var(--ph-accent);
}
.phanhe-tags { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 28px; }
.phanhe-tags .tag {
  padding: 8px 16px; border-radius: 9999px; font-size: 13px; font-weight: 600;
  background: var(--ph-glass); color: var(--ph-accent); border: 1px solid var(--ph-border);
}

/* spec table */
.spec-table, .comparison-table {
  width: 100%; border-collapse: collapse; margin-top: 24px;
  background: var(--bg-card); border-radius: 14px; overflow: hidden;
  border: 1px solid var(--border-color); font-size: 14px;
}
.spec-table th, .comparison-table th,
.spec-table td, .comparison-table td {
  padding: 14px 18px; text-align: left; border-bottom: 1px solid var(--border-color);
}
.spec-table thead, .comparison-table thead {
  background: var(--ph-grad); color: #fff;
}
.spec-table th, .comparison-table th { font-weight: 700; }
.spec-table tbody tr:hover, .comparison-table tbody tr:hover { background: var(--ph-glass); }

/* ============ FEATURES GRID ============ */
.edge-features-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 20px; }
.edge-card {
  position: relative; padding: 28px 24px; border-radius: 18px;
  background: var(--bg-card); border: 1px solid var(--border-color);
  transition: transform .3s cubic-bezier(.2,.8,.2,1), box-shadow .3s ease, border-color .3s;
  overflow: hidden;
}
.edge-card::before {
  content: ""; position: absolute; inset: 0;
  background: var(--ph-grad); opacity: 0; transition: opacity .3s ease; z-index: 0;
}
.edge-card:hover { transform: translateY(-8px); box-shadow: 0 24px 50px -20px rgba(124,58,237,.5); border-color: transparent; }
.edge-card:hover::before { opacity: .07; }
.edge-card > * { position: relative; z-index: 1; }
.edge-icon {
  width: 52px; height: 52px; border-radius: 14px; display: inline-flex; align-items: center; justify-content: center;
  background: var(--ph-grad); color: #fff; margin-bottom: 16px;
}
.edge-card h3 { font-size: 19px; font-weight: 700; margin: 0 0 8px; color: var(--text-primary); }
.edge-card p { color: var(--text-secondary); font-size: 15px; line-height: 1.6; margin: 0 0 14px; }
.edge-badge {
  display: inline-block; padding: 4px 12px; border-radius: 9999px;
  font-size: 11px; font-weight: 700; letter-spacing: .5px; text-transform: uppercase;
  background: var(--ph-glass); color: var(--ph-accent); border: 1px solid var(--ph-border);
}

/* ============ WORKFLOW ============ */
.workflow-section { margin-top: 56px; }
.workflow-section h3, .comparison-section h3 { font-size: 20px; font-weight: 700; margin: 0 0 20px; text-align: center; }
.workflow-diagram {
  background: var(--bg-card); border: 1px solid var(--border-color); border-radius: 18px;
  padding: 24px; overflow-x: auto;
}
.workflow-svg { width: 100%; min-width: 700px; height: auto; }
.workflow-caption { text-align: center; font-size: 14px; color: var(--text-secondary); margin-top: 14px; }

.comparison-section { margin-top: 48px; }
.comparison-table td strong { color: var(--ph-accent); }

/* ============ MODULES ROW ============ */
.phanhe-modules-row { display: grid; grid-template-columns: 1fr 1fr; gap: 32px; }
.phanhe-col h3 { font-size: 20px; font-weight: 700; margin: 0 0 18px; color: var(--text-primary); }
.module-list.detailed { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; }
.module-list.detailed li {
  display: flex; align-items: center; gap: 14px; padding: 16px 18px;
  background: var(--bg-card); border: 1px solid var(--border-color); border-radius: 14px;
  transition: transform .2s ease, border-color .2s;
}
.module-list.detailed li:hover { transform: translateX(6px); border-color: var(--ph-border); }
.module-icon {
  flex: 0 0 auto; width: 44px; height: 44px; border-radius: 12px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--ph-glass); color: var(--ph-accent);
}
.module-icon.ai { background: var(--ph-grad); color: #fff; }
.module-info strong { display: block; font-weight: 700; color: var(--text-primary); font-size: 15px; }
.module-desc { font-size: 13px; color: var(--text-secondary); }

/* ============ API SPECS ============ */
.api-specs {
  margin-top: 48px; border: 1px solid var(--ph-border); border-radius: 16px;
  background: var(--bg-card); overflow: hidden;
}
.api-specs summary {
  cursor: pointer; padding: 18px 24px; font-weight: 700; font-size: 16px;
  display: flex; align-items: center; gap: 10px; list-style: none; color: var(--text-primary);
}
.api-specs summary::-webkit-details-marker { display: none; }
.api-specs[open] summary { border-bottom: 1px solid var(--border-color); }
.api-content { padding: 24px; }
.api-content h4 { margin: 18px 0 10px; color: var(--ph-accent); }
.api-content pre {
  background: #0f172a; color: #e2e8f0; padding: 16px; border-radius: 12px;
  font-size: 13px; overflow-x: auto; font-family: 'JetBrains Mono', monospace;
}
.api-content code { font-family: 'JetBrains Mono', monospace; }
.api-content ul { padding-left: 20px; color: var(--text-secondary); line-height: 1.8; }

/* ============ CASE STUDY ============ */
.case-placeholder {
  max-width: 760px; margin: 0 auto; text-align: center;
  padding: 40px 32px; border-radius: 18px;
  background: var(--ph-glass); border: 1px dashed var(--ph-border);
  font-size: 16px; color: var(--text-secondary); line-height: 1.7;
}
.case-placeholder strong { color: var(--ph-accent); }

/* ============ PRICING ============ */
.pricing-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; align-items: stretch; }
.pricing-card {
  position: relative; padding: 32px 28px; border-radius: 20px;
  background: var(--bg-card); border: 1px solid var(--border-color);
  display: flex; flex-direction: column;
  transition: transform .3s ease, box-shadow .3s ease;
}
.pricing-card:hover { transform: translateY(-8px); box-shadow: 0 24px 50px -24px rgba(124,58,237,.45); }
.pricing-card.popular {
  border: 2px solid transparent;
  background:
    linear-gradient(var(--bg-card), var(--bg-card)) padding-box,
    var(--ph-grad) border-box;
  box-shadow: 0 20px 60px -20px rgba(124,58,237,.5);
}
.popular-badge {
  position: absolute; top: -14px; left: 50%; transform: translateX(-50%);
  padding: 6px 18px; border-radius: 9999px; background: var(--ph-grad); color: #fff;
  font-size: 12px; font-weight: 700; white-space: nowrap;
}
.pricing-card h3 { font-size: 20px; font-weight: 800; margin: 0 0 12px; text-align: center; }
.pricing-card .price { text-align: center; margin-bottom: 20px; }
.pricing-card .amount { font-size: 34px; font-weight: 800; color: var(--ph-accent); }
.pricing-card .period { font-size: 14px; color: var(--text-secondary); margin-left: 4px; }
.pricing-features { list-style: none; padding: 0; margin: 0 0 24px; display: grid; gap: 10px; flex: 1; }
.pricing-features li { display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--text-secondary); }
.pricing-features .icon-check { color: var(--ph-accent); flex: 0 0 auto; }
.pricing-card .btn { margin-top: auto; text-align: center; padding: 13px; border-radius: 12px; font-weight: 700; }
.pricing-card .btn-primary { background: var(--ph-grad); color: #fff; border: none; }
.pricing-card .btn-outline { border: 1.5px solid var(--ph-border); color: var(--text-primary); background: transparent; }
.pricing-card .btn-outline:hover { background: var(--ph-glass); }

.final-cta { text-align: center; margin-top: 56px; }
.final-cta h3 { font-size: 26px; font-weight: 800; margin: 0 0 24px; }
.cta-buttons { display: flex; gap: 16px; justify-content: center; flex-wrap: wrap; }
.cta-buttons .btn { padding: 15px 32px; border-radius: 12px; font-weight: 700; font-size: 15px; }
.cta-buttons .btn-primary { background: var(--ph-grad); color: #fff; border: none; }
.cta-buttons .btn-outline { border: 1.5px solid var(--ph-border); color: var(--text-primary); }
.cta-trust { margin-top: 18px; font-size: 14px; color: var(--text-secondary); }

/* ============ RELATED ECOSYSTEM ============ */
.phan-he-related-eco { padding: 56px 0; }
.eco-box {
  display: grid; grid-template-columns: auto 1fr auto; gap: 24px; align-items: center;
  padding: 32px; border-radius: 20px;
  background: var(--ph-glass); border: 1px solid var(--ph-border);
}
.eco-box-icon { font-size: 40px; }
.eco-box-text h3 { font-size: 20px; font-weight: 700; margin: 0 0 6px; }
.eco-box-text p { font-size: 14px; color: var(--text-secondary); margin: 0; }
.eco-box-links { display: flex; gap: 12px; flex-wrap: wrap; }
.eco-box-links a {
  padding: 10px 18px; border-radius: 10px; font-weight: 600; font-size: 14px;
  background: var(--bg-card); border: 1px solid var(--border-color); color: var(--text-primary);
  text-decoration: none; transition: all .2s;
}
.eco-box-links a:hover { border-color: var(--ph-border); color: var(--ph-accent); transform: translateY(-2px); }

/* ============ RESPONSIVE ============ */
@media (max-width: 992px) {
  .phan-he-hero-grid { grid-template-columns: 1fr; gap: 32px; }
  .phanhe-modules-row { grid-template-columns: 1fr; }
  .pricing-grid { grid-template-columns: 1fr; max-width: 420px; margin: 0 auto; }
  .eco-box { grid-template-columns: 1fr; text-align: center; }
}
@media (max-width: 600px) {
  .phan-he-hero-stats { grid-template-columns: repeat(2, 1fr); }
  .phan-he-hero, .phan-he-content, .phan-he-comparison, .phan-he-edge,
  .phan-he-integration, .phan-he-case-study, .phan-he-pricing { padding: 48px 0; }
  .phan-he-hero h1 { font-size: 30px; }
}

/* ============ REDUCED MOTION ============ */
@media (prefers-reduced-motion: reduce) {
  .edge-card, .pricing-card, .hero-stat, .module-list.detailed li,
  .feature-list li, .eco-box-links a, .phan-he-hero-cta .btn, .cta-buttons .btn {
    transition: none !important;
  }
  .edge-card:hover, .pricing-card:hover { transform: none; }
}
.cs-results-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-top: 20px;
}
.result-card {
  text-align: center; padding: 28px 18px;
  background: var(--bg-card); border: 1px solid var(--border-color); border-radius: 16px;
  transition: transform .25s ease, box-shadow .25s;
}
.result-card:hover { transform: translateY(-6px); box-shadow: 0 20px 40px -16px rgba(245,158,11,.4); }
.result-value { display: block; font-size: 32px; font-weight: 800; color: var(--cs-accent); line-height: 1.1; }
.result-label { display: block; font-size: 13px; color: var(--text-secondary); margin-top: 6px; text-transform: uppercase; letter-spacing: .5px; font-weight: 600; }

/* Testimonial */
.cs-testimonial {
  background: var(--bg-card); border-left: 4px solid var(--cs-accent);
  border-radius: 16px; padding: 32px; margin: 40px 0;
  box-shadow: var(--shadow-card); position: relative;
}
.cs-testimonial::before {
  content: """; font-size: 80px; font-weight: 800; line-height: 0.8;
  position: absolute; top: 8px; left: 20px; color: var(--cs-accent); opacity: .08;
  font-family: Georgia, serif;
}
.cs-testimonial blockquote {
  font-size: 18px; font-style: italic; line-height: 1.7; color: var(--text-primary);
  margin: 0; padding-left: 20px; border-left: none;
}

/* Content fallback (imported) */
.cs-content-imported h2, .cs-content-imported h3 {
  font-size: clamp(20px, 2.5vw, 26px); font-weight: 700; margin: 32px 0 16px; color: var(--text-primary);
}
.cs-content-imported p { font-size: 16px; line-height: 1.8; color: var(--text-secondary); margin-bottom: 16px; }

/* Related eco reuse */
.cs-related-eco { margin: 48px 0; }

/* CS nav */
.cs-nav { padding: 24px 0; }
.cs-nav .btn { display: inline-flex; align-items: center; gap: 6px; }

/* Responsive */
@media (max-width: 768px) {
  .cs-meta-bar { flex-direction: column; gap: 12px; text-align: center; }
  .cs-results-grid { grid-template-columns: 1fr; }
  .page-header.cs-header { padding: calc(var(--header-height, 80px) + 28px) 0 36px; }
  .cs-testimonial { padding: 24px 18px; }
  .cs-testimonial blockquote { font-size: 16px; }
}
@media (prefers-reduced-motion: reduce) {
/* === CROSS-LINK (shared with single-post) === */
.post-crosslink {
  margin: 40px 0 10px;
  border-radius: 20px;
  background: linear-gradient(135deg, rgba(124,58,237,0.08), rgba(59,130,246,0.06));
  border: 1px solid rgba(124,58,237,0.16);
  padding: 26px;
  backdrop-filter: blur(10px);
}
.crosslink-inner { max-width: 1000px; margin: 0 auto; }
.crosslink-head { margin-bottom: 18px; }
.crosslink-badge {
  display: inline-block;
  font-size: 12px; font-weight: 700; letter-spacing: 0.05em;
  color: var(--primary);
  background: rgba(124,58,237,0.1);
  padding: 4px 12px; border-radius: 999px; margin-bottom: 8px;
}
.crosslink-head h3 { font-size: 1.4rem; font-weight: 800; color: var(--text-1); margin: 0; }
.crosslink-head p { color: var(--text-2); margin: 6px 0 0; font-size: 0.95rem; }
.crosslink-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; margin-top: 16px; }
.cross-card {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 16px; border-radius: 14px;
  background: var(--bg-1); border: 1px solid var(--border-1);
  text-decoration: none; color: var(--text-1);
  transition: transform .25s cubic-bezier(.34,1.56,.64,1), box-shadow .25s, border-color .25s;
}
.cross-card:hover { transform: translateY(-4px); box-shadow: 0 14px 30px rgba(124,58,237,0.18); border-color: rgba(124,58,237,0.35); }
.cross-icon {
  flex-shrink: 0; width: 42px; height: 42px; border-radius: 12px;
  display: grid; place-items: center;
  background: linear-gradient(135deg, #7c3aed, #a855f7); color: #fff;
}
.cross-icon svg { width: 22px; height: 22px; }
.cross-text h4 { margin: 0; font-size: 0.95rem; font-weight: 700; }
.cross-text p { margin: 2px 0 6px; font-size: 0.82rem; color: var(--text-2); }
.cross-cta { font-size: 0.8rem; font-weight: 600; color: var(--primary); }

@media (max-width: 768px) {
  .post-crosslink { padding: 18px; }
  .crosslink-grid { grid-template-columns: 1fr 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  .cross-card:hover { transform: none; }
}
