/* ══════════════════════════════════════
   Smart Glossary Widget — Core Styles
   ══════════════════════════════════════ */
:root{--sgw-primary:#6366f1;--sgw-primary-light:#818cf8;--sgw-primary-bg:#eef2ff;--sgw-text:#1e293b;--sgw-text-muted:#64748b;--sgw-bg:#ffffff;--sgw-border:#e2e8f0;--sgw-radius:12px;--sgw-shadow:0 1px 3px rgba(0,0,0,.06),0 1px 2px rgba(0,0,0,.04);--sgw-shadow-md:0 4px 6px -1px rgba(0,0,0,.07),0 2px 4px -2px rgba(0,0,0,.05);--sgw-shadow-lg:0 10px 25px -3px rgba(0,0,0,.08),0 4px 6px -4px rgba(0,0,0,.04);--sgw-transition:.25s cubic-bezier(.4,0,.2,1);--sgw-font:'Inter',-apple-system,BlinkMacSystemFont,'Segoe UI',sans-serif}
.sgw-wrapper{font-family:var(--sgw-font);position:relative;line-height:1.6;-webkit-font-smoothing:antialiased}
.sgw-wrapper *,.sgw-wrapper *::before,.sgw-wrapper *::after{box-sizing:border-box}

/* ── Header ── */
.sgw-header{margin-bottom:32px}
.sgw-title{font-size:clamp(1.75rem,3vw,2.5rem);font-weight:800;letter-spacing:-.025em;margin:0 0 8px;line-height:1.2;color:var(--sgw-text)}
.sgw-description{font-size:clamp(.95rem,1.5vw,1.125rem);margin:0;color:var(--sgw-text-muted);max-width:640px}
.sgw-header[style*="center"] .sgw-description{margin-inline:auto}

/* ── Search ── */
.sgw-search-wrap{margin-bottom:24px;max-width:560px}
.sgw-header[style*="center"]~.sgw-search-wrap{margin-inline:auto}
.sgw-search-inner{position:relative;display:flex;align-items:center}
.sgw-search-icon{position:absolute;left:16px;color:var(--sgw-text-muted);pointer-events:none;flex-shrink:0}
.sgw-search-input{width:100%;padding:14px 44px 14px 48px;font-size:15px;font-family:var(--sgw-font);border:1.5px solid var(--sgw-border);border-radius:var(--sgw-radius);background:#f8fafc;color:var(--sgw-text);outline:none;transition:var(--sgw-transition)}
.sgw-search-input::placeholder{color:#94a3b8}
.sgw-search-input:focus{border-color:var(--sgw-primary);box-shadow:0 0 0 3px rgba(99,102,241,.15);background:#fff}
.sgw-search-clear{position:absolute;right:12px;background:none;border:none;font-size:22px;color:#94a3b8;cursor:pointer;padding:4px 8px;line-height:1;border-radius:4px;transition:var(--sgw-transition)}
.sgw-search-clear:hover{color:var(--sgw-text);background:#f1f5f9}
.sgw-search-count{font-size:13px;color:var(--sgw-text-muted);margin-top:6px;min-height:20px}

/* ── Alphabet Bar ── */
.sgw-alpha-bar{display:flex;flex-wrap:wrap;gap:6px;margin-bottom:20px;padding:0;align-items:center}
.sgw-alpha-bar.sgw-sticky{position:sticky;top:0;z-index:50;background:#fff;padding:12px 0;border-bottom:1px solid var(--sgw-border)}
.sgw-alpha-btn{display:inline-flex;align-items:center;justify-content:center;min-width:36px;height:36px;padding:0 6px;font-size:13px;font-weight:600;font-family:var(--sgw-font);border:none;cursor:pointer;transition:var(--sgw-transition);color:var(--sgw-text-muted);background:transparent;border-radius:8px}
.sgw-alpha-btn:hover:not(.disabled){color:var(--sgw-primary);background:var(--sgw-primary-bg)}
.sgw-alpha-btn.active{background:var(--sgw-primary);color:#fff;box-shadow:0 2px 8px rgba(99,102,241,.3)}
.sgw-alpha-btn.disabled{opacity:.35;cursor:not-allowed;pointer-events:none}
/* Alpha styles */
.sgw-alpha-pills .sgw-alpha-btn{border-radius:20px}
.sgw-alpha-boxes .sgw-alpha-btn{border-radius:6px;border:1px solid var(--sgw-border)}
.sgw-alpha-boxes .sgw-alpha-btn.active{border-color:var(--sgw-primary)}
.sgw-alpha-underline .sgw-alpha-btn{border-radius:0;border-bottom:2px solid transparent}
.sgw-alpha-underline .sgw-alpha-btn.active{background:transparent;color:var(--sgw-primary);border-bottom-color:var(--sgw-primary);box-shadow:none}
.sgw-alpha-minimal .sgw-alpha-btn{min-width:28px;height:28px;font-size:12px}

/* ── Category Filter ── */
.sgw-cat-bar{display:flex;flex-wrap:wrap;gap:8px;margin-bottom:24px;align-items:center}
.sgw-cat-btn{padding:8px 18px;font-size:14px;font-weight:500;font-family:var(--sgw-font);border:none;cursor:pointer;transition:var(--sgw-transition);color:var(--sgw-text-muted);background:#f1f5f9;border-radius:8px}
.sgw-cat-btn:hover{background:#e2e8f0;color:var(--sgw-text)}
.sgw-cat-btn.active{background:var(--sgw-primary);color:#fff;box-shadow:0 2px 8px rgba(99,102,241,.25)}
.sgw-cat-tabs .sgw-cat-btn{border-radius:0;background:transparent;border-bottom:2px solid transparent;padding:10px 16px}
.sgw-cat-tabs .sgw-cat-btn.active{background:transparent;color:var(--sgw-primary);border-bottom-color:var(--sgw-primary);box-shadow:none}
.sgw-cat-pills .sgw-cat-btn{border-radius:20px}
.sgw-cat-dropdown-wrap{margin-bottom:24px}
.sgw-cat-select{padding:10px 16px;font-size:14px;font-family:var(--sgw-font);border:1.5px solid var(--sgw-border);border-radius:8px;background:#f8fafc;color:var(--sgw-text);outline:none;cursor:pointer;min-width:200px}
.sgw-cat-select:focus{border-color:var(--sgw-primary)}

/* ── Grid ── */
.sgw-grid{display:grid;grid-template-columns:repeat(3,1fr);gap:24px}

/* ── Card / Item ── */
.sgw-item{background:var(--sgw-bg);border:1px solid var(--sgw-border);border-radius:var(--sgw-radius);padding:24px;transition:var(--sgw-transition);position:relative;overflow:hidden;display:flex;flex-direction:column;text-decoration:none;color:inherit}
.sgw-item:focus-visible{outline:2px solid var(--sgw-primary);outline-offset:2px}
a.sgw-item{cursor:pointer}
/* Hover animations */
.sgw-hover-lift:hover{transform:translateY(-4px);box-shadow:var(--sgw-shadow-lg)}
.sgw-hover-scale:hover{transform:scale(1.02);box-shadow:var(--sgw-shadow-lg)}
.sgw-hover-glow:hover{box-shadow:0 0 20px rgba(99,102,241,.2),var(--sgw-shadow-md)}
/* Glassmorphism */
.sgw-glass{background:rgba(255,255,255,.7);backdrop-filter:blur(12px);-webkit-backdrop-filter:blur(12px);border:1px solid rgba(255,255,255,.3)}
/* Gradient */
.sgw-gradient{background:linear-gradient(135deg,rgba(99,102,241,.04) 0%,rgba(168,85,247,.04) 100%)}
/* Featured badge */
.sgw-featured{border-color:var(--sgw-primary-light);box-shadow:0 0 0 1px rgba(99,102,241,.1)}
.sgw-badge{font-size:11px;font-weight:600;text-transform:uppercase;letter-spacing:.04em;padding:3px 10px;border-radius:20px;background:linear-gradient(135deg,var(--sgw-primary),var(--sgw-primary-light));color:#fff;white-space:nowrap}

/* Item inner */
.sgw-item-img{margin:-24px -24px 16px;overflow:hidden;border-radius:var(--sgw-radius) var(--sgw-radius) 0 0}
.sgw-item-img img{width:100%;height:160px;object-fit:cover;display:block;transition:var(--sgw-transition)}
.sgw-item:hover .sgw-item-img img{transform:scale(1.04)}
.sgw-item-top{display:flex;align-items:center;gap:10px;margin-bottom:10px;flex-wrap:wrap}
.sgw-term-icon{display:inline-flex;align-items:center;justify-content:center;width:38px;height:38px;border-radius:10px;background:var(--sgw-primary-bg);color:var(--sgw-primary);flex-shrink:0;transition:var(--sgw-transition)}
.sgw-term-icon i,.sgw-term-icon svg{font-size:18px;width:18px;height:18px}
.sgw-item:hover .sgw-term-icon{background:var(--sgw-primary);color:#fff}
.sgw-term-title{font-size:16px;font-weight:650;margin:0;color:var(--sgw-text);transition:var(--sgw-transition);line-height:1.3;flex:1}
.sgw-term-def{font-size:14px;color:var(--sgw-text-muted);margin:0 0 12px;line-height:1.6}
.sgw-term-full{font-size:14px;color:var(--sgw-text-muted);margin-bottom:12px;line-height:1.7}
.sgw-term-full p{margin:0 0 8px}
.sgw-item-cat{font-size:12px;font-weight:500;color:var(--sgw-primary);background:var(--sgw-primary-bg);padding:3px 10px;border-radius:6px;margin-top:auto;align-self:flex-start;display:inline-block}
.sgw-tags{display:flex;flex-wrap:wrap;gap:6px;margin-bottom:12px}
.sgw-tag{font-size:11px;padding:3px 10px;border-radius:6px;background:#f1f5f9;color:var(--sgw-text-muted);font-weight:500}
.sgw-related{font-size:13px;margin-bottom:12px;display:flex;flex-wrap:wrap;gap:6px;align-items:center}
.sgw-related-label{font-weight:600;color:var(--sgw-text);margin-right:2px}
.sgw-related-term{color:var(--sgw-primary);cursor:pointer;padding:2px 8px;border-radius:4px;background:var(--sgw-primary-bg);font-weight:500;transition:var(--sgw-transition)}
.sgw-related-term:hover{background:var(--sgw-primary);color:#fff}

/* Tooltip */
.sgw-tooltip{position:absolute;bottom:100%;left:50%;transform:translateX(-50%) translateY(8px);background:#1e293b;color:#fff;padding:10px 14px;border-radius:8px;font-size:13px;max-width:280px;opacity:0;visibility:hidden;transition:var(--sgw-transition);pointer-events:none;z-index:100;box-shadow:var(--sgw-shadow-lg)}
.sgw-tooltip::after{content:'';position:absolute;top:100%;left:50%;transform:translateX(-50%);border:6px solid transparent;border-top-color:#1e293b}
.sgw-item:hover .sgw-tooltip{opacity:1;visibility:visible;transform:translateX(-50%) translateY(-4px)}

/* ── Letter Heading ── */
.sgw-letter-heading{font-size:1.5rem;font-weight:800;margin:32px 0 16px;padding-bottom:10px;border-bottom:2px solid var(--sgw-border);color:var(--sgw-primary);display:flex;align-items:center;gap:12px}
.sgw-letter-heading span{display:inline-flex;align-items:center;justify-content:center;width:44px;height:44px;background:var(--sgw-primary);color:#fff;border-radius:10px;font-size:1.25rem}
.sgw-letter-section:first-child .sgw-letter-heading{margin-top:0}

/* ── List Layout ── */
.sgw-list{list-style:none;margin:0;padding:0}
.sgw-list-item{display:flex;align-items:center;gap:16px;padding:16px 20px;border:1px solid var(--sgw-border);border-radius:var(--sgw-radius);margin-bottom:8px;background:var(--sgw-bg);transition:var(--sgw-transition);cursor:default}
.sgw-list-item:hover{box-shadow:var(--sgw-shadow-md);border-color:var(--sgw-primary-light)}
.sgw-list-item:focus-visible{outline:2px solid var(--sgw-primary);outline-offset:2px}
.sgw-list-content{flex:1;min-width:0}
.sgw-list-content .sgw-term-title{font-size:15px;margin-bottom:2px}
.sgw-list-content .sgw-term-def{font-size:13px;margin:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.sgw-two-col{columns:2;column-gap:32px}
.sgw-two-col .sgw-letter-section{break-inside:avoid}

/* ── Accordion ── */
.sgw-acc-item{border:1px solid var(--sgw-border);border-radius:10px;margin-bottom:8px;overflow:hidden;transition:var(--sgw-transition)}
.sgw-acc-item.active{border-color:var(--sgw-primary-light);box-shadow:var(--sgw-shadow-md)}
.sgw-acc-header{width:100%;display:flex;align-items:center;gap:12px;padding:16px 20px;border:none;background:#f8fafc;cursor:pointer;font-family:var(--sgw-font);transition:var(--sgw-transition);text-align:left}
.sgw-acc-header:hover{background:#f1f5f9}
.sgw-acc-header:focus-visible{outline:2px solid var(--sgw-primary);outline-offset:-2px}
.sgw-acc-header .sgw-term-title{flex:1;font-size:15px;font-weight:600}
.sgw-acc-header .sgw-item-cat{margin:0}
.sgw-acc-icon{display:flex;align-items:center;color:var(--sgw-primary);transition:transform .3s ease;flex-shrink:0}
.sgw-acc-item.active .sgw-acc-icon{transform:rotate(180deg)}
.sgw-acc-item.active .sgw-acc-icon .sgw-plus-h{opacity:0}
.sgw-acc-body{max-height:0;overflow:hidden;transition:max-height .35s cubic-bezier(.4,0,.2,1)}
.sgw-acc-inner{padding:0 20px 20px;border-top:1px solid var(--sgw-border)}
.sgw-acc-inner .sgw-term-def{margin-top:14px}

/* ── Sidebar Layout ── */
.sgw-has-sidebar{display:grid;grid-template-columns:200px 1fr;gap:40px;align-items:start}
.sgw-sidebar{position:relative}
.sgw-sidebar-sticky{position:sticky;top:20px}
.sgw-sidebar-nav{display:flex;flex-direction:column;gap:4px;padding:16px;background:#f8fafc;border-radius:var(--sgw-radius);border:1px solid var(--sgw-border)}
.sgw-sidebar-link{display:flex;align-items:center;justify-content:center;width:40px;height:40px;border-radius:8px;font-weight:700;font-size:15px;color:var(--sgw-text-muted);text-decoration:none;transition:var(--sgw-transition)}
.sgw-sidebar-link:hover,.sgw-sidebar-link.active{background:var(--sgw-primary);color:#fff}

/* ── No Results ── */
.sgw-no-results{text-align:center;padding:60px 20px;color:var(--sgw-text-muted)}
.sgw-no-results svg{margin-bottom:12px;opacity:.5}
.sgw-no-results p{font-size:15px;margin:0}

/* ── Pagination ── */
.sgw-pagination{display:flex;justify-content:center;gap:6px;margin-top:32px;flex-wrap:wrap}
.sgw-page-btn{min-width:40px;height:40px;display:inline-flex;align-items:center;justify-content:center;border:1px solid var(--sgw-border);border-radius:8px;background:var(--sgw-bg);color:var(--sgw-text);font-size:14px;font-weight:500;cursor:pointer;transition:var(--sgw-transition);font-family:var(--sgw-font)}
.sgw-page-btn:hover{border-color:var(--sgw-primary);color:var(--sgw-primary)}
.sgw-page-btn.active{background:var(--sgw-primary);color:#fff;border-color:var(--sgw-primary)}

/* ── Back to Top ── */
.sgw-back-top{position:fixed;bottom:30px;right:30px;width:46px;height:46px;border-radius:50%;background:var(--sgw-primary);color:#fff;border:none;cursor:pointer;display:flex;align-items:center;justify-content:center;box-shadow:0 4px 14px rgba(99,102,241,.35);transition:var(--sgw-transition);z-index:999;opacity:0;transform:translateY(10px)}
.sgw-back-top.visible{display:flex!important;opacity:1;transform:translateY(0)}
.sgw-back-top:hover{transform:translateY(-3px);box-shadow:0 6px 20px rgba(99,102,241,.45)}

/* ── Highlight ── */
mark.sgw-highlight{background:linear-gradient(120deg,rgba(99,102,241,.15) 0%,rgba(99,102,241,.25) 100%);color:inherit;padding:1px 3px;border-radius:3px}

/* ── Fade-in Animation ── */
.sgw-animate{opacity:0;transform:translateY(16px);transition:opacity .5s ease,transform .5s ease;transition-delay:var(--sgw-delay,0s)}
.sgw-animate.sgw-visible{opacity:1;transform:translateY(0)}

/* ── Layout: Healthcare ── */
.sgw-layout-healthcare .sgw-item{border-left:3px solid var(--sgw-primary)}
.sgw-layout-healthcare .sgw-term-icon{border-radius:50%}

/* ── Layout: Docs ── */
.sgw-layout-docs .sgw-item{border-radius:8px;border-left:3px solid var(--sgw-primary);padding:20px 24px}

/* ── Layout: KB ── */
.sgw-layout-kb .sgw-item-top{margin-bottom:14px}

/* ═══ Responsive ═══ */
@media(max-width:1024px){
    .sgw-grid{grid-template-columns:repeat(2,1fr)}
    .sgw-has-sidebar{grid-template-columns:1fr}
    .sgw-sidebar{display:none}
    .sgw-two-col{columns:1}
}
@media(max-width:767px){
    .sgw-grid{grid-template-columns:1fr}
    .sgw-alpha-bar{gap:4px;justify-content:center}
    .sgw-alpha-btn{min-width:30px;height:30px;font-size:12px}
    .sgw-cat-bar{overflow-x:auto;flex-wrap:nowrap;-webkit-overflow-scrolling:touch;padding-bottom:4px}
    .sgw-cat-btn{white-space:nowrap;flex-shrink:0}
    .sgw-item{padding:18px}
    .sgw-list-item{flex-wrap:wrap}
    .sgw-list-content .sgw-term-def{white-space:normal}
    .sgw-back-top{bottom:20px;right:20px;width:40px;height:40px}
    .sgw-letter-heading{font-size:1.25rem}
    .sgw-letter-heading span{width:36px;height:36px;font-size:1rem}
    .sgw-title{margin-bottom:6px}
    .sgw-search-input{padding:12px 40px 12px 42px;font-size:14px}
}
