/* WDG Knowledge Base — Frontend CSS v2.0 */
@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&family=Lora:ital,wght@0,400;0,600;1,400&display=swap');

:root {
  --wdg-primary:   #0e2a47;
  --wdg-accent:    #e8372b;
  --wdg-blue:      #1565c0;
  --wdg-light:     #f5f7fa;
  --wdg-white:     #ffffff;
  --wdg-border:    #e2e8f0;
  --wdg-text:      #1a2333;
  --wdg-muted:     #5a6a7e;
  --wdg-success:   #1b8a5a;
  --wdg-radius:    12px;
  --wdg-font:      'Plus Jakarta Sans', system-ui, sans-serif;
  --wdg-serif:     'Lora', Georgia, serif;
}

/* ==============================
   BASE WRAP
   ============================== */
.wdg-kb-wrap * { box-sizing: border-box; }
.wdg-kb-wrap {
  font-family: var(--wdg-font);
  color: var(--wdg-text);
  line-height: 1.6;
  margin: 0 auto;
}
.wdg-kb-wrap a { text-decoration: none; }
.wdg-kb-wrap h1, .wdg-kb-wrap h2, .wdg-kb-wrap h3 { line-height: 1.3; }

/* ==============================
   DARK BANNER WITH GEOMETRIC SHAPES
   ============================== */
.wdg-banner {
  position: relative;
  background: var(--wdg-primary);
  overflow: hidden;
  padding: 64px 24px 80px;
  /* Subtle noise grain effect */
  isolation: isolate;
}
.wdg-banner::before {
  content: '';
  position: absolute; inset: 0;
  background: radial-gradient(ellipse 80% 60% at 50% -10%, rgba(21,101,192,0.45) 0%, transparent 70%),
              radial-gradient(ellipse 50% 50% at 80% 90%, rgba(232,55,43,0.18) 0%, transparent 60%);
  z-index: 0;
}
/* Bottom wave cut */
.wdg-banner::after {
  content: '';
  position: absolute; bottom: -2px; left: 0; right: 0;
  height: 60px;
  background: var(--wdg-light);
  clip-path: ellipse(55% 100% at 50% 100%);
  z-index: 2;
}

/* Geometric shape decorations */
.wdg-banner-shapes { position: absolute; inset: 0; z-index: 1; pointer-events: none; overflow: hidden; }
.wdg-shape { position: absolute; opacity: 0.06; }
.wdg-shape-1 {
  width: 420px; height: 420px; top: -140px; right: -80px;
  fill: #ffffff; transform: rotate(15deg);
}
.wdg-shape-2 {
  width: 220px; height: 220px; bottom: -60px; left: -60px;
  fill: var(--wdg-accent); opacity: 0.12;
}
.wdg-shape-3 {
  width: 160px; height: 160px; top: 20px; left: 8%;
  fill: rgba(255,255,255,0.5); opacity: 0.07; transform: rotate(-20deg);
}
.wdg-shape-4 {
  width: 260px; height: 260px; bottom: 30px; right: 12%;
  fill: #ffffff; opacity: 0.05; transform: rotate(8deg);
}
.wdg-shape-5 {
  width: 90px; height: 90px; top: 50px; right: 20%;
  fill: var(--wdg-accent); opacity: 0.15;
}

/* Banner content */
.wdg-banner-content {
  position: relative; z-index: 3;
  max-width: 680px; margin: 0 auto; text-align: center;
}
.wdg-banner-icon {
  font-size: 44px; margin-bottom: 14px; display: block;
  animation: float 4s ease-in-out infinite;
}
@keyframes float { 0%,100%{transform:translateY(0)} 50%{transform:translateY(-8px)} }

.wdg-banner-title {
  font-size: clamp(26px, 4vw, 40px);
  font-weight: 800;
  color: #ffffff;
  margin: 0 0 10px;
  letter-spacing: -0.5px;
}
.wdg-banner-sub {
  font-size: 16px; color: rgba(255,255,255,0.7);
  margin: 0 0 30px;
}

/* Search box */
.wdg-search-wrap { position: relative; max-width: 540px; margin: 0 auto 22px; }
.wdg-search-box {
  position: relative;
  background: rgba(255,255,255,0.96);
  border-radius: 50px;
  display: flex; align-items: center;
  box-shadow: 0 8px 40px rgba(0,0,0,0.22);
  overflow: hidden;
  transition: box-shadow 0.2s;
}
.wdg-search-box:focus-within { box-shadow: 0 8px 40px rgba(0,0,0,0.3), 0 0 0 3px rgba(21,101,192,0.3); }
.wdg-search-icon { padding: 0 14px 0 18px; font-size: 18px; color: var(--wdg-muted); flex-shrink: 0; }
.wdg-search-input {
  flex: 1; border: none; outline: none;
  font-size: 15px; font-family: var(--wdg-font);
  padding: 16px 0; color: var(--wdg-text);
  background: transparent;
}
.wdg-search-input::placeholder { color: #94a3b8; }
.wdg-search-clear {
  background: none; border: none; cursor: pointer; padding: 0 18px;
  font-size: 16px; color: var(--wdg-muted); flex-shrink: 0;
}

/* Live search dropdown */
.wdg-search-results {
  position: absolute; top: calc(100% + 8px); left: 0; right: 0;
  background: #fff; border-radius: var(--wdg-radius);
  box-shadow: 0 10px 50px rgba(0,0,0,0.18);
  border: 1px solid var(--wdg-border); z-index: 100;
  overflow: hidden;
  animation: dropIn 0.18s ease;
}
@keyframes dropIn { from{opacity:0;transform:translateY(-8px)} to{opacity:1;transform:none} }
.wdg-sr-item {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 13px 16px; cursor: pointer; transition: background 0.12s;
  text-align: left; border: none; width: 100%; background: none;
  font-family: var(--wdg-font);
}
.wdg-sr-item:hover { background: #f0f7ff; }
.wdg-sr-item + .wdg-sr-item { border-top: 1px solid #f1f5f9; }
.wdg-sr-cat {
  font-size: 10px; font-weight: 700; letter-spacing: 0.5px; text-transform: uppercase;
  padding: 2px 8px; border-radius: 20px; flex-shrink: 0; margin-top: 2px;
}
.wdg-sr-title { font-size: 14px; font-weight: 600; color: var(--wdg-text); margin-bottom: 2px; }
.wdg-sr-excerpt { font-size: 12px; color: var(--wdg-muted); }
.wdg-sr-time { font-size: 11px; color: var(--wdg-muted); margin-top: 2px; }
.wdg-sr-empty { padding: 18px 16px; font-size: 13px; color: var(--wdg-muted); text-align: center; }

/* Banner stats */
.wdg-banner-stats {
  display: flex; justify-content: center; gap: 20px; flex-wrap: wrap;
}
.wdg-banner-stats span {
  font-size: 13px; color: rgba(255,255,255,0.6); font-weight: 500;
}

/* ==============================
   BODY
   ============================== */
.wdg-kb-body {
  background: var(--wdg-light);
  padding: 0 16px 60px;
}

/* ==============================
   SECTION
   ============================== */
.wdg-section { max-width: 1100px; margin: 0 auto 40px; padding-top: 40px; }
.wdg-section-header {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-bottom: 20px; flex-wrap: wrap;
}
.wdg-section-title {
  font-size: 20px; font-weight: 700; color: var(--wdg-primary);
  display: flex; align-items: center; gap: 10px; margin: 0;
}
.wdg-title-icon { font-size: 22px; }
.wdg-sort-bar {
  display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--wdg-muted);
}
.wdg-sort-bar select {
  padding: 6px 12px; border: 1px solid var(--wdg-border); border-radius: 8px;
  font-size: 13px; font-family: var(--wdg-font); outline: none; cursor: pointer;
  background: #fff; color: var(--wdg-text);
}

/* ==============================
   FEATURED GRID
   ============================== */
.wdg-featured-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 14px;
}
.wdg-featured-card {
  position: relative;
  background: var(--wdg-white); border: 1px solid var(--wdg-border);
  border-radius: var(--wdg-radius); padding: 20px;
  cursor: pointer; transition: transform 0.18s, box-shadow 0.18s;
  display: block;
  border-top: 3px solid var(--cat-color, var(--wdg-blue));
  overflow: hidden;
}
.wdg-featured-card::before {
  content: ''; position: absolute; inset: 0;
  background: var(--cat-color, var(--wdg-blue));
  opacity: 0; transition: opacity 0.2s;
}
.wdg-featured-card:hover { transform: translateY(-3px); box-shadow: 0 8px 30px rgba(0,0,0,0.1); }
.wdg-featured-card:hover::before { opacity: 0.03; }
.wdg-fc-cat { font-size: 11px; font-weight: 700; color: var(--cat-color); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 8px; }
.wdg-fc-title { font-size: 15px; font-weight: 700; color: var(--wdg-text); margin-bottom: 8px; line-height: 1.4; }
.wdg-fc-meta { font-size: 12px; color: var(--wdg-muted); }

/* ==============================
   CATEGORY GRID
   ============================== */
.wdg-cat-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px;
}
.wdg-cat-card {
  background: var(--wdg-white); border: 1.5px solid var(--wdg-border);
  border-radius: var(--wdg-radius); padding: 20px 16px;
  cursor: pointer; transition: 0.18s;
  display: flex; flex-direction: column; align-items: center; text-align: center;
  gap: 8px; font-family: var(--wdg-font);
}
.wdg-cat-card:hover {
  border-color: var(--cat-color, var(--wdg-blue));
  box-shadow: 0 4px 24px rgba(0,0,0,0.09);
  transform: translateY(-2px);
  background: linear-gradient(135deg, #fff 0%, color-mix(in srgb, var(--cat-color, var(--wdg-blue)) 5%, white) 100%);
}
.wdg-cat-card.active {
  background: color-mix(in srgb, var(--cat-color, var(--wdg-blue)) 10%, white);
  border-color: var(--cat-color, var(--wdg-blue));
}
.wdg-cat-icon { font-size: 32px; line-height: 1; }
.wdg-cat-name { font-size: 13px; font-weight: 700; color: var(--wdg-text); }
.wdg-cat-count { font-size: 11px; color: var(--wdg-muted); }

/* ==============================
   ARTICLES GRID
   ============================== */
.wdg-articles-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}
.wdg-art-card {
  background: var(--wdg-white); border: 1px solid var(--wdg-border);
  border-radius: var(--wdg-radius); padding: 20px;
  display: flex; flex-direction: column; gap: 10px;
  transition: 0.18s; cursor: pointer;
  position: relative; overflow: hidden;
}
.wdg-art-card::after {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0;
  width: 3px; background: var(--cat-color, var(--wdg-blue));
  transform: scaleY(0); transition: transform 0.2s; transform-origin: bottom;
}
.wdg-art-card:hover { transform: translateY(-2px); box-shadow: 0 6px 28px rgba(0,0,0,0.09); border-color: #c7d6e8; }
.wdg-art-card:hover::after { transform: scaleY(1); }
.wdg-art-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.wdg-art-cat {
  font-size: 11px; font-weight: 700; padding: 3px 10px;
  border-radius: 20px; letter-spacing: 0.3px;
}
.wdg-pin-badge { font-size: 10px; color: #b45309; background: #fef9c3; padding: 2px 7px; border-radius: 4px; font-weight: 600; }
.wdg-art-title { font-size: 15px; font-weight: 700; color: var(--wdg-text); line-height: 1.4; flex: 1; }
.wdg-art-excerpt { font-size: 13px; color: var(--wdg-muted); line-height: 1.6; flex: 1; }
.wdg-art-foot { display: flex; align-items: center; gap: 12px; font-size: 12px; color: var(--wdg-muted); margin-top: auto; }
.wdg-art-arrow { margin-left: auto; font-size: 16px; color: var(--cat-color, var(--wdg-blue)); opacity: 0; transition: opacity 0.18s, transform 0.18s; }
.wdg-art-card:hover .wdg-art-arrow { opacity: 1; transform: translateX(4px); }

/* Load more */
.wdg-load-more-wrap { text-align: center; margin-top: 24px; }
.wdg-load-more {
  padding: 12px 32px; border: 2px solid var(--wdg-blue); border-radius: 50px;
  background: none; font-family: var(--wdg-font); font-size: 14px; font-weight: 700;
  color: var(--wdg-blue); cursor: pointer; transition: 0.18s;
}
.wdg-load-more:hover { background: var(--wdg-blue); color: #fff; }
.wdg-load-more:disabled { opacity: 0.5; cursor: default; }

/* Empty state */
.wdg-empty { padding: 40px; text-align: center; color: var(--wdg-muted); font-size: 15px; }

/* ==============================
   SINGLE ARTICLE VIEW
   ============================== */
.wdg-article-view { background: var(--wdg-light); }
.wdg-article { max-width: 1100px; margin: 0 auto; padding: 40px 16px 60px; }

/* Breadcrumb */
.wdg-breadcrumb {
  display: flex; align-items: center; gap: 8px; font-size: 13px;
  color: var(--wdg-muted); margin-bottom: 28px; flex-wrap: wrap;
}
.wdg-back-home, .wdg-bc-cat { cursor: pointer; color: var(--wdg-blue); font-weight: 600; }
.wdg-back-home:hover, .wdg-bc-cat:hover { text-decoration: underline; }

/* Article layout with TOC */
.wdg-article-inner { display: flex; gap: 32px; align-items: flex-start; }
.wdg-toc-aside {
  width: 240px; flex-shrink: 0; position: sticky; top: 40px;
}
.wdg-toc {
  background: #fff; border: 1px solid var(--wdg-border); border-radius: var(--wdg-radius);
  padding: 18px; font-size: 13px;
}
.wdg-toc strong { display: block; font-size: 12px; text-transform: uppercase; letter-spacing: 0.5px; color: var(--wdg-muted); margin-bottom: 10px; }
.wdg-toc ol { padding-left: 16px; display: flex; flex-direction: column; gap: 5px; }
.wdg-toc li { color: var(--wdg-muted); }
.wdg-toc a { color: var(--wdg-blue); font-size: 13px; }
.wdg-toc a:hover { text-decoration: underline; }
.toc-h3 { padding-left: 10px; font-size: 12px; }

.wdg-article-body { flex: 1; min-width: 0; }

/* Article header */
.wdg-art-header {
  background: #fff; border: 1px solid var(--wdg-border); border-radius: var(--wdg-radius);
  padding: 28px 32px; margin-bottom: 20px;
}
.wdg-art-header-top { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.wdg-art-label {
  font-size: 11px; font-weight: 700; padding: 4px 12px; border-radius: 20px; letter-spacing: 0.4px;
}
.wdg-badge-feat { font-size: 11px; background: #fef3c7; color: #854d0e; padding: 3px 10px; border-radius: 20px; font-weight: 700; }
.wdg-art-h1 { font-size: clamp(20px, 3vw, 28px); font-weight: 800; color: var(--wdg-primary); margin: 0 0 12px; letter-spacing: -0.3px; }
.wdg-art-meta { display: flex; gap: 16px; font-size: 12px; color: var(--wdg-muted); flex-wrap: wrap; margin-bottom: 12px; }
.wdg-art-excerpt-hero { font-size: 15px; color: var(--wdg-muted); font-style: italic; border-left: 3px solid var(--wdg-accent); padding-left: 14px; margin: 0; }

/* Article content */
.wdg-art-content {
  background: #fff; border: 1px solid var(--wdg-border); border-radius: var(--wdg-radius);
  padding: 32px; font-size: 15.5px; line-height: 1.8; color: #2a3540;
}
.wdg-art-content h2 { font-size: 20px; font-weight: 700; color: var(--wdg-primary); margin: 28px 0 12px; padding-top: 8px; border-top: 1px solid var(--wdg-border); }
.wdg-art-content h3 { font-size: 17px; font-weight: 700; color: var(--wdg-primary); margin: 20px 0 10px; }
.wdg-art-content p { margin: 0 0 16px; }
.wdg-art-content ul, .wdg-art-content ol { margin: 10px 0 16px 24px; }
.wdg-art-content li { margin-bottom: 7px; }
.wdg-art-content code { background: #f0f4ff; padding: 2px 8px; border-radius: 5px; font-family: 'Courier New', monospace; font-size: 13.5px; color: #1e3a8a; }
.wdg-art-content pre { background: #1e293b; color: #e2e8f0; padding: 20px; border-radius: 10px; overflow-x: auto; font-size: 13px; line-height: 1.65; margin: 20px 0; }
.wdg-art-content pre code { background: none; color: inherit; padding: 0; }
.wdg-art-content blockquote { border-left: 4px solid var(--wdg-accent); padding: 12px 18px; background: #fff7f7; margin: 18px 0; border-radius: 0 8px 8px 0; font-style: italic; color: #374151; }
.wdg-art-content strong { font-weight: 700; color: var(--wdg-primary); }
.wdg-art-content img { max-width: 100%; border-radius: 8px; margin: 12px 0; }
.wdg-art-content table { width: 100%; border-collapse: collapse; margin: 16px 0; font-size: 14px; }
.wdg-art-content th { background: var(--wdg-primary); color: #fff; padding: 10px 14px; text-align: left; }
.wdg-art-content td { padding: 9px 14px; border-bottom: 1px solid var(--wdg-border); }
.wdg-art-content tr:hover td { background: #f8faff; }
.wdg-art-content a { color: var(--wdg-blue); font-weight: 600; }
.wdg-art-content a:hover { text-decoration: underline; }

/* Tags */
.wdg-art-tags {
  background: #fff; border: 1px solid var(--wdg-border); border-radius: var(--wdg-radius);
  padding: 16px 20px; margin-top: 16px;
  display: flex; gap: 8px; flex-wrap: wrap; align-items: center; font-size: 13px;
}
.wdg-tag {
  background: #f0f5ff; color: var(--wdg-blue); padding: 4px 12px;
  border-radius: 20px; font-size: 12px; font-weight: 600;
}

/* Vote box */
.wdg-vote-box {
  background: #fff; border: 1px solid var(--wdg-border); border-radius: var(--wdg-radius);
  padding: 22px; margin-top: 16px; text-align: center;
}
.wdg-vote-box p { font-size: 15px; font-weight: 600; color: var(--wdg-text); margin-bottom: 14px; }
.wdg-vote-yes, .wdg-vote-no {
  padding: 10px 24px; border: 2px solid var(--wdg-border); border-radius: 8px;
  background: none; font-family: var(--wdg-font); font-size: 14px; font-weight: 700;
  cursor: pointer; transition: 0.15s; margin: 0 6px;
}
.wdg-vote-yes:hover { background: #f0fdf4; border-color: #22c55e; color: #166534; }
.wdg-vote-no:hover  { background: #fff5f5; border-color: #ef4444; color: #991b1b; }
.wdg-vote-thanks { font-size: 14px; color: var(--wdg-success); font-weight: 600; }

/* Related articles */
.wdg-related { max-width: 1100px; margin: 24px auto 0; }
.wdg-related-title { font-size: 17px; font-weight: 700; color: var(--wdg-primary); margin-bottom: 14px; }
.wdg-related-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px;
}
.wdg-related-card {
  background: #fff; border: 1px solid var(--wdg-border); border-radius: var(--wdg-radius);
  padding: 14px 16px; display: flex; align-items: center; gap: 12px;
  transition: 0.15s;
}
.wdg-related-card:hover { border-color: var(--wdg-blue); box-shadow: 0 3px 14px rgba(0,0,0,0.07); }
.wdg-related-icon { width: 40px; height: 40px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 20px; flex-shrink: 0; }
.wdg-related-t { font-size: 13px; font-weight: 700; color: var(--wdg-text); margin-bottom: 3px; line-height: 1.4; }
.wdg-related-m { font-size: 11px; color: var(--wdg-muted); }

/* ==============================
   LOADING STATE
   ============================== */
.wdg-loading {
  display: flex; justify-content: center; padding: 48px;
}
.wdg-spinner {
  width: 38px; height: 38px;
  border: 3px solid rgba(21,101,192,0.15);
  border-top-color: var(--wdg-blue);
  border-radius: 50%;
  animation: wdgSpin 0.65s linear infinite;
}
@keyframes wdgSpin { to { transform: rotate(360deg); } }

/* ==============================
   TOAST NOTIFICATIONS
   ============================== */
.wdg-toast-wrap {
  position: fixed; bottom: 24px; right: 24px; z-index: 99999;
  display: flex; flex-direction: column; gap: 8px;
}
.wdg-toast {
  background: var(--wdg-primary); color: #fff;
  padding: 12px 20px; border-radius: 10px; font-family: var(--wdg-font);
  font-size: 14px; font-weight: 600; min-width: 220px;
  box-shadow: 0 6px 24px rgba(0,0,0,0.18);
  animation: wdgSlideIn 0.25s ease, wdgFadeOut 0.4s ease 2.6s forwards;
}
.wdg-toast.success { background: var(--wdg-success); }
.wdg-toast.error   { background: var(--wdg-accent); }
@keyframes wdgSlideIn  { from{opacity:0;transform:translateX(24px)} to{opacity:1;transform:none} }
@keyframes wdgFadeOut  { to{opacity:0;transform:translateX(24px)} }

/* ==============================
   RESPONSIVE
   ============================== */
@media (max-width: 900px) {
  .wdg-article-inner { flex-direction: column; }
  .wdg-toc-aside { width: 100%; position: static; }
}
@media (max-width: 640px) {
  .wdg-banner { padding: 44px 16px 64px; }
  .wdg-banner-title { font-size: 24px; }
  .wdg-cat-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
  .wdg-articles-grid { grid-template-columns: 1fr; }
  .wdg-art-header { padding: 18px; }
  .wdg-art-content { padding: 18px; }
}
