/* ===== Smartera Demo Hub - Global Styles ===== */
:root {
  color-scheme: dark;
  --brand: #1a9bff;          /* xanh Smartera */
  --brand-2: #16c5e0;        /* cyan để gradient */
  --brand-dark: #0a5fae;
  --brand-soft: rgba(26, 155, 255, .14);
  --grad: linear-gradient(135deg, #1a9bff, #16c5e0);
  --ink: #e8f0fa;
  --muted: #8aa0b8;
  --line: rgba(255, 255, 255, .09);
  --bg: #0a1726;             /* navy nền chính */
  --bg-alt: #0c1d30;
  --panel: #0f2236;          /* nền card/panel */
  --radius: 14px;
  --shadow: 0 16px 44px rgba(0, 0, 0, .4);
  --maxw: 1200px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.6;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
.container { max-width: var(--maxw); margin: 0 auto; padding: 0 20px; }

/* ===== Header / Nav ===== */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(10, 23, 38, .82);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(26, 155, 255, .18);
}
.nav {
  display: flex; align-items: center; justify-content: space-between;
  height: 70px;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 22px; letter-spacing: -.5px; }
.brand .dot {
  width: 30px; height: 30px; border-radius: 8px;
  background: linear-gradient(135deg, var(--brand), #7aa2ff);
  display: inline-flex; align-items: center; justify-content: center;
  color: #fff; font-size: 16px;
}
.brand span.accent { color: var(--brand); }
.brand-logo { height: 38px; width: auto; display: block; }
.brand-logo--footer { height: 42px; }
.nav-menu { display: flex; align-items: center; gap: 8px; list-style: none; margin: 0; padding: 0; }
.nav-menu a {
  padding: 10px 14px; border-radius: 10px; font-weight: 600; font-size: 15px; color: #c4d4e6;
  transition: .15s;
}
.nav-menu a:hover { background: var(--brand-soft); color: #fff; }
.nav-menu a.active { color: var(--brand); }
.nav-menu a.badge-link {
  background: var(--grad);
  color: #fff; box-shadow: 0 6px 18px rgba(22, 197, 224, .25);
}
.nav-menu a.badge-link:hover { opacity: .92; color: #fff; }
.nav-cta { display: flex; align-items: center; gap: 12px; }
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 11px 20px; border-radius: 10px; font-weight: 700; font-size: 15px;
  border: 1px solid transparent; cursor: pointer; transition: .15s;
}
.btn-primary { background: var(--grad); color: #fff; box-shadow: 0 8px 22px rgba(22, 197, 224, .28); }
.btn-primary:hover { filter: brightness(1.08); }
.btn-ghost { background: rgba(255,255,255,.04); border-color: var(--line); color: #c4d4e6; }
.btn-ghost:hover { border-color: var(--brand); color: var(--brand); }
.menu-toggle { display: none; background: none; border: 0; font-size: 26px; cursor: pointer; }

/* ===== Hero ===== */
.hero {
  background: radial-gradient(1200px 500px at 80% -10%, #dfe9ff 0%, transparent 60%), var(--bg);
  padding: 80px 0 60px;
}
.hero-grid { display: grid; grid-template-columns: 1.1fr .9fr; gap: 50px; align-items: center; }
.eyebrow {
  display: inline-block; background: var(--brand-soft); color: var(--brand-dark);
  padding: 6px 14px; border-radius: 999px; font-weight: 700; font-size: 13px; margin-bottom: 18px;
}
.hero h1 { font-size: 52px; line-height: 1.1; margin: 0 0 18px; letter-spacing: -1.5px; }
.hero h1 .accent { color: var(--brand); }
.hero p.lead { font-size: 19px; color: var(--muted); margin: 0 0 28px; max-width: 540px; }
.hero-actions { display: flex; gap: 14px; flex-wrap: wrap; }
.hero-visual {
  background: linear-gradient(135deg, var(--brand), #6f9bff);
  border-radius: 24px; aspect-ratio: 4/3; box-shadow: var(--shadow);
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; padding: 20px;
}
.hero-visual .cardlet { background: rgba(255,255,255,.18); border-radius: 12px; }
.hero-visual .cardlet:nth-child(1) { grid-column: span 2; }
.hero-visual .cardlet:nth-child(4) { grid-column: span 3; }

/* ===== Stats ===== */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; margin-top: 56px; }
.stat { text-align: center; }
.stat .num { font-size: 38px; font-weight: 800; color: var(--brand); letter-spacing: -1px; }
.stat .lbl { color: var(--muted); font-weight: 600; }

/* ===== Sections ===== */
.section { padding: 80px 0; }
.section.alt { background: var(--bg-alt); }
.section-head { text-align: center; max-width: 680px; margin: 0 auto 48px; }
.section-head h2 { font-size: 38px; margin: 0 0 14px; letter-spacing: -1px; }
.section-head p { color: var(--muted); font-size: 18px; margin: 0; }

.cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }
.card {
  background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 30px; transition: .2s;
}
.card:hover { transform: translateY(-4px); box-shadow: var(--shadow); border-color: transparent; }
.card .ico {
  width: 54px; height: 54px; border-radius: 14px; background: var(--brand-soft); color: var(--brand);
  display: inline-flex; align-items: center; justify-content: center; font-size: 26px; margin-bottom: 18px;
}
.card h3 { margin: 0 0 10px; font-size: 21px; }
.card p { color: var(--muted); margin: 0; }

/* ===== CTA band ===== */
.cta-band {
  background: linear-gradient(135deg, var(--brand-dark), var(--brand));
  color: #fff; border-radius: 24px; padding: 56px; text-align: center;
  margin: 80px auto; max-width: var(--maxw);
}
.cta-band h2 { font-size: 34px; margin: 0 0 12px; }
.cta-band p { opacity: .9; font-size: 18px; margin: 0 0 26px; }
.cta-band .btn-primary { background: #fff; color: var(--brand-dark); }
.cta-band .btn-primary:hover { background: #eef3ff; }

/* ===== Footer ===== */
.site-footer { background: #0b1220; color: #cbd5e1; padding: 60px 0 30px; }
.footer-grid { display: grid; grid-template-columns: 1.5fr 1fr 1fr 1fr; gap: 40px; }
.footer-grid h4 { color: #fff; font-size: 16px; margin: 0 0 16px; }
.footer-grid a { display: block; color: #94a3b8; padding: 5px 0; }
.footer-grid a:hover { color: #fff; }
.footer-brand p { color: #94a3b8; max-width: 280px; }
.footer-bottom {
  border-top: 1px solid #1e293b; margin-top: 40px; padding-top: 24px;
  display: flex; justify-content: space-between; color: #64748b; font-size: 14px; flex-wrap: wrap; gap: 10px;
}

/* ===== Demo gallery page ===== */
.page-head {
  position: relative; overflow: hidden; padding: 64px 0;
  background:
    radial-gradient(900px 420px at 80% -30%, rgba(26,155,255,.28), transparent 60%),
    radial-gradient(700px 360px at 8% 120%, rgba(22,197,224,.16), transparent 60%),
    var(--bg-alt);
  border-bottom: 1px solid var(--line);
}
.page-head h1 { font-size: 44px; margin: 0 0 10px; letter-spacing: -1px; color: #fff; }
.page-head h1 .grad {
  background: linear-gradient(135deg, #4fb0ff, #16e0d4);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.page-head p { color: #aebfd2; font-size: 18px; margin: 0; }
.page-head p strong { color: #fff; }

.toolbar {
  display: flex; gap: 14px; flex-wrap: wrap; align-items: center;
  padding: 22px 0; position: sticky; top: 70px; z-index: 20;
  background: rgba(10,23,38,.88); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line); margin-bottom: 30px;
}
.search-box { position: relative; flex: 1; min-width: 240px; }
.search-box input {
  width: 100%; padding: 12px 16px 12px 42px; border: 1px solid var(--line);
  border-radius: 10px; font-size: 15px; outline: none; transition: .15s;
  background: var(--panel); color: var(--ink);
}
.search-box input::placeholder { color: var(--muted); }
.search-box input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.search-box .icon { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.toolbar select {
  padding: 12px 16px; border: 1px solid var(--line); border-radius: 10px;
  font-size: 15px; background: var(--panel); color: var(--ink); cursor: pointer; outline: none;
}
.toolbar select:focus { border-color: var(--brand); }
.result-count { color: var(--muted); font-weight: 600; white-space: nowrap; }

.chips-wrap { margin-bottom: 26px; }
.cat-chips { display: flex; gap: 7px; flex-wrap: wrap; transition: max-height .3s ease; }
.cat-chips.collapsed { max-height: 80px; overflow: hidden; -webkit-mask-image: linear-gradient(#000 56%, transparent); mask-image: linear-gradient(#000 56%, transparent); }
.chip {
  flex: 0 0 auto; white-space: nowrap;
  padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--panel); cursor: pointer; font-size: 13px; font-weight: 600; color: #c4d4e6; transition: .15s;
}
.chip:hover { border-color: var(--brand); color: #fff; }
.chip.active { background: var(--grad); color: #fff; border-color: transparent; }
.chips-toggle {
  display: inline-flex; align-items: center; gap: 6px; margin-top: 8px;
  background: none; border: 0; color: var(--brand); font-weight: 700; font-size: 13px; cursor: pointer; padding: 0;
}
.chips-toggle:hover { color: #fff; }

.grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 22px;
}
.tpl {
  border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden;
  background: var(--panel); transition: .2s; display: flex; flex-direction: column;
}
.tpl:hover { transform: translateY(-5px); box-shadow: var(--shadow); border-color: rgba(26,155,255,.4); }
.tpl .thumb {
  aspect-ratio: 16/10; display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 800; font-size: 30px; letter-spacing: 1px; position: relative; overflow: hidden;
}
.tpl .thumb img {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: 1; display: block;
}
.tpl .thumb .tag {
  position: absolute; top: 10px; left: 10px; z-index: 2; background: rgba(0,0,0,.55);
  color: #fff; padding: 4px 10px; border-radius: 999px; font-size: 11px; font-weight: 700; letter-spacing: .3px;
}
.tpl .body { padding: 16px; flex: 1; display: flex; flex-direction: column; gap: 6px; }
.tpl .body h3 { margin: 0; font-size: 16px; }
.tpl .body .meta { color: var(--muted); font-size: 13px; }
.tpl .body .actions { margin-top: auto; padding-top: 12px; display: flex; gap: 8px; }
.tpl .body .actions a {
  flex: 1; text-align: center; padding: 8px; border-radius: 8px; font-size: 13px; font-weight: 700;
}
.tpl .body .actions .view { background: var(--grad); color: #fff; }
.tpl .body .actions .view:hover { filter: brightness(1.08); }
.tpl .body .actions .code { background: var(--brand-soft); color: #6cc4ff; }
.tpl .body .actions .code:hover { color: #fff; }

.empty { text-align: center; padding: 80px 20px; color: var(--muted); }
.empty .big { font-size: 48px; margin-bottom: 10px; }

/* ===== Pagination ===== */
.pagination {
  display: flex; gap: 6px; justify-content: center; align-items: center;
  margin: 44px 0 20px; flex-wrap: wrap;
}
.pagination button {
  min-width: 42px; height: 42px; padding: 0 12px; border: 1px solid var(--line);
  background: var(--panel); border-radius: 10px; cursor: pointer; font-weight: 700; font-size: 15px;
  color: #c4d4e6; transition: .15s;
}
.pagination button:hover:not(:disabled) { border-color: var(--brand); color: #fff; }
.pagination button.active { background: var(--grad); color: #fff; border-color: transparent; }
.pagination button:disabled { opacity: .4; cursor: not-allowed; }
.pagination .ellipsis { color: var(--muted); padding: 0 4px; }

/* ===== Responsive ===== */
@media (max-width: 1000px) {
  .grid { grid-template-columns: repeat(3, 1fr); }
  .cards { grid-template-columns: repeat(2, 1fr); }
  .hero-grid { grid-template-columns: 1fr; }
  .hero-visual { max-width: 480px; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 760px) {
  .nav-menu, .nav-cta .btn-ghost { display: none; }
  .nav-menu.open {
    display: flex; flex-direction: column; position: absolute; top: 70px; left: 0; right: 0;
    background: #0a1726; border-bottom: 1px solid var(--line); padding: 16px; gap: 4px;
  }
  .nav-menu.open a { width: 100%; }
  .menu-toggle { display: block; }
  .hero h1 { font-size: 36px; }
  .section-head h2 { font-size: 28px; }
  .grid { grid-template-columns: repeat(2, 1fr); }
  .stats { grid-template-columns: repeat(2, 1fr); gap: 30px; }
  .cta-band { padding: 40px 24px; }
}
@media (max-width: 480px) {
  .grid { grid-template-columns: 1fr; }
  .cards { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr; }
}

/* ===== Preview modal / lightbox ===== */
.tpl .thumb { cursor: pointer; border: 0; width: 100%; font-family: inherit; }
.tpl .body .actions .view { cursor: pointer; border: 0; font-family: inherit; }

.modal {
  position: fixed; inset: 0; z-index: 200; display: none;
  align-items: center; justify-content: center; padding: 24px;
}
.modal.open { display: flex; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(8, 15, 30, .72); backdrop-filter: blur(3px); }
.modal-dialog {
  position: relative; background: var(--panel); border-radius: 16px; box-shadow: 0 30px 80px rgba(0,0,0,.55);
  width: 100%; max-width: 1180px; height: 90vh; display: flex; flex-direction: column; overflow: hidden;
  border: 1px solid var(--line);
}
.modal-head {
  display: flex; align-items: center; gap: 14px; padding: 14px 18px; border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}
.modal-title { min-width: 0; flex: 1; }
.modal-title h3 { margin: 0; font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.modal-title .sub { color: var(--muted); font-size: 13px; }
.modal-tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 9px; overflow: hidden; }
.seg button {
  border: 0; background: var(--panel); padding: 8px 12px; cursor: pointer; font-weight: 700; font-size: 13px; color: #c4d4e6;
}
.seg button.on { background: var(--grad); color: #fff; }
.icon-btn {
  width: 38px; height: 38px; border: 1px solid var(--line); background: var(--panel); border-radius: 9px;
  cursor: pointer; font-size: 17px; color: #c4d4e6; display: grid; place-items: center; transition: .15s;
}
.icon-btn:hover { border-color: var(--brand); color: var(--brand); }
.icon-btn:disabled { opacity: .35; cursor: not-allowed; }
.modal-frame-wrap {
  flex: 1; background: #07111d; display: flex; justify-content: center; align-items: stretch;
  overflow: auto; padding: 0;
}
.modal-frame-wrap.mobile { padding: 20px; align-items: flex-start; }
.modal-frame-wrap iframe {
  width: 100%; height: 100%; border: 0; background: #fff; display: block;
}
.modal-frame-wrap.mobile iframe {
  width: 390px; height: 100%; max-width: 100%; border-radius: 22px;
  box-shadow: 0 14px 40px rgba(0,0,0,.25); border: 8px solid #0b1220;
}
@media (max-width: 760px) {
  .modal { padding: 0; }
  .modal-dialog { height: 100vh; border-radius: 0; max-width: none; }
  .modal-head { padding: 10px 12px; }
  .modal-title h3 { font-size: 15px; }
  .modal-tools .label-open { display: none; }
}
