/* ==========================================
   KHOA TOOL — Frontend stylesheet (dark redesign)
   ========================================== */

/* ----- Theme tokens ----- */
:root {
  --bg-0: #06080f;
  --bg-1: #0b0f1c;
  --line: rgba(148, 163, 220, 0.10);
  --line-strong: rgba(148, 163, 220, 0.20);
  --text: #e7ebff;
  --text-soft: #9aa3c7;
  --text-faint: #6b7299;

  /* Accent — overridden bằng [data-accent] */
  --accent:   #5eead4;
  --accent-2: #818cf8;
  --accent-3: #f472b6;

  --primary: var(--accent);
  --primary-dark: #38bdf8;
  --success: #34d399;
  --danger:  #fb7185;
  --warning: #fbbf24;

  --radius: 12px;
  --radius-lg: 20px;
  --shadow:       0 4px 20px rgba(0,0,0,.35);
  --shadow-hover: 0 16px 40px -12px rgba(0,0,0,.55);
}

html[data-accent="violet"] { --accent:#a78bfa; --accent-2:#22d3ee; --accent-3:#f0abfc; }
html[data-accent="amber"]  { --accent:#fbbf24; --accent-2:#fb7185; --accent-3:#34d399; }
html[data-accent="ice"]    { --accent:#7dd3fc; --accent-2:#c4b5fd; --accent-3:#fda4af; }

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; background: var(--bg-0); }
body {
  font-family: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  color: var(--text); background: var(--bg-0);
  line-height: 1.6; font-size: 16px;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--accent); text-decoration: none; transition: color .15s; }
a:hover { color: var(--accent-2); }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }

.container { max-width: 1240px; margin: 0 auto; padding: 0 28px; position: relative; z-index: 2; }
.mono { font-family: 'JetBrains Mono', ui-monospace, monospace; }

/* ===== ANIMATED BACKGROUND ===== */
.bg-layer {
  position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden;
  background:
    radial-gradient(1200px 700px at 70% -10%, rgba(94,234,212,.18), transparent 60%),
    radial-gradient(900px 600px at 10% 30%, rgba(129,140,248,.18), transparent 60%),
    radial-gradient(800px 500px at 50% 110%, rgba(244,114,182,.12), transparent 60%),
    linear-gradient(180deg, var(--bg-0), var(--bg-1) 30%, var(--bg-0) 100%);
}
#bgCanvas { position: absolute; inset: 0; width: 100%; height: 100%; }

.bg-aurora .blob {
  position: absolute; border-radius: 50%; filter: blur(80px); opacity: .5;
  mix-blend-mode: screen; animation: drift 22s ease-in-out infinite alternate;
}
.bg-aurora .b1 { width: 520px; height: 520px; background: var(--accent);   top: -10%; left: -8%; }
.bg-aurora .b2 { width: 460px; height: 460px; background: var(--accent-2); top: 20%; right: -10%; animation-delay: -5s; animation-duration: 28s; }
.bg-aurora .b3 { width: 580px; height: 580px; background: var(--accent-3); bottom: -15%; left: 30%; animation-delay: -12s; animation-duration: 32s; opacity: .35; }
@keyframes drift { 0%{transform:translate(0,0) scale(1);} 50%{transform:translate(60px,-40px) scale(1.15);} 100%{transform:translate(-40px,30px) scale(.95);} }

.grid-overlay {
  position: absolute; inset: 0;
  background-image:
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 56px 56px;
  -webkit-mask-image: radial-gradient(ellipse 90% 70% at 50% 30%, #000 40%, transparent 80%);
          mask-image: radial-gradient(ellipse 90% 70% at 50% 30%, #000 40%, transparent 80%);
  opacity: .8;
}

.noise {
  position: absolute; inset: -50%;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='220' height='220'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 1  0 0 0 0 1  0 0 0 0 1  0 0 0 .35 0'/></filter><rect width='100%' height='100%' filter='url(%23n)' opacity='.4'/></svg>");
  opacity: .035; pointer-events: none;
}

@media (prefers-reduced-motion: reduce) {
  .bg-aurora .blob, #bgCanvas { animation: none; display: none; }
}

/* ===== Header ===== */
.site-header {
  position: sticky; top: 0; z-index: 30;
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  background: rgba(8, 11, 22, 0.55);
  border-bottom: 1px solid var(--line);
}
.site-header .inner {
  display: flex; align-items: center; justify-content: space-between; padding: 16px 0;
}
.logo { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 18px; color: var(--text); }
.logo-mark {
  width: 32px; height: 32px; border-radius: 9px;
  background: conic-gradient(from 210deg at 50% 50%, var(--accent-2), var(--accent), var(--accent-3), var(--accent-2));
  position: relative; box-shadow: 0 8px 24px -8px rgba(94,234,212,.6);
}
.logo-mark::after { content:''; position:absolute; inset:4px; border-radius:6px; background: var(--bg-0); }
.logo-mark::before { content:'⚡'; position:absolute; inset:0; display:grid; place-items:center; font-size:14px; z-index:2; color: var(--accent); }

.main-nav { display: contents; }
.main-nav ul { display: flex; gap: 6px; list-style: none; }
.main-nav a {
  display:inline-block; color: var(--text-soft); font-weight: 500; font-size: 14px;
  padding: 8px 14px; border-radius: 99px; transition: color .2s, background .2s;
}
.main-nav a:hover { color: var(--text); background: rgba(255,255,255,.04); }
.main-nav a.active {
  color: var(--text); background: rgba(94,234,212,.08);
  box-shadow: inset 0 0 0 1px rgba(94,234,212,.25);
}
.header-cta { display: flex; gap: 8px; align-items: center; }
.menu-toggle { display: none; background: none; border: 0; font-size: 22px; color: var(--text); cursor: pointer; }

/* ===== Buttons ===== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 18px; border-radius: 99px;
  font-weight: 600; font-size: 14px;
  border: 1px solid transparent; cursor: pointer;
  transition: transform .15s, background .2s, box-shadow .25s, border-color .2s;
  text-align: center;
}
.btn-sm { padding: 7px 14px; font-size: 13px; }
.btn-lg { padding: 14px 26px; font-size: 15px; }
.btn-block { display: flex; width: 100%; }
.btn-primary {
  color: #06241f; background: linear-gradient(135deg, var(--accent), var(--primary-dark));
  box-shadow: 0 10px 30px -10px rgba(94,234,212,.55), inset 0 1px 0 rgba(255,255,255,.4);
}
.btn-primary:hover { color:#06241f; transform: translateY(-1px); box-shadow: 0 16px 40px -12px rgba(94,234,212,.7); }
.btn-outline { border-color: var(--line-strong); color: var(--text); }
.btn-outline:hover { border-color: var(--accent); color: var(--accent); }
.btn-ghost { color: var(--text-soft); }
.btn-ghost:hover { color: var(--text); background: rgba(255,255,255,.04); }
.btn-soft { color: var(--text); background: rgba(255,255,255,.05); border-color: var(--line-strong); }
.btn-soft:hover { background: rgba(255,255,255,.08); }
.btn-success { background: var(--success); color: #06241f; }

/* ===== Hero ===== */
.hero { padding: 92px 0 80px; position: relative; }
.hero h1 {
  font-size: clamp(36px, 6vw, 64px); line-height: 1.05; letter-spacing: -.025em;
  font-weight: 800; max-width: 16ch; margin-bottom: 20px;
}
.hero h1 .accent {
  background: linear-gradient(120deg, var(--accent) 0%, var(--accent-2) 60%, var(--accent-3) 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero .lead { color: var(--text-soft); font-size: 18px; max-width: 56ch; margin-bottom: 32px; }
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; }
.hero-eyebrow {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 6px 14px; border-radius: 99px;
  background: rgba(94,234,212,.07); border: 1px solid rgba(94,234,212,.2);
  font-size: 12px; color: var(--accent); margin-bottom: 22px;
}
.hero-eyebrow .pulse {
  width: 7px; height: 7px; border-radius: 50%; background: var(--accent);
  animation: pulse 1.8s ease-out infinite;
}
@keyframes pulse {
  0%{box-shadow:0 0 0 0 rgba(94,234,212,.55);} 70%{box-shadow:0 0 0 9px rgba(94,234,212,0);} 100%{box-shadow:0 0 0 0 rgba(94,234,212,0);}
}
.hero-stats {
  margin-top: 64px; display: grid; grid-template-columns: repeat(4, 1fr);
  border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
}
.hero-stats .stat { padding: 24px 28px; border-right: 1px solid var(--line); }
.hero-stats .stat:last-child { border-right: 0; }
.hero-stats .stat strong {
  display:block; font-size: 32px; font-weight: 800; letter-spacing: -.02em;
  background: linear-gradient(180deg, #fff, #b8c0e0);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero-stats .stat span {
  display:block; font-size: 12px; color: var(--text-faint); margin-top: 4px;
  text-transform: uppercase; letter-spacing: .08em;
}

/* ===== Sections ===== */
.section { padding: 80px 0; position: relative; }
.section-soft { background: rgba(255,255,255,.02); }
.section-head { text-align: center; max-width: 720px; margin: 0 auto 48px; }
.section-head h2 { font-size: clamp(28px, 4vw, 40px); font-weight: 800; letter-spacing: -.02em; line-height: 1.1; margin-bottom: 12px; }
.section-head p { color: var(--text-soft); font-size: 16px; }
.kicker {
  display: inline-block; font-size: 12px; letter-spacing: .14em;
  text-transform: uppercase; color: var(--accent);
  padding: 4px 10px; border: 1px solid rgba(94,234,212,.25); border-radius: 99px;
  margin-bottom: 14px;
}

/* ===== Feature cards ===== */
.feature-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.feature-card {
  position: relative;
  background: rgba(255,255,255,.025);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 28px 24px 26px;
  transition: transform .25s, border-color .25s, background .25s;
}
.feature-card:hover { transform: translateY(-4px); border-color: rgba(94,234,212,.3); background: rgba(94,234,212,.04); }
.feature-card .icon {
  width: 44px; height: 44px; border-radius: 12px;
  display: grid; place-items: center;
  background: linear-gradient(135deg, rgba(94,234,212,.15), rgba(129,140,248,.15));
  border: 1px solid rgba(94,234,212,.2);
  color: var(--accent); font-size: 20px;
  margin-bottom: 18px;
}
.feature-card h3 { font-size: 17px; font-weight: 700; margin-bottom: 6px; color: var(--text); }
.feature-card p { color: var(--text-soft); font-size: 14px; }

/* ===== Product cards ===== */
.product-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 20px; }
.product-card {
  background: rgba(255,255,255,.025);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: hidden;
  display: flex; flex-direction: column;
  transition: transform .25s, border-color .25s;
}
.product-card:hover { transform: translateY(-4px); border-color: rgba(94,234,212,.3); }
.product-card .thumb {
  height: 180px; position: relative; overflow: hidden;
  background: linear-gradient(135deg, #131a35, #0d1226);
  display: grid; place-items: center;
  color: #fff; font-size: 48px; font-weight: 800;
}
.product-card .thumb::before {
  content: ''; position: absolute; inset: 0;
  background:
    radial-gradient(400px 200px at 80% 0%, rgba(94,234,212,.18), transparent 60%),
    radial-gradient(300px 200px at 0% 100%, rgba(129,140,248,.18), transparent 60%);
}
.product-card .thumb img { width: 100%; height: 100%; object-fit: cover; position: relative; z-index: 1; }
.product-card .body { padding: 20px 22px 22px; flex: 1; display: flex; flex-direction: column; }
.product-card h3 { font-size: 17px; font-weight: 700; margin-bottom: 8px; line-height: 1.3; }
.product-card h3 a { color: var(--text); }
.product-card h3 a:hover { color: var(--accent); }
.product-card .desc { color: var(--text-soft); font-size: 13.5px; flex: 1; margin-bottom: 14px; }
.product-card .meta {
  display: flex; gap: 14px; font-size: 12px; color: var(--text-faint);
  margin-bottom: 14px; padding-top: 12px; border-top: 1px solid var(--line);
}
.product-card .price { display: flex; align-items: baseline; gap: 8px; margin-bottom: 12px; }
.product-card .price .new { color: var(--text); font-size: 20px; font-weight: 800; }
.product-card .price .old { color: var(--text-faint); font-size: 13px; text-decoration: line-through; }

/* Ribbon "FREE" trên thumbnail card */
.free-ribbon {
  position: absolute;
  top: 12px; left: -32px;
  z-index: 2;
  background: linear-gradient(135deg, #16a34a, #22c55e);
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 1.5px;
  padding: 4px 36px;
  transform: rotate(-35deg);
  box-shadow: 0 4px 12px rgba(34,197,94,.45);
  text-shadow: 0 1px 2px rgba(0,0,0,.2);
}

/* ===== Forms ===== */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; margin-bottom: 6px; font-weight: 600; font-size: 14px; color: var(--text); }
.form-control {
  width: 100%; padding: 11px 14px;
  background: rgba(255,255,255,.04); color: var(--text);
  border: 1px solid var(--line-strong); border-radius: 8px;
  font-size: 15px; font-family: inherit;
  transition: border-color .15s, box-shadow .15s;
}
.form-control:focus { outline: 0; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(94,234,212,.15); }
textarea.form-control { resize: vertical; min-height: 120px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-help { font-size: 12px; color: var(--text-faint); margin-top: 4px; }

/* ===== Alerts ===== */
.alert { padding: 12px 16px; border-radius: 8px; margin-bottom: 16px; border-left: 4px solid; font-size: 14px; }
.alert-success { background: rgba(52,211,153,.1);  border-color: var(--success); color: #6ee7b7; }
.alert-error   { background: rgba(251,113,133,.1); border-color: var(--danger);  color: #fca5a5; }
.alert-info    { background: rgba(94,234,212,.1);  border-color: var(--accent);  color: var(--accent); }

/* ===== Detail page ===== */
.product-detail { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; margin-bottom: 50px; }
.product-detail .gallery {
  background: linear-gradient(135deg, #131a35, #0d1226);
  border-radius: var(--radius-lg); min-height: 360px;
  display: grid; place-items: center; color: #fff; font-size: 80px; font-weight: 800;
  border: 1px solid var(--line);
}
.product-detail h1 { font-size: 32px; margin-bottom: 12px; color: var(--text); }
.product-detail .price-box {
  background: rgba(255,255,255,.03); padding: 18px;
  border: 1px solid var(--line); border-radius: var(--radius); margin: 18px 0;
}
.product-detail .price-box .new { color: var(--accent); font-size: 28px; font-weight: 800; }
.product-detail .price-box .old { color: var(--text-faint); font-size: 16px; text-decoration: line-through; margin-left: 8px; }
.product-detail .features-list { list-style: none; margin: 18px 0; }
.product-detail .features-list li { padding: 6px 0 6px 28px; position: relative; color: var(--text-soft); }
.product-detail .features-list li::before { content: '✓'; position: absolute; left: 0; color: var(--accent); font-weight: 800; }
.product-detail .actions { display: flex; gap: 12px; margin-top: 20px; }

.tabs { border-bottom: 1px solid var(--line); margin-bottom: 24px; display: flex; gap: 6px; }
.tabs button {
  padding: 12px 20px; background: none; border: 0; cursor: pointer; color: var(--text-soft);
  font-weight: 600; border-bottom: 2px solid transparent; margin-bottom: -1px; font-size: 14px;
}
.tabs button.active { color: var(--accent); border-color: var(--accent); }
.tab-pane { display: none; color: var(--text-soft); }
.tab-pane.active { display: block; }

/* ===== Tables ===== */
.table-wrap { overflow-x: auto; background: rgba(255,255,255,.025); border: 1px solid var(--line); border-radius: var(--radius-lg); }
table.data { width: 100%; border-collapse: collapse; }
table.data th, table.data td { padding: 12px 14px; text-align: left; border-bottom: 1px solid var(--line); font-size: 14px; }
table.data th { background: rgba(255,255,255,.02); font-weight: 700; font-size: 13px; color: var(--text); }
table.data td { color: var(--text-soft); }
table.data tr:last-child td { border-bottom: 0; }

.badge { display: inline-block; padding: 3px 10px; border-radius: 99px; font-size: 12px; font-weight: 600; }
.badge-success { background: rgba(52,211,153,.15);  color: #6ee7b7; }
.badge-warning { background: rgba(251,191,36,.15);  color: #fcd34d; }
.badge-danger  { background: rgba(251,113,133,.15); color: #fca5a5; }
.badge-info    { background: rgba(94,234,212,.15);  color: var(--accent); }
.badge-gray    { background: rgba(255,255,255,.06); color: var(--text-soft); }

/* ===== CTA card ===== */
.cta-card {
  position: relative;
  background: linear-gradient(135deg, rgba(94,234,212,.08), rgba(129,140,248,.08));
  border: 1px solid rgba(94,234,212,.25);
  border-radius: var(--radius-lg);
  padding: 56px 48px; text-align: center; overflow: hidden;
}
.cta-card::before {
  content: ''; position: absolute; inset: 0;
  background:
    radial-gradient(500px 250px at 20% 0%, rgba(94,234,212,.18), transparent 60%),
    radial-gradient(500px 250px at 80% 100%, rgba(244,114,182,.15), transparent 60%);
  pointer-events: none;
}
.cta-card > * { position: relative; z-index: 1; }
.cta-card h2 { font-size: clamp(26px, 4vw, 38px); font-weight: 800; margin-bottom: 12px; color: var(--text); }
.cta-card p { color: var(--text-soft); font-size: 16px; margin-bottom: 24px; max-width: 640px; margin-left: auto; margin-right: auto; }

/* ===== Footer ===== */
.site-footer { border-top: 1px solid var(--line); padding: 60px 0 24px; margin-top: 80px; background: rgba(0,0,0,.2); }
.footer-grid { display: grid; grid-template-columns: 1.5fr 1fr 1fr 1fr; gap: 40px; margin-bottom: 36px; }
.site-footer h4 { color: var(--text); font-size: 13px; text-transform: uppercase; letter-spacing: .1em; margin-bottom: 14px; }
.site-footer ul { list-style: none; display: grid; gap: 8px; }
.site-footer ul li { font-size: 14px; color: var(--text-soft); }
.site-footer a { color: var(--text-soft); }
.site-footer a:hover { color: var(--text); }
.footer-bottom {
  border-top: 1px solid var(--line); padding-top: 22px;
  text-align: center; font-size: 13px; color: var(--text-faint);
}

/* ===== Page heading ===== */
.page-head { padding: 60px 0 30px; border-bottom: 1px solid var(--line); margin-bottom: 40px; }
.page-head h1 { font-size: 32px; margin-bottom: 6px; color: var(--text); }
.breadcrumb { font-size: 14px; color: var(--text-soft); }
.breadcrumb a { color: var(--accent); }

/* ===== Reusable card variants ===== */
.card-glass {
  background: rgba(255,255,255,.025);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
}
.card-accent {
  background: linear-gradient(135deg, rgba(94,234,212,.12), rgba(129,140,248,.12));
  border: 1px solid rgba(94,234,212,.25);
  border-radius: var(--radius-lg);
  color: var(--text);
}

/* ===== Auth box ===== */
.auth-box {
  max-width: 440px; margin: 60px auto;
  background: rgba(255,255,255,.025);
  border: 1px solid var(--line);
  padding: 36px; border-radius: var(--radius-lg);
  position: relative; z-index: 2;
}
.auth-box h1 { font-size: 24px; margin-bottom: 6px; text-align: center; color: var(--text); }
.auth-box .sub { text-align: center; color: var(--text-soft); margin-bottom: 24px; }
.auth-box .alt { text-align: center; margin-top: 16px; font-size: 14px; color: var(--text-soft); }

/* ===== Responsive ===== */
@media (max-width: 900px) {
  .hero h1 { font-size: 32px; }
  .hero .lead { font-size: 16px; }
  .hero-stats { grid-template-columns: repeat(2, 1fr); }
  .hero-stats .stat:nth-child(2n) { border-right: 0; }
  .hero-stats .stat:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  .product-detail { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .form-row { grid-template-columns: 1fr; }
}
@media (max-width: 700px) {
  .menu-toggle { display: block; }
  .main-nav {
    position: absolute; top: 100%; left: 0; right: 0;
    background: rgba(8,11,22,.95); backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--line); display: none;
  }
  .main-nav.open { display: block; }
  .main-nav ul { flex-direction: column; gap: 0; padding: 12px 20px; }
  .main-nav li { border-bottom: 1px solid var(--line); padding: 4px 0; }
  .main-nav a { width: 100%; }
  .main-nav .header-cta {
    flex-direction: column; gap: 8px;
    padding: 12px 20px 16px;
    border-top: 1px solid var(--line);
  }
  .main-nav .header-cta .btn { width: 100%; }
  .footer-grid { grid-template-columns: 1fr; gap: 28px; }
  .section { padding: 50px 0; }
  .cta-card { padding: 36px 24px; }
}
