/* =========================================================
   Shared base for SaaSQube demo templates.
   Each template sets its own palette and fonts via CSS
   variables in its <style> block, and adds its own sections.
   ========================================================= */

*,
*::before,
*::after { box-sizing: border-box; }

html { scroll-behavior: smooth; scroll-padding-top: 84px; }

body {
  margin: 0;
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

img, svg { display: block; max-width: 100%; }
a { color: inherit; }
h1, h2, h3, h4 { font-family: var(--font-head, var(--font)); color: var(--heading, var(--text)); line-height: 1.15; margin: 0 0 .5em; }
h1 { font-size: clamp(2.2rem, 5vw, 3.6rem); }
h2 { font-size: clamp(1.7rem, 3.4vw, 2.5rem); }
h3 { font-size: 1.15rem; }
p { margin: 0 0 1em; }

.container { width: min(1160px, 100% - 32px); margin-inline: auto; }
.section { padding: clamp(56px, 8vw, 96px) 0; }
.section-alt { background: var(--alt, var(--bg)); }
.section-head { text-align: center; max-width: 660px; margin: 0 auto 44px; }
.section-head p { color: var(--muted); }
.kicker {
  display: inline-block; font-size: .78rem; font-weight: 700; letter-spacing: .14em;
  text-transform: uppercase; color: var(--kicker, var(--primary)); margin-bottom: 10px;
}
.muted { color: var(--muted); }

:focus-visible { outline: 3px solid var(--accent, var(--primary)); outline-offset: 2px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5em;
  padding: 13px 24px; border-radius: var(--btn-radius, 999px); border: 2px solid transparent;
  font: 600 .97rem/1 var(--font); text-decoration: none; cursor: pointer; white-space: nowrap;
  transition: transform .2s, background .2s, color .2s, border-color .2s;
}
.btn:hover { transform: translateY(-2px); }
.btn-primary { background: var(--primary); color: var(--on-primary, #fff); }
.btn-primary:hover { background: var(--primary-dark, var(--primary)); }
.btn-accent { background: var(--accent); color: var(--on-accent, #fff); }
.btn-outline { background: transparent; border-color: currentColor; }
.btn-block { width: 100%; }
.btn-sm { padding: 10px 18px; font-size: .9rem; }

/* ---------- Grids ---------- */
.grid { display: grid; gap: 22px; }
.g2 { grid-template-columns: repeat(2, 1fr); }
.g3 { grid-template-columns: repeat(3, 1fr); }
.g4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 960px) {
  .g3, .g4 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 620px) {
  .g2, .g3 { grid-template-columns: 1fr; }
  .g4 { grid-template-columns: repeat(2, 1fr); gap: 14px; }
  .g4.stack { grid-template-columns: 1fr; }
}

/* Let grid children shrink below their content's natural width on small phones. */
.grid > *, [class*="-grid"] > * { min-width: 0; }
@media (max-width: 400px) {
  .card { padding: 18px; }
  .search .btn { padding-inline: 16px; }
}

/* ---------- Demo bar (links back to SaaSQube) ---------- */
.demo-bar { background: #0d1440; color: #c4d2f5; font: 500 .82rem/1.3 "Plus Jakarta Sans", system-ui, sans-serif; position: relative; z-index: 60; }
.demo-bar .container { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 0; }
.demo-bar a { color: #fff; text-decoration: none; font-weight: 600; }
.demo-bar a:hover { text-decoration: underline; }
.demo-bar strong { color: #fff; }
.demo-bar .db-cta { background: linear-gradient(100deg, #06c3e6, #1a4ff0 55%, #9b2cf5); color: #fff; padding: 6px 14px; border-radius: 999px; white-space: nowrap; }
.demo-bar .db-cta:hover { text-decoration: none; filter: brightness(1.05); }
@media (max-width: 600px) { .demo-bar .db-text { display: none; } }
.in-frame .demo-bar, .in-frame .t-wa { display: none; }

/* ---------- Header ---------- */
.t-header {
  position: sticky; top: 0; z-index: 50;
  background: var(--header-bg, var(--bg)); border-bottom: 1px solid var(--line);
}
.t-nav-wrap { display: flex; align-items: center; justify-content: space-between; height: 72px; gap: 20px; }
.t-logo {
  display: flex; align-items: center; gap: 10px; text-decoration: none;
  font-family: var(--font-head, var(--font)); font-weight: 800; font-size: 1.3rem; color: var(--heading, var(--text));
  line-height: 1.05;
}
.t-logo small { display: block; font: 600 .62rem/1.2 var(--font); letter-spacing: .2em; text-transform: uppercase; color: var(--muted); }
.t-logo .mark {
  flex: none; width: 40px; height: 40px; border-radius: var(--mark-radius, 12px); display: grid; place-items: center;
  background: var(--primary); color: var(--on-primary, #fff); font-size: 1.25rem;
}
.t-nav { display: flex; align-items: center; gap: 26px; }
.t-nav a:not(.btn) { text-decoration: none; font-weight: 500; font-size: .95rem; color: var(--nav-color, var(--text)); opacity: .85; }
.t-nav a:not(.btn):hover { opacity: 1; color: var(--primary); }
.t-toggle { display: none; background: none; border: 0; padding: 8px; cursor: pointer; }
.t-toggle span { display: block; width: 24px; height: 2px; background: var(--heading, var(--text)); margin: 5px 0; border-radius: 2px; transition: transform .3s, opacity .3s; }
.t-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.t-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.t-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

@media (max-width: 900px) {
  .t-toggle { display: block; }
  .t-nav {
    display: none; position: absolute; top: 100%; left: 0; right: 0;
    flex-direction: column; align-items: stretch; gap: 0;
    background: var(--header-bg, var(--bg)); padding: 6px 16px 20px;
    border-bottom: 1px solid var(--line); box-shadow: 0 24px 30px -24px rgba(0, 0, 0, .35);
  }
  .t-nav.open { display: flex; }
  .t-nav a:not(.btn) { padding: 13px 0; border-bottom: 1px solid var(--line); font-size: 1.02rem; }
  .t-nav .btn { margin-top: 16px; }
}

/* ---------- Top info bar ---------- */
.topbar { background: var(--topbar-bg, var(--primary)); color: var(--topbar-color, #fff); font-size: .85rem; }
.topbar .container { display: flex; justify-content: space-between; gap: 16px; padding: 8px 0; flex-wrap: wrap; }
.topbar a { text-decoration: none; font-weight: 600; }
@media (max-width: 600px) { .topbar .container { justify-content: center; text-align: center; } .topbar .hide-sm { display: none; } }

/* ---------- Cards ---------- */
.card {
  background: var(--surface, #fff); border: 1px solid var(--line); border-radius: var(--radius, 16px);
  padding: 26px; transition: transform .25s, box-shadow .25s;
}
.card:hover { transform: translateY(-4px); box-shadow: var(--shadow, 0 16px 34px -18px rgba(0, 0, 0, .25)); }
.card p:last-child { margin-bottom: 0; }

.emoji-tile {
  width: 56px; height: 56px; border-radius: 14px; display: grid; place-items: center;
  font-size: 1.7rem; background: var(--tint, rgba(0, 0, 0, .05)); margin-bottom: 16px;
}

/* ---------- Forms ---------- */
.form { display: grid; gap: 14px; }
.form label { display: grid; gap: 6px; font-size: .88rem; font-weight: 600; color: var(--label, inherit); }
.form input, .form select, .form textarea {
  font: inherit; font-size: .97rem; width: 100%; padding: 12px 14px;
  border: 1px solid var(--field-line, var(--line)); border-radius: var(--field-radius, 10px);
  background: var(--field-bg, #fff); color: var(--field-text, var(--text));
}
.form textarea { resize: vertical; min-height: 96px; }
.form input:focus, .form select:focus, .form textarea:focus { outline: 2px solid var(--primary); outline-offset: 1px; border-color: transparent; }
.form .row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form .check { display: flex; align-items: center; gap: 10px; font-weight: 500; }
.form .check input { width: 18px; height: 18px; accent-color: var(--primary); }
.form-msg { margin: 0; min-height: 1.3em; font-size: .9rem; font-weight: 600; color: var(--form-msg, var(--primary)); }
@media (max-width: 560px) { .form .row { grid-template-columns: 1fr; } }

/* ---------- Tabs ---------- */
.tabs { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-bottom: 32px; }
.tab {
  font: 600 .92rem var(--font); padding: 10px 20px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--line); background: transparent; color: var(--text); transition: all .2s;
}
.tab:hover { border-color: var(--primary); }
.tab.active { background: var(--primary); color: var(--on-primary, #fff); border-color: var(--primary); }
.tab-panel[hidden] { display: none; }

/* ---------- Steps ---------- */
.steps { list-style: none; margin: 0; padding: 0; counter-reset: step; }
.steps li { counter-increment: step; position: relative; }
.steps li::before {
  content: counter(step); display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%;
  background: var(--primary); color: var(--on-primary, #fff); font-weight: 800; margin-bottom: 14px;
}

/* ---------- Map placeholder ---------- */
.map-ph {
  min-height: 260px; border-radius: var(--radius, 16px); border: 1px solid var(--line); position: relative; overflow: hidden;
  background:
    linear-gradient(90deg, rgba(127, 127, 127, .12) 1px, transparent 1px) 0 0 / 34px 34px,
    linear-gradient(rgba(127, 127, 127, .12) 1px, transparent 1px) 0 0 / 34px 34px,
    var(--map-bg, #eef2f0);
  display: grid; place-items: center; text-align: center; color: var(--muted); font-size: .9rem;
}
.map-ph .pin { font-size: 2.4rem; display: block; margin-bottom: 6px; filter: drop-shadow(0 6px 8px rgba(0, 0, 0, .25)); }

/* ---------- Footer ---------- */
.t-footer { padding: 52px 0 24px; font-size: .92rem; background: var(--footer-bg, #111); color: var(--footer-text, #cfcfcf); }
.t-footer h4 { color: var(--footer-head, #fff); font-size: 1rem; margin-bottom: 12px; font-family: var(--font); }
.t-footer .cols { display: grid; grid-template-columns: 1.8fr 1fr 1fr 1.4fr; gap: 30px; }
.t-footer ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 7px; }
.t-footer a { text-decoration: none; opacity: .9; }
.t-footer a:hover { opacity: 1; text-decoration: underline; }
.t-footer .t-logo { color: var(--footer-head, #fff); margin-bottom: 12px; }
.t-footer .bottom {
  margin-top: 36px; padding-top: 18px; border-top: 1px solid rgba(127, 127, 127, .25);
  display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; opacity: .8;
}
.t-footer .bottom p { margin: 0; }
@media (max-width: 820px) { .t-footer .cols { grid-template-columns: 1fr 1fr; } }
@media (max-width: 520px) { .t-footer .cols { grid-template-columns: 1fr; } }

/* ---------- WhatsApp float ---------- */
.t-wa {
  position: fixed; right: 18px; bottom: 18px; z-index: 40; width: 56px; height: 56px; border-radius: 50%;
  background: #25d366; color: #fff; display: grid; place-items: center; box-shadow: 0 12px 26px -8px rgba(37, 211, 102, .6);
  transition: transform .2s;
}
.t-wa:hover { transform: scale(1.08); }
.t-wa svg { width: 28px; height: 28px; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
