/* ═══════════════════════════════════════════════════════════════════
   SOUL + VOICE Widget — Shared CSS
   Single source of truth for all SOUL panel styling.
   Used by portal pages, study window, and any page including the widget.
   Patent GB2519103.2 — L.I.F.ECoach121.com Limited
   ═══════════════════════════════════════════════════════════════════ */

#soul-fab {
  position: fixed; bottom: 28px; right: 28px; z-index: 9999;
  width: 60px; height: 60px; border-radius: 50%;
  background: linear-gradient(135deg, #7c3aed, #4f46e5);
  border: none; cursor: pointer;
  box-shadow: 0 4px 24px rgba(124,58,237,.5);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.5rem; color: #fff;
  transition: transform .2s, box-shadow .2s;
}
#soul-fab:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 32px rgba(124,58,237,.7);
}

#soul-panel {
  position: fixed; bottom: 100px; right: 28px; z-index: 9998;
  width: 380px; max-height: 75vh;
  background: #0f1117; border: 1px solid #4c1d95;
  border-radius: 20px; box-shadow: 0 8px 40px rgba(0,0,0,.6);
  display: none; flex-direction: column; overflow: hidden;
}
#soul-panel.open { display: flex; }

.sp-head {
  background: linear-gradient(135deg, #1e1b4b, #1e3a5f);
  padding: 16px 20px; display: flex;
  align-items: center; justify-content: space-between;
}
.sp-head h4 { color: #a78bfa; font-size: 1rem; font-weight: 800; margin: 0; }
.sp-head .sp-close {
  background: none; border: none; color: #6b7280;
  cursor: pointer; font-size: 1.2rem;
}

.sp-tabs { display: flex; border-bottom: 1px solid #1e2130; }
.sp-tab {
  flex: 1; padding: 10px; border: none; background: none; color: #6b7280;
  cursor: pointer; font-size: .82rem; font-weight: 600; transition: color .2s;
}
.sp-tab.active { color: #a78bfa; border-bottom: 2px solid #a78bfa; }

.sp-body { flex: 1; overflow-y: auto; padding: 16px; }

#soul-chat-log {
  min-height: 160px; max-height: 260px; overflow-y: auto;
  background: #0a1628; border-radius: 8px; padding: 12px; margin-bottom: 10px;
  font-size: .82rem; color: #d1d5db;
}
.soul-msg-user {
  margin: 6px 0; color: #e0e0e0; padding: 6px 10px;
  background: rgba(79,70,229,.15); border-radius: 8px; text-align: right;
}
.soul-msg-ai {
  margin: 6px 0; color: #a78bfa; padding: 6px 10px;
  background: rgba(124,58,237,.08); border-radius: 8px;
}

.sp-input-row { display: flex; gap: 8px; }
.sp-input-row input {
  flex: 1; padding: 9px 12px; border-radius: 8px;
  border: 1px solid #2d3348; background: #0d1020; color: #e0e0e0; font-size: .85rem;
}
.sp-input-row button {
  padding: 9px 16px; border-radius: 8px; border: none;
  background: #7c3aed; color: #fff; font-weight: 700; cursor: pointer; font-size: .85rem;
}

.soul-phi-row { display: flex; gap: 12px; margin-bottom: 14px; }
.soul-kpi {
  flex: 1; background: #1e1b4b; border-radius: 10px; padding: 12px; text-align: center;
}
.soul-kpi .val { font-size: 1.4rem; font-weight: 800; color: #a78bfa; }
.soul-kpi .lbl { font-size: .68rem; color: #6b7280; margin-top: 4px; }

.voice-btn {
  width: 100%; padding: 14px; border-radius: 12px; border: none;
  background: linear-gradient(135deg, #0e7490, #06b6d4); color: #fff;
  font-size: 1rem; font-weight: 700; cursor: pointer; margin-bottom: 10px;
  display: flex; align-items: center; justify-content: center; gap: 8px;
}
.voice-btn:disabled { opacity: .4; cursor: not-allowed; }

#voice-status { font-size: .78rem; color: #6b7280; text-align: center; margin-bottom: 8px; }

.mic-btn {
  width: 48px; height: 48px; border-radius: 50%; border: 2px solid #2d3348;
  background: #1e2130; color: #6b7280; font-size: 1.3rem; cursor: pointer;
  display: flex; align-items: center; justify-content: center; transition: all .2s;
}
.mic-btn:hover { border-color: #7c3aed; color: #7c3aed; }
.mic-btn.recording {
  border-color: #ef4444; color: #ef4444; background: #1a0a0a;
  animation: pulse-mic 1.2s infinite;
}
.mic-btn.processing { border-color: #f59e0b; color: #f59e0b; opacity: .7; }

@keyframes pulse-mic {
  0%, 100% { box-shadow: 0 0 0 0 rgba(239,68,68,.4); }
  50% { box-shadow: 0 0 0 12px rgba(239,68,68,0); }
}

.handsfree-area { text-align: center; padding: 16px 0; }
.handsfree-status { font-size: .82rem; color: #9ca3af; margin-top: 10px; }
.handsfree-transcript {
  background: #0a1628; border-radius: 8px; padding: 10px; margin-top: 10px;
  font-size: .82rem; color: #d1d5db; min-height: 40px; max-height: 100px; overflow-y: auto;
}
.handsfree-response {
  background: #1e1b4b; border: 1px solid #4c1d95; border-radius: 8px;
  padding: 10px; margin-top: 10px; font-size: .82rem; color: #a78bfa;
}

.hf-controls {
  display: flex; flex-wrap: wrap; gap: 8px;
  justify-content: center; margin: 12px 0; align-items: center;
}
.hf-toggle {
  display: flex; align-items: center; gap: 5px;
  font-size: .72rem; color: #9ca3af; cursor: pointer;
}
.hf-toggle input[type=checkbox] { accent-color: #7c3aed; width: 14px; height: 14px; }
.hf-toggle.active { color: #a78bfa; }

.hf-lang-select {
  background: #1e2130; border: 1px solid #2d3348; border-radius: 6px;
  color: #9ca3af; font-size: .72rem; padding: 3px 6px; cursor: pointer;
}

.hf-emotion-badge {
  display: inline-flex; align-items: center; gap: 4px; padding: 3px 8px;
  border-radius: 10px; font-size: .68rem;
  background: #1e1b4b; border: 1px solid #4c1d95; color: #a78bfa;
}

.hf-timer-display {
  background: #0a1628; border: 1px solid #2d3348; border-radius: 8px;
  padding: 8px 12px; font-size: 1.1rem; color: #34d399; font-family: monospace;
  display: none; text-align: center; margin-top: 8px;
}
.hf-timer-display.active { display: block; animation: pulse-timer 2s infinite; }
@keyframes pulse-timer { 0%, 100% { opacity: 1; } 50% { opacity: .7; } }

.hf-offline-badge {
  background: #78350f; border: 1px solid #d97706; border-radius: 6px;
  padding: 2px 8px; font-size: .68rem; color: #fbbf24; display: none;
}
.hf-offline-badge.visible { display: inline-block; }

.soul-speed-control {
  margin: 12px 0; padding: 8px 12px; background: #0d2847;
  border: 1px solid rgba(0,120,212,.2); border-radius: 8px;
}
.soul-speed-control label {
  font-size: .78rem; color: #9ca3af; display: block; margin-bottom: 6px;
}
.soul-speed-control .speed-value { color: #60a5fa; font-weight: 600; }
.soul-speed-control input[type=range] {
  width: 100%; height: 6px; -webkit-appearance: none; appearance: none;
  background: #1e3a5f; border-radius: 3px; outline: none; cursor: pointer;
}
.soul-speed-control .speed-ticks {
  display: flex; justify-content: space-between;
  font-size: .6rem; color: #4b5563; margin-top: 4px;
}

.soul-preset-btn {
  padding: 5px 10px; border-radius: 6px; border: 1px solid #2d3348;
  background: #1e2130; color: #9ca3af; cursor: pointer; font-size: .75rem;
}

@media (max-width: 480px) {
  #soul-panel { width: calc(100vw - 32px); right: 16px; }
}
