/* ==========================================================================
   EnerBlue v3 add-ons — part B: documentation centre & AI assistant
   ========================================================================== */

/* ---------------- docs centre ---------------- */
.docs-shell {
  display: grid;
  grid-template-columns: 230px minmax(0, 1fr);
  gap: clamp(24px, 4vw, 56px);
  align-items: start;
}
.docs-side {
  position: sticky;
  top: 96px;
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: 8px;
  background: rgba(255, 255, 255, 0.018);
}
.docs-side .k {
  padding: 10px 12px 8px;
  font-family: var(--mono);
  font-size: 0.56rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted-2);
}
.docs-side button {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 9px 12px;
  border-radius: 2px;
  font-size: 0.84rem;
  color: var(--text-2);
  text-align: left;
  transition: background 0.2s, color 0.2s;
}
.docs-side button:hover { background: rgba(255, 255, 255, 0.04); color: #fff; }
.docs-side button.is-on { background: rgba(30, 111, 217, 0.16); color: #fff; }
.docs-side button span {
  font-family: var(--mono);
  font-size: 0.58rem;
  color: var(--muted-2);
}
.docs-tools {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}
.docs-search {
  position: relative;
  flex: 1 1 260px;
}
.docs-search input {
  width: 100%;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--line-2);
  border-radius: 3px;
  color: var(--text);
  font: inherit;
  font-size: 0.88rem;
  padding: 11px 14px 11px 38px;
}
.docs-search input::placeholder { color: var(--muted-2); }
.docs-search input:focus { outline: none; border-color: var(--blue-bright); background: rgba(59, 140, 255, 0.06); }
.docs-search svg {
  position: absolute;
  left: 13px;
  top: 50%;
  transform: translateY(-50%);
  width: 15px;
  height: 15px;
  color: var(--muted-2);
  pointer-events: none;
}
.docs-count {
  font-family: var(--mono);
  font-size: 0.62rem;
  letter-spacing: 0.1em;
  color: var(--muted-2);
  white-space: nowrap;
}
.doc-list {
  display: grid;
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: 3px;
  overflow: hidden;
}
.doc {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
  padding: 18px 20px;
  background: var(--bg);
  transition: background 0.2s;
}
.doc:hover { background: var(--panel); }
.doc h3 {
  font-size: 0.96rem;
  letter-spacing: -0.01em;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.doc .meta {
  margin-top: 7px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  font-family: var(--mono);
  font-size: 0.6rem;
  letter-spacing: 0.05em;
  color: var(--muted-2);
}
.doc .meta b { color: var(--muted); font-weight: 400; }
.doc .st {
  font-family: var(--mono);
  font-size: 0.56rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border-radius: 2px;
  padding: 2px 7px;
  border: 1px solid var(--line-2);
  color: var(--muted);
}
.doc .st.pending { color: var(--amber); border-color: rgba(240, 179, 87, 0.35); background: rgba(240, 179, 87, 0.06); }
.doc .st.ready { color: var(--teal); border-color: rgba(63, 216, 200, 0.32); background: rgba(63, 216, 200, 0.06); }
.doc .act {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  color: var(--blue-soft);
  white-space: nowrap;
}
.doc .act.is-disabled { color: var(--muted-2); cursor: not-allowed; }
.doc .act svg { width: 13px; height: 13px; }
.doc-list .empty {
  padding: 34px 20px;
  text-align: center;
  color: var(--muted);
  font-size: 0.86rem;
  background: var(--bg);
}

/* ---------------- AI assistant ---------------- */
.ai-fab {
  position: fixed;
  z-index: 80;
  right: 22px;
  bottom: 22px;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 12px 18px 12px 14px;
  border-radius: 999px;
  background: linear-gradient(135deg, #2a7ce6, #1e6fd9);
  color: #fff;
  font-size: 0.86rem;
  font-weight: 500;
  box-shadow: 0 14px 34px -14px rgba(30, 111, 217, 0.9), 0 1px 0 rgba(255, 255, 255, 0.18) inset;
  transition: transform 0.25s var(--ease), box-shadow 0.25s;
}
.ai-fab:hover { transform: translateY(-2px); box-shadow: 0 18px 40px -14px rgba(30, 111, 217, 0.95); }
.ai-fab svg { width: 18px; height: 18px; }
.ai-fab .dot-live {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #3fd8c8;
  box-shadow: 0 0 0 3px rgba(63, 216, 200, 0.22);
}

.ai-panel {
  position: fixed;
  z-index: 81;
  right: 22px;
  bottom: 184px;
  width: min(392px, calc(100vw - 28px));
  height: min(560px, calc(100vh - 120px));
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line-2);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 40px 80px -30px rgba(0, 0, 0, 0.85);
  opacity: 0;
  transform: translateY(12px) scale(0.98);
  pointer-events: none;
  transition: opacity 0.25s var(--ease), transform 0.25s var(--ease);
  overflow: hidden;
}
.ai-panel.is-open { opacity: 1; transform: none; pointer-events: auto; }
.ai-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.025);
}
.ai-head .t { flex: 1; min-width: 0; }
.ai-head .t b { display: block; font-size: 0.92rem; }
.ai-head .t span { display: block; margin-top: 3px; font-family: var(--mono); font-size: 0.56rem; letter-spacing: 0.1em; color: var(--muted-2); text-transform: uppercase; }
.ai-close {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 3px;
  color: var(--muted);
}
.ai-close:hover { color: #fff; border-color: var(--line-2); }
.ai-close svg { width: 14px; height: 14px; }
.ai-msgs {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  scrollbar-width: thin;
}
.msg { max-width: 88%; font-size: 0.86rem; line-height: 1.65; }
.msg .bubble { padding: 10px 13px; border-radius: 8px; }
.msg.bot { align-self: flex-start; }
.msg.bot .bubble { background: rgba(255, 255, 255, 0.05); border: 1px solid var(--line); color: var(--text-2); border-bottom-left-radius: 3px; }
.msg.user { align-self: flex-end; }
.msg.user .bubble { background: var(--blue); color: #fff; border-bottom-right-radius: 3px; }
.msg .src {
  display: block;
  margin-top: 6px;
  font-family: var(--mono);
  font-size: 0.56rem;
  letter-spacing: 0.06em;
  color: var(--muted-2);
}
.msg .src a { color: var(--blue-soft); border-bottom: 1px solid rgba(59, 140, 255, 0.35); }
.ai-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0 16px 10px;
}
.ai-chips button {
  font-size: 0.72rem;
  color: var(--text-2);
  border: 1px solid var(--line-2);
  border-radius: 999px;
  padding: 5px 10px;
  transition: background 0.2s, color 0.2s;
}
.ai-chips button:hover { background: rgba(255, 255, 255, 0.06); color: #fff; }
.ai-form {
  display: flex;
  gap: 8px;
  padding: 12px 14px;
  border-top: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.18);
}
.ai-form input {
  flex: 1;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line-2);
  border-radius: 3px;
  color: var(--text);
  font: inherit;
  font-size: 0.86rem;
  padding: 10px 12px;
}
.ai-form input::placeholder { color: var(--muted-2); }
.ai-form input:focus { outline: none; border-color: var(--blue-bright); }
.ai-form button {
  width: 40px;
  display: grid;
  place-items: center;
  border-radius: 3px;
  background: var(--blue);
  color: #fff;
}
.ai-form button:hover { background: #2a7ce6; }
.ai-form button svg { width: 16px; height: 16px; }
.ai-foot {
  padding: 8px 14px 10px;
  font-family: var(--mono);
  font-size: 0.54rem;
  letter-spacing: 0.04em;
  color: var(--muted-2);
  border-top: 1px solid var(--line);
}
.typing { display: inline-flex; gap: 4px; align-items: center; }
.typing i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--muted);
  animation: tw 1.1s infinite;
}
.typing i:nth-child(2) { animation-delay: 0.15s; }
.typing i:nth-child(3) { animation-delay: 0.3s; }
@keyframes tw { 0%, 60%, 100% { opacity: 0.25; } 30% { opacity: 1; } }

@media (max-width: 860px) {
  .docs-shell { grid-template-columns: minmax(0, 1fr); }
  .docs-side {
    position: static;
    display: flex;
    gap: 6px;
    overflow-x: auto;
    padding: 6px;
  }
  .docs-side .k { display: none; }
  .docs-side button { width: auto; white-space: nowrap; border: 1px solid var(--line); }
  .doc { grid-template-columns: minmax(0, 1fr); }
  .doc .act { justify-self: start; }
  .biz-grid { grid-template-columns: minmax(0, 1fr); }
  .ai-fab { right: 14px; bottom: 14px; padding: 11px 15px; }
  .ai-panel { right: 12px; bottom: 172px; }
}

@media (max-width: 560px) {
  .hero-carousel { min-height: 700px; }
  .hero-ui, .hero-counter { bottom: 18px; }
  .hero-dots button { width: 24px; }
  .hero-dots button.is-on { width: 36px; }
}


/* ---------------- academy / video classroom ---------------- */
.video-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}
.video-card {
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--panel);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.video-slot {
  position: relative;
  aspect-ratio: 16 / 9;
  display: grid;
  place-items: center;
  gap: 10px;
  background: linear-gradient(160deg, #1b2a3b, #121d29);
  border-bottom: 1px solid var(--line);
}
.video-slot::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(to right, rgba(255, 255, 255, 0.05) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255, 255, 255, 0.05) 1px, transparent 1px);
  background-size: 34px 34px;
  mask-image: radial-gradient(ellipse 75% 75% at 50% 50%, #000, transparent 78%);
  -webkit-mask-image: radial-gradient(ellipse 75% 75% at 50% 50%, #000, transparent 78%);
}
.video-slot .play {
  position: relative;
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.34);
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
}
.video-slot .play svg { width: 16px; height: 16px; margin-left: 2px; }
.video-slot .vs-tag {
  position: absolute;
  top: 12px;
  left: 12px;
  font-family: var(--mono);
  font-size: 0.54rem;
  letter-spacing: 0.14em;
  color: var(--muted-2);
  border: 1px solid var(--line-2);
  border-radius: 2px;
  padding: 2px 6px;
  background: rgba(16, 26, 38, 0.6);
}
.video-slot .vs-id {
  position: absolute;
  right: 12px;
  bottom: 10px;
  font-family: var(--mono);
  font-size: 0.54rem;
  letter-spacing: 0.1em;
  color: var(--muted-2);
}
.video-card h3 { padding: 16px 18px 0; font-size: 0.98rem; }
.video-card p { padding: 6px 18px 18px; font-size: 0.8rem; line-height: 1.6; color: var(--muted); }
.video-slot iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
html[data-theme="light"] .video-slot { background: linear-gradient(160deg, #eaf1fa, #dfe9f5); }
html[data-theme="light"] .video-slot::before {
  background-image:
    linear-gradient(to right, rgba(10, 37, 64, 0.06) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(10, 37, 64, 0.06) 1px, transparent 1px);
}
html[data-theme="light"] .video-slot .play { border-color: rgba(10, 37, 64, 0.3); background: rgba(255, 255, 255, 0.7); color: #0a2540; }
html[data-theme="light"] .video-slot .vs-tag { background: rgba(255, 255, 255, 0.8); }
@media (max-width: 900px) { .video-grid { grid-template-columns: minmax(0, 1fr); } }
