/* ============================================
   DR. WOLF COACH PANEL STYLES
   Appended to computer-play.css
   ============================================ */

/* ========================
   COACH PANEL — floating card above board
   ======================== */
.coach-panel {
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%) translateY(110%);
  z-index: 200;
  width: calc(100% - 24px);
  max-width: 520px;
  pointer-events: none;
  transition: transform 0.45s cubic-bezier(0.34, 1.56, 0.64, 1),
    opacity 0.35s ease;
  opacity: 0;
}

.coach-panel.visible {
  transform: translateX(-50%) translateY(0%);
  opacity: 1;
  pointer-events: auto;
}

.coach-bubble {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: rgba(15, 18, 28, 0.97);
  border: 1px solid rgba(245, 158, 11, 0.35);
  border-radius: 14px;
  padding: 12px 14px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6),
    0 0 0 1px rgba(245, 158, 11, 0.08) inset;
  backdrop-filter: blur(16px);
  position: relative;
  overflow: hidden;
}

/* Subtle left-side accent stripe */
.coach-bubble::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  border-radius: 14px 0 0 14px;
  background: linear-gradient(180deg, #f59e0b, #d97706);
  transition: background 0.4s ease;
}

/* Praise variant — green */
.coach-bubble.praise::before {
  background: linear-gradient(180deg, #22c55e, #16a34a);
}

/* Warning / blunder variant — red */
.coach-bubble.warning::before {
  background: linear-gradient(180deg, #ef4444, #dc2626);
}

/* Mistake variant — orange */
.coach-bubble.mistake::before {
  background: linear-gradient(180deg, #f97316, #ea580c);
}

/* ========================
   AVATAR
   ======================== */
.coach-avatar {
  flex-shrink: 0;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, #1e2a3a, #2d3f55);
  border: 2px solid rgba(245, 158, 11, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  line-height: 1;
  position: relative;
  overflow: hidden;
}

.coach-avatar::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, rgba(245, 158, 11, 0.15), transparent 60%);
}

/* ========================
   COACH BODY
   ======================== */
.coach-body {
  flex: 1;
  min-width: 0;
}

.coach-name {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: #f59e0b;
  margin-bottom: 3px;
}

.coach-text {
  font-size: 13px;
  line-height: 1.55;
  color: #e2e8f0;
  font-weight: 400;
  word-break: break-word;
}

/* ========================
   DISMISS BUTTON
   ======================== */
.coach-dismiss {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  background: rgba(255, 255, 255, 0.07);
  border: none;
  border-radius: 50%;
  color: #6b7280;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, color 0.2s;
  line-height: 1;
  padding: 0;
  margin-top: 2px;
}

.coach-dismiss:hover {
  background: rgba(255, 255, 255, 0.15);
  color: #e2e8f0;
}

/* ========================
   CLASSIFICATION BADGE (optional, on left of text)
   ======================== */
.coach-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.5px;
  padding: 1px 7px;
  border-radius: 20px;
  margin-right: 6px;
  vertical-align: middle;
  position: relative;
  top: -1px;
}

.coach-badge.blunder {
  background: rgba(239, 68, 68, 0.2);
  color: #ef4444;
}

.coach-badge.mistake {
  background: rgba(249, 115, 22, 0.2);
  color: #f97316;
}

.coach-badge.inaccuracy {
  background: rgba(251, 191, 36, 0.2);
  color: #fbbf24;
}

.coach-badge.best {
  background: rgba(34, 197, 94, 0.2);
  color: #22c55e;
}

.coach-badge.excellent {
  background: rgba(74, 222, 128, 0.2);
  color: #4ade80;
}

.coach-badge.good {
  background: rgba(134, 239, 172, 0.2);
  color: #86efac;
}

/* ========================
   TYPING ANIMATION (dots appear before text shows)
   ======================== */
.coach-typing {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 18px;
}

.coach-typing span {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #f59e0b;
  animation: coachTyping 1s ease-in-out infinite;
}

.coach-typing span:nth-child(2) {
  animation-delay: 0.15s;
}

.coach-typing span:nth-child(3) {
  animation-delay: 0.30s;
}

@keyframes coachTyping {

  0%,
  100% {
    opacity: 0.3;
    transform: translateY(0);
  }

  50% {
    opacity: 1;
    transform: translateY(-3px);
  }
}

/* ========================
   COACH TOGGLE BUTTON
   (bottom-right of board area — always visible during game)
   ======================== */
.coach-toggle-btn {
  position: absolute;
  bottom: 10px;
  right: 10px;
  z-index: 190;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(15, 18, 28, 0.9);
  border: 1.5px solid rgba(245, 158, 11, 0.4);
  color: #f59e0b;
  font-size: 18px;
  cursor: pointer;
  display: none;
  /* shown via JS when game starts */
  align-items: center;
  justify-content: center;
  transition: background 0.2s, transform 0.2s;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(8px);
}

.coach-toggle-btn:hover {
  background: rgba(245, 158, 11, 0.15);
  transform: scale(1.08);
}

/* Notification dot when there's a new unseen message */
.coach-toggle-btn .coach-notif-dot {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #ef4444;
  border: 1.5px solid #0f121c;
  display: none;
  animation: coachDotPulse 1.5s ease infinite;
}

@keyframes coachDotPulse {

  0%,
  100% {
    opacity: 1;
    transform: scale(1);
  }

  50% {
    opacity: 0.5;
    transform: scale(1.3);
  }
}

/* ========================
   HISTORY TRAY (slide-up recent messages)
   ======================== */
.coach-history {
  position: absolute;
  bottom: 58px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  z-index: 185;
  width: calc(100% - 24px);
  max-width: 520px;
  max-height: 220px;
  overflow-y: auto;
  background: rgba(12, 15, 24, 0.97);
  border: 1px solid rgba(245, 158, 11, 0.2);
  border-radius: 12px;
  padding: 8px;
  display: none;
  flex-direction: column;
  gap: 6px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(12px);
}

.coach-history.open {
  display: flex;
  animation: historySlideUp 0.25s ease;
}

@keyframes historySlideUp {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(30px);
  }

  to {
    opacity: 1;
    transform: translateX(-50%) translateY(20px);
  }
}

.coach-history-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.05);
  font-size: 12px;
  color: #94a3b8;
  line-height: 1.5;
}

.coach-history-item:last-child {
  color: #cbd5e1;
}

.coach-history-move {
  flex-shrink: 0;
  font-family: 'Roboto Mono', monospace;
  font-size: 10px;
  color: #f59e0b;
  font-weight: 700;
  min-width: 28px;
  padding-top: 1px;
}

/* ========================
   RESPONSIVE
   ======================== */
@media (max-width: 950px) {
  .coach-panel {
    bottom: 0;
    width: 100%;
    max-width: 100%;
    left: 0;
    right: 0;
    transform: translateY(110%);
    border-radius: 14px 14px 0 0;
  }

  .coach-panel.visible {
    transform: translateY(0%);
  }

  .coach-bubble {
    border-radius: 14px 14px 0 0;
    border-left: none;
    border-right: none;
    border-bottom: none;
  }

  .coach-bubble::before {
    top: 0;
    bottom: auto;
    left: 0;
    right: 0;
    width: 100%;
    height: 3px;
    border-radius: 14px 14px 0 0;
  }

  .coach-toggle-btn {
    bottom: 60px;
  }
}

/* ========================
   SIDEBAR INTEGRATION (Non-Overlapping)
   ======================== */
.coach-container-sidebar {
  display: flex;
  flex-direction: column;
  background: var(--bg-sidebar-alt);
  border-bottom: 1px solid var(--border-color);
}

#coachContainerSidebar .coach-panel {
  position: relative;
  transform: none !important;
  left: 0;
  bottom: 0;
  width: 100%;
  max-width: 100%;
  padding: 10px 15px;
  display: none;
  background: transparent;
  animation: slideFadeIn 0.35s ease-out;
}

#coachContainerSidebar .coach-panel.visible {
  display: block;
  opacity: 1;
}

#coachContainerSidebar .coach-bubble {
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
  border-radius: 14px !important;
  border: 1px solid rgba(245, 158, 11, 0.35) !important;
}

#coachContainerSidebar .coach-bubble::before {
  top: 0 !important;
  bottom: 0 !important;
  left: 0 !important;
  right: auto !important;
  width: 3px !important;
  height: auto !important;
  border-radius: 14px 0 0 14px !important;
}

/* Force toggle button to stay in the board area instead of jumping to sidebar */
.board-area .coach-toggle-btn {
  display: flex !important;
}

@keyframes slideFadeIn {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}