/* ═══════════════════════════════════════════
   LP TEACHER — Global / Base Styles
   ═══════════════════════════════════════════ */

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

html, body {
  height: 100%;
  overflow: hidden;
  font-family: var(--font);
  font-size: 14px;
  background: var(--bg-app);
  color: var(--text-body);
  line-height: 1.5;
}

/* Smooth theme transitions (added by toggleTheme.js) */
body.enable-transition,
body.enable-transition * {
  transition:
    background-color var(--t-mid),
    color var(--t-mid),
    border-color var(--t-mid),
    box-shadow var(--t-mid) !important;
}

/* ── Scrollbars ── */
::-webkit-scrollbar            { width: 5px; height: 5px; }
::-webkit-scrollbar-track      { background: transparent; }
::-webkit-scrollbar-thumb      { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover{ background: var(--accent); }

/* ── Buttons ── */
button { cursor: pointer; font-family: var(--font); }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 13px;
  border: none;
  border-radius: var(--r-sm);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--t-fast);
  white-space: nowrap;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}
.btn-primary:hover { background: var(--accent-hov); transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.btn-primary:active { transform: translateY(0); }

.btn-secondary {
  background: var(--bg-surface);
  color: var(--text-body);
  border: 1.5px solid var(--border);
}
.btn-secondary:hover { border-color: var(--accent); color: var(--accent); }

.btn-icon {
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--r-sm);
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-sub);
  font-size: 0.85rem;
  transition: all var(--t-fast);
}
.btn-icon:hover { background: var(--bg-hover); border-color: var(--border); color: var(--accent); }

/* ── Panel base ── */
.panel {
  background: var(--bg-panel);
  border-radius: var(--r-panel);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.panel-header {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-surface);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-shrink: 0;
}

.panel-title {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-sub);
  display: flex;
  align-items: center;
  gap: 6px;
}

.panel-body {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  min-height: 0;
}

/* ── Tags / badges ── */
.tag {
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 0.7rem;
  font-weight: 700;
  background: var(--bg-surface);
  color: var(--accent);
  border: 1px solid var(--border);
}
.tag.ok      { background: var(--green-bg);  color: var(--green);  border-color: var(--green);  }
.tag.warn    { background: var(--amber-bg);  color: var(--amber);  border-color: var(--amber);  }
.tag.danger  { background: var(--red-bg);    color: var(--red);    border-color: var(--red);    }

/* ── Status dot ── */
.ai-status-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.72rem;
  color: var(--text-muted);
}
.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--text-muted);
  flex-shrink: 0;
}
.status-dot.online   { background: var(--green); }
.status-dot.offline  { background: var(--red);   }
.status-dot.missing  { background: var(--amber); }
.status-dot.checking { background: var(--accent); animation: blink 1.2s infinite; }

@keyframes blink { 0%,100%{opacity:1} 50%{opacity:0.2} }

/* ── Tooltip ── */
.tooltip-wrap { position: relative; }
.tooltip-wrap::after {
  content: attr(data-tip);
  position: absolute;
  bottom: calc(100% + 5px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--text-h);
  color: var(--bg-panel);
  font-size: 0.68rem;
  padding: 3px 7px;
  border-radius: 5px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity var(--t-fast);
  z-index: 200;
}
.tooltip-wrap:hover::after { opacity: 1; }
/* Tooltips inside panel-headers point downward to avoid overflow:hidden clip */
.panel-header .tooltip-wrap::after {
  bottom: auto;
  top: calc(100% + 5px);
}

/* ── Typing indicator ── */
.ai-typing {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 10px 12px;
}
.ai-typing-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--accent);
  animation: bounce 1.1s infinite ease-in-out;
}
.ai-typing-dot:nth-child(2) { animation-delay: 0.18s; }
.ai-typing-dot:nth-child(3) { animation-delay: 0.36s; }
@keyframes bounce { 0%,80%,100%{transform:translateY(0);opacity:.4} 40%{transform:translateY(-6px);opacity:1} }

/* ── Range input ── */
.range-input {
  -webkit-appearance: none;
  width: 100%;
  height: 4px;
  border-radius: 2px;
  background: var(--border);
  outline: none;
  cursor: pointer;
}
.range-input::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  transition: transform var(--t-fast);
}
.range-input::-webkit-slider-thumb:hover { transform: scale(1.25); }
