/* ===== Наръчник Mazda 6 — стилове ===== */

:root {
  --bg: #f4f5f7;
  --surface: #ffffff;
  --surface-2: #f0f2f5;
  --text: #1a1d21;
  --muted: #5b6470;
  --accent: #d6001c;
  --accent-soft: #fde7e9;
  --border: #e3e6ea;
  --shadow: 0 1px 3px rgba(0,0,0,.06), 0 6px 20px rgba(0,0,0,.05);
  --radius: 14px;
  --warn-bg: #fff4e5; --warn-bd: #f0a84b; --warn-tx: #7a4a06;
  --danger-bg: #fde7e9; --danger-bd: #e0344b; --danger-tx: #8a1020;
  --tip-bg: #e6f5ec; --tip-bd: #45a86b; --tip-tx: #1d5e36;
  --info-bg: #e7f0fb; --info-bd: #4b8ad6; --info-tx: #194472;
}

[data-theme="dark"] {
  --bg: #121417;
  --surface: #1c2026;
  --surface-2: #242931;
  --text: #e8eaed;
  --muted: #9aa3ad;
  --accent: #ff4d4f;
  --accent-soft: #3a1f22;
  --border: #2d333c;
  --shadow: 0 1px 3px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.35);
  --warn-bg: #3a2f1a; --warn-bd: #b7822f; --warn-tx: #f1c277;
  --danger-bg: #3a1f22; --danger-bd: #d2384f; --danger-tx: #f3a3ad;
  --tip-bg: #1c3326; --tip-bd: #3f8c5d; --tip-tx: #8ad9a5;
  --info-bg: #1b2c40; --info-bd: #4477b3; --info-tx: #9cc4ee;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', -apple-system, Segoe UI, Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

.container { max-width: 960px; margin: 0 auto; padding: 0 18px; }

/* ===== Header ===== */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.header-inner {
  max-width: 960px; margin: 0 auto; padding: 10px 18px;
  display: flex; align-items: center; gap: 14px;
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); flex-shrink: 0; }
.brand-mark {
  background: var(--accent); color: #fff; font-weight: 800;
  width: 42px; height: 42px; border-radius: 10px;
  display: grid; place-items: center; font-size: 17px; letter-spacing: -.5px;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.25; }
.brand-text strong { font-size: 15px; }
.brand-text small { font-size: 11px; color: var(--muted); }

.header-search { flex: 1; position: relative; min-width: 0; }
.header-search .search-icon {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  width: 18px; height: 18px; fill: var(--muted); pointer-events: none;
}
#search-input {
  width: 100%; padding: 11px 14px 11px 38px;
  border: 1px solid var(--border); border-radius: 10px;
  background: var(--surface-2); color: var(--text); font-size: 15px;
  font-family: inherit;
}
#search-input:focus { outline: 2px solid var(--accent); outline-offset: 0; }

.icon-btn {
  background: var(--surface-2); border: 1px solid var(--border);
  width: 42px; height: 42px; border-radius: 10px; cursor: pointer;
  display: grid; place-items: center; flex-shrink: 0;
}
.icon-btn svg { width: 22px; height: 22px; fill: none; stroke: var(--text); stroke-width: 2; stroke-linecap: round; }
.icon-btn:hover { border-color: var(--accent); }

/* ===== Hero ===== */
.hero {
  text-align: center; padding: 38px 16px 26px;
}
.hero h1 { font-size: 30px; font-weight: 800; letter-spacing: -.5px; }
.hero p { color: var(--muted); margin-top: 8px; font-size: 16px; max-width: 620px; margin-left: auto; margin-right: auto; }
.hero-badge {
  display: inline-block; background: var(--accent-soft); color: var(--accent);
  font-weight: 700; font-size: 12px; padding: 5px 12px; border-radius: 20px;
  margin-bottom: 14px; letter-spacing: .3px;
}

/* ===== Category grid ===== */
.grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px; margin: 8px 0 40px;
}
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px; text-decoration: none;
  color: var(--text); display: flex; flex-direction: column; gap: 6px;
  transition: transform .12s ease, border-color .12s ease, box-shadow .12s ease;
}
.card:hover { transform: translateY(-3px); border-color: var(--accent); box-shadow: var(--shadow); }
.card-icon { font-size: 30px; }
.card h3 { font-size: 17px; font-weight: 700; }
.card p { font-size: 13px; color: var(--muted); }
.card .count { font-size: 12px; color: var(--accent); font-weight: 600; margin-top: 4px; }

/* ===== Section title ===== */
.section-head { margin: 28px 0 14px; }
.section-head h2 { font-size: 22px; font-weight: 800; }
.section-head p { color: var(--muted); font-size: 14px; }

/* ===== Breadcrumb ===== */
.crumb { display: flex; gap: 7px; align-items: center; font-size: 13px; color: var(--muted); margin: 20px 0 12px; flex-wrap: wrap; }
.crumb a { color: var(--accent); text-decoration: none; }
.crumb a:hover { text-decoration: underline; }

/* ===== Article list ===== */
.article-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 36px; }
.article-link {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; padding: 16px 18px; text-decoration: none;
  color: var(--text); display: flex; align-items: center; gap: 14px;
  transition: border-color .12s ease, transform .12s ease;
}
.article-link:hover { border-color: var(--accent); transform: translateX(3px); }
.article-link .a-icon { font-size: 24px; flex-shrink: 0; }
.article-link .a-body { flex: 1; min-width: 0; }
.article-link .a-body strong { font-size: 15px; font-weight: 600; display: block; }
.article-link .a-body span { font-size: 12.5px; color: var(--muted); }
.article-link .a-arrow { color: var(--muted); font-size: 20px; }
.tag-pill {
  display: inline-block; font-size: 11px; font-weight: 600; padding: 2px 8px;
  border-radius: 20px; background: var(--surface-2); color: var(--muted);
}

/* ===== Article content ===== */
.article { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 26px 28px 32px; margin-bottom: 36px; }
.article h1 { font-size: 26px; font-weight: 800; line-height: 1.3; margin-bottom: 6px; }
.article h2 { font-size: 19px; font-weight: 700; margin: 26px 0 10px; padding-bottom: 6px; border-bottom: 2px solid var(--border); }
.article h3 { font-size: 16px; font-weight: 700; margin: 18px 0 8px; }
.article p { margin: 10px 0; }
.article ul, .article ol { margin: 10px 0 10px 22px; }
.article li { margin: 5px 0; }
.article a { color: var(--accent); }
.article strong { font-weight: 700; }
.lead { font-size: 16px; color: var(--muted); }

/* meta bar (difficulty / time / cost) */
.meta-bar { display: flex; flex-wrap: wrap; gap: 10px; margin: 16px 0 8px; }
.meta-chip {
  display: flex; align-items: center; gap: 7px; background: var(--surface-2);
  border: 1px solid var(--border); border-radius: 10px; padding: 8px 12px; font-size: 13px;
}
.meta-chip b { font-weight: 700; }
.meta-chip .m-ico { font-size: 16px; }
.diff-1 { color: #45a86b; } .diff-2 { color: #c98a1a; } .diff-3 { color: var(--accent); }

/* boxes */
.box { border-radius: 12px; padding: 14px 16px; margin: 16px 0; border-left: 5px solid; font-size: 14.5px; }
.box .box-title { font-weight: 700; display: flex; align-items: center; gap: 7px; margin-bottom: 4px; }
.box.warn   { background: var(--warn-bg);   border-color: var(--warn-bd);   color: var(--warn-tx); }
.box.danger { background: var(--danger-bg); border-color: var(--danger-bd); color: var(--danger-tx); }
.box.tip    { background: var(--tip-bg);    border-color: var(--tip-bd);    color: var(--tip-tx); }
.box.info   { background: var(--info-bg);   border-color: var(--info-bd);   color: var(--info-tx); }
.box p { margin: 4px 0; }
.box a { color: inherit; font-weight: 600; }

/* tools / parts list */
.kit { background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; padding: 14px 18px; margin: 16px 0; }
.kit h4 { font-size: 14px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); margin-bottom: 8px; }
.kit ul { list-style: none; margin: 0; }
.kit li { padding: 4px 0 4px 24px; position: relative; font-size: 14.5px; }
.kit li::before { content: "✓"; position: absolute; left: 0; color: var(--tip-bd); font-weight: 700; }

/* steps */
.steps { counter-reset: step; list-style: none; margin: 16px 0 !important; padding: 0; }
.steps > li {
  counter-increment: step; position: relative; padding: 4px 0 16px 46px;
  border-left: 2px solid var(--border); margin-left: 16px;
}
.steps > li:last-child { border-left-color: transparent; }
.steps > li::before {
  content: counter(step); position: absolute; left: -16px; top: 0;
  width: 32px; height: 32px; border-radius: 50%; background: var(--accent);
  color: #fff; font-weight: 700; display: grid; place-items: center; font-size: 14px;
}
.steps > li strong:first-child { display: block; margin-bottom: 2px; }

/* spec table */
.spec-table { width: 100%; border-collapse: collapse; margin: 14px 0; font-size: 14px; }
.spec-table th, .spec-table td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--border); }
.spec-table th { background: var(--surface-2); font-weight: 700; }
.spec-table tr:hover td { background: var(--surface-2); }
.spec-table td:first-child { font-weight: 600; width: 45%; }
.table-wrap { overflow-x: auto; }

/* diagram */
.diagram { background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; padding: 16px; margin: 18px 0; text-align: center; }
.diagram svg { max-width: 100%; height: auto; }
.diagram figcaption { font-size: 13px; color: var(--muted); margin-top: 8px; }

/* resources */
.resources { margin: 20px 0; }
.resources a {
  display: flex; align-items: center; gap: 10px; padding: 11px 14px;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px;
  text-decoration: none; color: var(--text); margin: 7px 0; font-size: 14px;
}
.resources a:hover { border-color: var(--accent); }
.resources a .r-ico { font-size: 18px; }
.resources a small { color: var(--muted); display: block; }

/* prev/next */
.article-nav { display: flex; justify-content: space-between; gap: 12px; margin-top: 24px; }
.article-nav a {
  flex: 1; background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; padding: 14px 16px; text-decoration: none; color: var(--text);
  font-size: 14px;
}
.article-nav a:hover { border-color: var(--accent); }
.article-nav a small { color: var(--muted); display: block; font-size: 12px; }
.article-nav a.next { text-align: right; }

/* empty / no results */
.empty { text-align: center; padding: 60px 20px; color: var(--muted); }
.empty .big { font-size: 46px; margin-bottom: 10px; }

/* mobile */
@media (max-width: 620px) {
  .brand-text { display: none; }
  .hero h1 { font-size: 24px; }
  .article { padding: 20px 16px 26px; }
  .article h1 { font-size: 22px; }
  .header-inner { gap: 10px; }
}

/* print */
@media print {
  .site-header, .site-footer, .article-nav, .resources { display: none; }
  .article { border: none; padding: 0; }
}

/* ===== AI БАНЕР НА НАЧАЛОТО ===== */
.ai-banner {
  display: flex; align-items: center; gap: 18px;
  background: linear-gradient(135deg, var(--accent) 0%, #8b0014 100%);
  color: #fff; padding: 22px 24px; border-radius: var(--radius);
  text-decoration: none; margin: 0 0 22px;
  box-shadow: 0 6px 22px rgba(214, 0, 28, 0.25);
  transition: transform .15s ease, box-shadow .15s ease;
}
.ai-banner:hover { transform: translateY(-2px); box-shadow: 0 10px 28px rgba(214,0,28,.35); }
.ai-banner-icon { font-size: 44px; flex-shrink: 0; }
.ai-banner-text { flex: 1; min-width: 0; }
.ai-banner-text h3 { font-size: 19px; font-weight: 800; margin-bottom: 4px; }
.ai-banner-text p { font-size: 14px; opacity: .92; line-height: 1.45; }
.ai-banner-arrow { font-size: 28px; opacity: .85; flex-shrink: 0; }
@media (max-width: 620px) {
  .ai-banner { padding: 18px; gap: 14px; }
  .ai-banner-icon { font-size: 36px; }
  .ai-banner-text h3 { font-size: 16px; }
  .ai-banner-text p { font-size: 13px; }
}

/* ===== AI ЧАТ СТРАНИЦА ===== */
.ask-page { display: flex; flex-direction: column; min-height: calc(100vh - 90px); }
.ask-intro {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px 22px; margin: 12px 0 16px;
}
.ask-intro h2 { font-size: 22px; font-weight: 800; margin-bottom: 6px; }
.ask-intro p { color: var(--muted); font-size: 14.5px; }
.ask-disclaimer {
  margin-top: 10px; padding: 10px 12px; background: var(--info-bg);
  border-left: 4px solid var(--info-bd); border-radius: 8px;
  font-size: 13px; color: var(--info-tx);
}

.chat {
  flex: 1; display: flex; flex-direction: column; gap: 14px;
  padding: 14px 0 20px;
}
.chat-empty {
  text-align: center; padding: 30px 16px; color: var(--muted);
}
.chat-empty .big { font-size: 50px; margin-bottom: 8px; }

.chat-msg {
  display: flex; gap: 10px; max-width: 92%;
  animation: slideIn 0.25s ease-out;
}
@keyframes slideIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
.chat-msg.user { align-self: flex-end; flex-direction: row-reverse; }
.chat-msg .avatar {
  width: 36px; height: 36px; border-radius: 50%;
  display: grid; place-items: center; flex-shrink: 0;
  font-size: 18px; font-weight: 700;
}
.chat-msg.user .avatar { background: var(--accent); color: #fff; }
.chat-msg.bot .avatar { background: var(--surface-2); border: 1px solid var(--border); }
.chat-msg .bubble {
  background: var(--surface); border: 1px solid var(--border);
  padding: 12px 15px; border-radius: 14px; font-size: 14.5px; line-height: 1.55;
}
.chat-msg.user .bubble { background: var(--accent-soft); border-color: var(--accent); }
.chat-msg.bot .bubble p { margin: 4px 0; }
.chat-msg.bot .bubble strong { font-weight: 700; }
.chat-msg.bot .bubble ul, .chat-msg.bot .bubble ol { margin: 6px 0 6px 20px; }
.chat-msg.bot .bubble a { color: var(--accent); font-weight: 600; }
.chat-msg .typing {
  display: inline-flex; gap: 4px; padding: 4px 0;
}
.chat-msg .typing span {
  width: 7px; height: 7px; border-radius: 50%; background: var(--muted);
  animation: bounce 1.2s infinite;
}
.chat-msg .typing span:nth-child(2) { animation-delay: 0.15s; }
.chat-msg .typing span:nth-child(3) { animation-delay: 0.30s; }
@keyframes bounce { 0%, 60%, 100% { transform: translateY(0); } 30% { transform: translateY(-5px); } }

.chat-sources {
  margin-top: 10px; padding-top: 10px;
  border-top: 1px dashed var(--border); font-size: 13px;
}
.chat-sources strong { color: var(--muted); font-size: 11.5px; text-transform: uppercase; letter-spacing: .5px; display: block; margin-bottom: 5px; }
.chat-sources a {
  display: inline-block; margin: 3px 6px 3px 0; padding: 4px 10px;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 16px; text-decoration: none; color: var(--text);
  font-size: 12.5px;
}
.chat-sources a:hover { border-color: var(--accent); color: var(--accent); }

.chat-suggestions { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 4px; }
.chat-suggestions button {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 18px; padding: 7px 14px; font-size: 13px;
  cursor: pointer; color: var(--text); font-family: inherit;
}
.chat-suggestions button:hover { border-color: var(--accent); color: var(--accent); }

.chat-input-bar {
  position: sticky; bottom: 0; background: var(--bg);
  padding: 12px 0; display: flex; gap: 8px;
  border-top: 1px solid var(--border);
}
.chat-input-bar input {
  flex: 1; padding: 13px 16px; border: 1px solid var(--border);
  border-radius: 24px; background: var(--surface); color: var(--text);
  font-size: 15px; font-family: inherit;
}
.chat-input-bar input:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: var(--accent); }
.chat-input-bar button {
  background: var(--accent); color: #fff; border: none;
  width: 50px; height: 50px; border-radius: 50%; cursor: pointer;
  font-size: 22px; flex-shrink: 0;
  display: grid; place-items: center;
}
.chat-input-bar button:hover { background: #b30018; }
.chat-input-bar button:disabled { opacity: 0.5; cursor: not-allowed; }

/* ===== Shop / research chip rows ===== */
.shop-links {
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
  margin: 12px 0 18px; padding: 12px 14px;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px;
  font-size: 13.5px;
}
.shop-links strong { color: var(--muted); font-weight: 700; }
.shop-links a {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 6px 12px; background: var(--surface);
  border: 1px solid var(--border); border-radius: 18px;
  text-decoration: none; color: var(--text); font-weight: 500;
  transition: border-color .15s ease, color .15s ease;
}
.shop-links a:hover { border-color: var(--accent); color: var(--accent); }

/* "Виж в магазин" бутон в price таблиците */
.tbl-search {
  display: inline-flex; align-items: center; gap: 5px;
  margin-top: 5px; padding: 4px 10px;
  background: var(--accent); border: 1px solid var(--accent);
  border-radius: 14px; text-decoration: none; color: #fff;
  font-size: 11.5px; font-weight: 600; line-height: 1.2;
  transition: background .15s ease;
}
.tbl-search:hover { background: #b30018; border-color: #b30018; }
.tbl-search span { display: inline; }

/* Universal "Find anywhere" panel at bottom of every article */
.find-panel {
  margin: 22px 0 12px; padding: 16px 18px;
  background: linear-gradient(135deg, rgba(214,0,28,0.05), rgba(214,0,28,0.02));
  border: 1px solid var(--border); border-radius: 12px;
}
[data-theme="dark"] .find-panel {
  background: linear-gradient(135deg, rgba(255,77,79,0.08), rgba(255,77,79,0.02));
}
.find-panel h4 {
  font-size: 13px; text-transform: uppercase; letter-spacing: .6px;
  color: var(--muted); margin-bottom: 10px; font-weight: 700;
}
.find-panel .find-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 8px;
}
.find-panel .find-grid a {
  display: flex; align-items: center; gap: 8px; padding: 10px 12px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; text-decoration: none; color: var(--text);
  font-size: 13px; line-height: 1.3;
}
.find-panel .find-grid a:hover { border-color: var(--accent); }
.find-panel .find-grid .fi { font-size: 18px; flex-shrink: 0; }
.find-panel .find-grid span { min-width: 0; }
.find-panel .find-grid small { display: block; color: var(--muted); font-size: 11px; }
