/* ================================================================
   GaraOne Hướng dẫn — Chuẩn UI trang docs
   Theo: docs/ke-hoach/03-chuan-ui-trang-docs.md
   Font: Be Vietnam Pro (nhúng cục bộ, không CDN)
   ================================================================ */

/* --- @font-face (local WOFF2) --- */
@font-face {
  font-family: 'Be Vietnam Pro';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('../fonts/BeVietnamPro-Regular.woff2') format('woff2');
}
@font-face {
  font-family: 'Be Vietnam Pro';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('../fonts/BeVietnamPro-Medium.woff2') format('woff2');
}
@font-face {
  font-family: 'Be Vietnam Pro';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('../fonts/BeVietnamPro-SemiBold.woff2') format('woff2');
}
@font-face {
  font-family: 'Be Vietnam Pro';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('../fonts/BeVietnamPro-Bold.woff2') format('woff2');
}

/* --- CSS variables (Light = default) --- */
/* Bảng màu và bố cục sidebar lấy theo docs/shop-owner-guide của InnoShop (chuẩn UI ở docs/ke-hoach/03). */
:root {
  --bg: #f5f6f2;
  --bg-card: #ffffff;
  --bg-sidebar: #f5f6f2;
  --bg-sidebar-hover: #ffffff;
  --text: #16221d;
  --text-muted: #5f6e67;
  --text-sidebar: #55655e;
  --text-sidebar-active: #16221d;
  --accent: #0e6b54;
  --accent-ink: #0a4d3d;
  --accent-light: #e1efe8;
  --border: #dfe3dc;
  --border-light: #e9ece6;
  --radius: 10px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(22,34,29,.04), 0 8px 24px -12px rgba(22,34,29,.18);
  --shadow-lg: 0 10px 30px rgba(22,34,29,.10);
  --max-content: 720px;
  --sidebar-w: 264px;
  --font: 'Be Vietnam Pro', system-ui, -apple-system, sans-serif;
  /* Role colors */
  --role-admin: #4f46e5;
  --role-advisor: #059669;
  --role-technician: #ea580c;
  --role-cashier: #ca8a04;
  --role-warehouse: #0891b2;
}

/* --- Dark mode --- */
:root[data-theme="dark"] {
  --bg: #101915;
  --bg-card: #16211c;
  --bg-sidebar: #101915;
  --bg-sidebar-hover: #16211c;
  --text: #e9efe9;
  --text-muted: #7f8f87;
  --text-sidebar: #9fb0a8;
  --text-sidebar-active: #e9efe9;
  --accent: #3fcf9e;
  --accent-ink: #bdf2dc;
  --accent-light: #16332a;
  --border: #25322c;
  --border-light: #1d2a24;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px -12px rgba(0,0,0,.5);
  --shadow-lg: 0 10px 30px rgba(0,0,0,.5);
}

/* --- Reset --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; height: auto; }
ul, ol { padding-left: 1.5em; }

/* --- Layout: sidebar + content --- */
.layout { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar-w);
  background: var(--bg-sidebar);
  color: var(--text-sidebar);
  border-right: 1px solid var(--border);
  position: fixed;
  top: 0; left: 0; bottom: 0;
  overflow-y: auto;
  z-index: 100;
  transition: transform .25s ease;
  display: flex;
  flex-direction: column;
  padding: 28px 18px 18px;
}
.ico { flex-shrink: 0; vertical-align: -3px; }

/* Thương hiệu: ô vuông màu chủ đạo có chữ cái, tên + dòng phụ */
.sidebar-brand {
  display: flex; align-items: center; gap: 10px;
  padding: 2px 10px 22px;
  color: var(--text); text-decoration: none;
}
.sidebar-brand:hover { text-decoration: none; }
.brand-mark {
  width: 30px; height: 30px; border-radius: 8px; background: var(--accent);
  display: flex; align-items: center; justify-content: center;
  color: var(--bg-card); font-weight: 800; font-size: 14px; flex: none;
}
.sb-name { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.sb-title { font-size: 15px; font-weight: 700; letter-spacing: -.01em; }
.sb-sub { font-size: 11.5px; color: var(--text-muted); font-weight: 500; }

/* Điều hướng */
.sidebar-nav { flex: 1; padding: 0 0 8px; display: flex; flex-direction: column; }
.sidebar-section-label {
  padding: 14px 10px 6px;
  font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  color: var(--text-muted);
}
.sidebar-nav .sidebar-section-label:first-child { padding-top: 4px; }
.sidebar-link {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 9px 10px; margin-bottom: 1px;
  border-radius: var(--radius-sm);
  color: var(--text-sidebar);
  font-size: 14.5px; font-weight: 500; line-height: 1.4;
}
.sidebar-link:hover { background: var(--bg-sidebar-hover); color: var(--text-sidebar-active); text-decoration: none; }
.sidebar-link.active { background: var(--accent-light); color: var(--accent-ink); font-weight: 700; }
.sidebar-link.role-hidden { display: none; }
.sl-ico { display: inline-flex; margin-top: 1px; opacity: .85; }
.sidebar-link.active .sl-ico { opacity: 1; }
.sl-id {
  flex-shrink: 0; min-width: 24px; margin-top: 2px;
  font-size: 11.5px; font-weight: 600; color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}
.sidebar-link.active .sl-id { color: var(--accent-ink); }
.sl-text { min-width: 0; }

/* Chân sidebar */
.sidebar-footer { padding-top: 12px; border-top: 1px solid var(--border); }
.theme-toggle {
  display: flex; align-items: center; gap: 10px; width: 100%;
  background: none; border: 0; border-radius: var(--radius-sm);
  padding: 9px 10px; font-size: 14px; font-weight: 500; text-align: left;
  color: var(--text-sidebar); cursor: pointer; font-family: var(--font);
}
.theme-toggle:hover { background: var(--bg-sidebar-hover); color: var(--text-sidebar-active); }

/* Bộ lọc vai trò */
.sidebar-role-filter { margin: 2px 0 4px; }
.srf-label { display: block; padding: 6px 10px 6px; font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--text-muted); }
.sidebar-role-filter select {
  width: 100%; height: 38px; padding: 0 30px 0 12px;
  border-radius: var(--radius-sm); border: 1px solid var(--border);
  background: var(--bg-card) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2355655e' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m7 15 5 5 5-5'/%3E%3Cpath d='m7 9 5-5 5 5'/%3E%3C/svg%3E") no-repeat right 11px center;
  color: var(--text); font-family: var(--font); font-size: 14px; font-weight: 500;
  cursor: pointer; appearance: none; -webkit-appearance: none;
}
.sidebar-role-filter select:focus { outline: 2px solid color-mix(in srgb, var(--accent) 40%, transparent); outline-offset: 1px; }

/* --- Main content --- */
.content { flex: 1; margin-left: var(--sidebar-w); padding: 0; }
.content-inner {
  /* Rộng 960px để các bước và khung ảnh có chỗ thở như docs InnoShop; chữ văn xuôi vẫn giữ hàng ngắn dễ đọc (720px). */
  max-width: 1056px;
  margin: 0;
  padding: 44px 48px 90px;
}
.page-head, .perm-note, .pager,
.article-body > :not(.steps):not(.shot):not(.path-section) { max-width: var(--max-content); }
.steps, .step, .shot { max-width: 960px; }

/* Mobile sidebar toggle */
.menu-toggle {
  display: none;
  position: fixed; top: 12px; left: 12px; z-index: 101;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 8px 12px;
  cursor: pointer; font-size: 18px; color: var(--text);
}
.overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,.4); z-index: 99;
}

/* --- Page head --- */
.page-head { margin-bottom: 28px; }
.page-head .breadcrumb {
  font-size: 13px; color: var(--text-muted); margin-bottom: 8px;
}
.page-head .breadcrumb a { color: var(--text-muted); }
.page-head h1 {
  font-size: 28px; font-weight: 700; line-height: 1.3;
  margin-bottom: 10px; color: var(--text);
}
.page-head .meta {
  display: flex; align-items: center; gap: 14px;
  font-size: 13px; color: var(--text-muted); flex-wrap: wrap;
}
.page-head .meta .surface-badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px; border-radius: 20px;
  background: var(--accent-light); color: var(--accent);
  font-size: 12px; font-weight: 500;
}

/* --- Role badge --- */
.role-badges { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.role-badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 10px; border-radius: 20px;
  font-size: 12px; font-weight: 500;
  color: #fff;
}
.role-badge::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: rgba(255,255,255,.6); }
.role-badge.admin { background: var(--role-admin); }
.role-badge.advisor { background: var(--role-advisor); }
.role-badge.technician { background: var(--role-technician); }
.role-badge.cashier { background: var(--role-cashier); }
.role-badge.warehouse { background: var(--role-warehouse); }
.role-badge.see-also { opacity: .55; border: 1px dashed rgba(255,255,255,.3); }

/* --- Perm note --- */
.perm-note {
  background: var(--accent-light);
  border-left: 4px solid var(--accent);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: 14px 18px;
  margin: 20px 0;
  font-size: 14px;
}
.perm-note .perm-title {
  font-weight: 600; font-size: 13px; text-transform: uppercase;
  letter-spacing: .05em; color: var(--accent); margin-bottom: 4px;
}
.perm-note ul { padding-left: 1.2em; margin-top: 4px; }
.perm-note li { margin: 2px 0; }

/* --- Step --- */
.steps { list-style: none; padding: 0; counter-reset: step; margin: 24px 0; }
.step {
  position: relative; padding: 0 0 24px 48px;
  counter-increment: step;
}
.step::before {
  content: counter(step);
  position: absolute; left: 0; top: 0;
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--accent); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 600; font-size: 15px; flex-shrink: 0;
}
.step:not(:last-child)::after {
  content: ''; position: absolute; left: 15px; top: 36px; bottom: 0;
  width: 2px; background: var(--border);
}
.step h3 { font-size: 17px; font-weight: 600; margin-bottom: 6px; color: var(--text); }
.step p { margin-bottom: 8px; }
.step .step-content > :last-child { margin-bottom: 0; }

/* --- Shot (screenshot placeholder) --- */
.shot {
  margin: 16px 0; border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden;
  background: var(--bg-card); box-shadow: var(--shadow);
}
.shot .shot-bar {
  background: #e4e7e4; padding: 8px 12px;
  display: flex; align-items: center; gap: 6px;
  border-bottom: 1px solid var(--border);
}
:root[data-theme="dark"] .shot .shot-bar { background: #2a3a32; }
.shot .shot-bar .dot {
  width: 11px; height: 11px; border-radius: 50%;
}
.shot .shot-bar .dot.r { background: #ff5f57; }
.shot .shot-bar .dot.y { background: #febc2e; }
.shot .shot-bar .dot.g { background: #28c840; }
.shot .shot-bar .shot-url {
  margin-left: 8px; font-size: 12px; color: var(--text-muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.shot .shot-body {
  padding: 0; min-height: 80px; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #f0f2ee 25%, #e8ece6 100%);
}
:root[data-theme="dark"] .shot .shot-body {
  background: linear-gradient(135deg, #1a2b22 25%, #152019 100%);
}
.shot .shot-placeholder {
  padding: 28px; text-align: center; color: var(--text-muted); font-size: 13px;
}
.shot .shot-placeholder .ph-icon { font-size: 28px; margin-bottom: 6px; opacity: .4; }
.shot .shot-label {
  padding: 6px 12px; font-size: 12px; color: var(--text-muted);
  border-top: 1px solid var(--border); background: var(--bg-card);
}

/* --- Callout --- */
.callout {
  border-radius: var(--radius-sm); padding: 14px 18px;
  margin: 16px 0; font-size: 14px; border: 1px solid;
  display: flex; gap: 10px;
}
.callout .co-icon { font-size: 18px; flex-shrink: 0; }
.callout .co-body > :last-child { margin-bottom: 0; }
.callout.tip { background: #ecfdf5; border-color: #a7f3d0; color: #065f46; }
.callout.note { background: #fffbeb; border-color: #fde68a; color: #92400e; }
.callout.warn { background: #fef2f2; border-color: #fecaca; color: #991b1b; }
:root[data-theme="dark"] .callout.tip { background: #0a2419; border-color: #1a3a2a; color: #6ee7b7; }
:root[data-theme="dark"] .callout.note { background: #2a1e0a; border-color: #3a2e1a; color: #fcd34d; }
:root[data-theme="dark"] .callout.warn { background: #2a0a0a; border-color: #3a1a1a; color: #fca5a5; }

/* --- Pager --- */
.pager {
  display: flex; justify-content: space-between; gap: 16px;
  margin-top: 40px; padding-top: 20px; border-top: 1px solid var(--border);
}
.pager a {
  display: flex; flex-direction: column; gap: 2px;
  padding: 10px 16px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--bg-card);
  transition: border-color .15s;
}
.pager a:hover { border-color: var(--accent); text-decoration: none; }
.pager .pager-label { font-size: 12px; color: var(--text-muted); }
.pager .pager-title { font-size: 14px; font-weight: 500; color: var(--text); }
.pager .pager-next { text-align: right; }

/* --- Article content (Markdown rendered) --- */
.article-body { margin-top: 8px; }
.article-body h2 { font-size: 22px; font-weight: 600; margin: 28px 0 12px; color: var(--text); }
.article-body h3 { font-size: 18px; font-weight: 600; margin: 22px 0 10px; color: var(--text); }
.article-body p { margin-bottom: 14px; }
.article-body ul, .article-body ol { margin-bottom: 14px; }
.article-body li { margin-bottom: 6px; }
.article-body code {
  background: var(--accent-light); padding: 2px 6px;
  border-radius: 4px; font-size: 14px; color: var(--accent);
}
.article-body pre {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 14px 16px;
  overflow-x: auto; margin-bottom: 14px; font-size: 14px;
}
.article-body pre code { background: none; padding: 0; }
.article-body blockquote {
  border-left: 3px solid var(--border); padding-left: 16px;
  color: var(--text-muted); margin: 14px 0;
}
.article-body table { width: 100%; border-collapse: collapse; margin-bottom: 14px; }
.article-body th, .article-body td {
  border: 1px solid var(--border); padding: 8px 12px; font-size: 14px;
}
.article-body th { background: var(--accent-light); font-weight: 600; }

/* --- Homepage: Role switcher --- */
.home-hero { text-align: center; padding: 40px 0 20px; }
.home-hero h1 { font-size: 32px; font-weight: 700; margin-bottom: 10px; }
.home-hero p { color: var(--text-muted); font-size: 16px; max-width: 480px; margin: 0 auto 28px; }
.role-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; margin-bottom: 32px; }
.role-card {
  display: block; padding: 24px 20px; border-radius: var(--radius);
  background: var(--bg-card); border: 1px solid var(--border);
  text-align: center; cursor: pointer; transition: transform .15s, border-color .15s, box-shadow .15s;
  text-decoration: none; color: var(--text);
}
.role-card:hover { transform: translateY(-3px); border-color: var(--accent); box-shadow: var(--shadow-lg); text-decoration: none; }
.role-card .rc-icon {
  width: 52px; height: 52px; border-radius: 14px; margin: 0 auto 12px;
  display: flex; align-items: center; justify-content: center;
}
.role-card.admin .rc-icon { background: color-mix(in srgb, var(--role-admin) 12%, transparent); color: var(--role-admin); }
.role-card.advisor .rc-icon { background: color-mix(in srgb, var(--role-advisor) 12%, transparent); color: var(--role-advisor); }
.role-card.technician .rc-icon { background: color-mix(in srgb, var(--role-technician) 12%, transparent); color: var(--role-technician); }
.role-card.cashier .rc-icon { background: color-mix(in srgb, var(--role-cashier) 14%, transparent); color: var(--role-cashier); }
.role-card.warehouse .rc-icon { background: color-mix(in srgb, var(--role-warehouse) 12%, transparent); color: var(--role-warehouse); }
.role-card .rc-title { font-size: 16px; font-weight: 600; margin-bottom: 4px; }
.role-card .rc-desc { font-size: 13px; color: var(--text-muted); }
.role-card .rc-current {
  display: inline-block; margin-top: 8px; font-size: 11px;
  padding: 2px 8px; border-radius: 20px; background: var(--accent); color: #fff;
}

/* --- Role path page --- */
.path-header { margin-bottom: 24px; }
.path-header h1 { font-size: 26px; font-weight: 700; margin-bottom: 6px; }
.path-header p { color: var(--text-muted); font-size: 15px; }
.path-section { margin-bottom: 28px; }
.path-section h2 {
  font-size: 18px; font-weight: 600; margin-bottom: 12px;
  display: flex; align-items: center; gap: 8px;
}
.path-section .ps-icon { font-size: 20px; }
.path-list { list-style: none; padding: 0; }
.path-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  margin-bottom: 8px; background: var(--bg-card);
  transition: border-color .15s;
}
.path-item:hover { border-color: var(--accent); }
.path-item a { flex: 1; color: var(--text); font-weight: 500; }
.path-item a:hover { text-decoration: none; color: var(--accent); }
.path-item .pi-id { font-size: 12px; font-weight: 600; color: var(--accent); min-width: 36px; }
.path-item .pi-missing { color: var(--text-muted); font-size: 13px; font-style: italic; }
.path-item .read-check {
  width: 22px; height: 22px; border-radius: 50%;
  border: 2px solid var(--border); cursor: pointer; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: transparent; color: transparent; font-size: 12px;
  transition: all .15s;
}
.path-item .read-check.read { background: var(--accent); border-color: var(--accent); color: #fff; }
.path-item .read-check:hover { border-color: var(--accent); }
.path-progress {
  font-size: 13px; color: var(--text-muted); margin-bottom: 16px;
}
.path-progress .pp-bar {
  height: 6px; background: var(--border); border-radius: 3px;
  overflow: hidden; margin-top: 6px;
}
.path-progress .pp-fill { height: 100%; background: var(--accent); border-radius: 3px; transition: width .3s; }

/* --- Search --- */
.search-wrap { position: relative; margin: 0 0 10px; }
.search-input {
  width: 100%; height: 38px; padding: 0 36px 0 36px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--bg-card);
  color: var(--text); font-family: var(--font); font-size: 14px;
}
.search-input::placeholder { color: var(--text-muted); }
.search-input:focus { outline: 2px solid color-mix(in srgb, var(--accent) 40%, transparent); outline-offset: 1px; }
.search-icon {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  color: var(--text-muted); pointer-events: none; display: inline-flex;
}
.search-kbd {
  position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
  min-width: 20px; padding: 1px 6px; border: 1px solid var(--border); border-radius: 5px;
  background: var(--bg); color: var(--text-muted);
  font-family: var(--font); font-size: 11px; line-height: 1.5; text-align: center; pointer-events: none;
}
.search-results {
  position: absolute; top: calc(100% + 4px); left: 0; right: 0;
  max-height: 400px; overflow-y: auto;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-sm); box-shadow: var(--shadow-lg);
  z-index: 200; display: none;
}
.search-results.show { display: block; }
.search-result {
  display: block; padding: 10px 14px; border-bottom: 1px solid var(--border-light);
  color: var(--text); font-size: 13px; transition: background .1s;
}
.search-result:hover { background: var(--accent-light); text-decoration: none; }
.search-result .sr-title { font-weight: 500; margin-bottom: 2px; }
.search-result .sr-meta { font-size: 11px; color: var(--text-muted); display: flex; gap: 8px; }
.search-result .sr-snippet { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.search-result mark { background: #fde68a; color: inherit; border-radius: 2px; padding: 0 2px; }
.search-empty { padding: 14px; text-align: center; color: var(--text-muted); font-size: 13px; }

/* --- Responsive --- */
@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .content { margin-left: 0; }
  .menu-toggle { display: block; }
  .overlay.show { display: block; }
  .role-cards { grid-template-columns: 1fr 1fr; }
  .content-inner { padding: 40px 16px 60px; }
}
@media (max-width: 500px) {
  .role-cards { grid-template-columns: 1fr; }
  .home-hero h1 { font-size: 24px; }
}

/* --- Lightbox (click to zoom screenshot) --- */
.shot-body img {
  /* Không phóng to quá kích thước thật của ảnh (ảnh cắt nhỏ như nút bấm sẽ vỡ hạt nếu kéo giãn full chiều rộng). */
  width: auto; max-width: 100%; height: auto; display: block; margin: 0 auto; cursor: zoom-in;
}
.shot-body img.wide {
  width: 100%; margin: 0;
  border-radius: 0 0 0 0;
}
.shot-lightbox {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,.85); z-index: 9999;
  justify-content: center; align-items: center; cursor: zoom-out;
}
.shot-lightbox.open { display: flex; }
.shot-lightbox img { max-width: 92%; max-height: 92%; border-radius: 8px; box-shadow: 0 8px 40px rgba(0,0,0,.4); }
