/* AI Coach Popup - Simple Clean Design */
.ai-coach-popup {
  position: fixed;
  width: 380px;
  background: white;
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(76, 89, 148, 0.3);
  z-index: 999999;
  opacity: 0;
  transform: translateX(calc(-100% - 50px));
  transition: opacity 0.4s ease, transform 0.5s cubic-bezier(0.19, 1, 0.22, 1);
  font-family: 'Noto Sans KR', 'Apple SD Gothic Neo', sans-serif;
  overflow: visible;
  backdrop-filter: blur(10px);
}

.ai-coach-popup.show {
  opacity: 1;
  transform: translateX(0);
}

.ai-coach-popup.collapsed {
  transform: translateX(calc(-100% - 30px));
  background: transparent;
  box-shadow: none;
}

.ai-coach-popup.collapsed .ai-coach-header,
.ai-coach-popup.collapsed .ai-coach-body {
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
  transition: opacity 0.25s ease;
}

.ai-coach-popup:not(.collapsed) {
  background: white;
  box-shadow: 0 15px 45px rgba(76, 89, 148, 0.25);
}

.ai-coach-popup.no-transition {
  transition: none;
}

.ai-coach-txt{
  position: absolute;
  right: 2px;
  bottom: -20px;
  width: 70px;
  height: auto;
  color: white;
  font-weight: 500;
  font-size: 14px;
  line-height: 1.4;
  text-align: center;
  background-color: #7f2cff;
  padding: 2px;
  border-radius: 30px;
}

.ai-coach-popup .ai-coach-toggle {
  position: absolute;
  right: -150px;
  bottom: 0;
  --toggle-base-transform: translateY(-50%);
  transform: var(--toggle-base-transform);
  width: 75px;
  height: 75px;
  background: #7f2cff;
  border: none;
  border-radius: 100%;
  color: #fff;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-orientation: mixed;
  cursor: pointer;
  box-shadow: 0 8px 30px rgba(74, 108, 247, 0.4);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  font-size: 14px;
  line-height: 1.6;
  white-space: pre-line;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px 6px;
  text-align: center;
  word-break: keep-all;
}

.ai-coach-popup .ai-coach-toggle .ai-coach-icon-img {
  width: 40px;
  height: 40px;
  margin-bottom: 8px;
  object-fit: contain;
  pointer-events: none;
  display: block;
}

.ai-coach-popup.collapsed .ai-coach-toggle {
  opacity: 1;
  pointer-events: auto;
}

.ai-coach-popup:not(.collapsed) .ai-coach-toggle {
  opacity: 0;
  pointer-events: none;
  width: 0;
  overflow: hidden;
}

.ai-coach-popup .ai-coach-toggle.is-bouncing {
  animation: ai-coach-toggle-bounce 0.8s ease-in-out infinite;
}

@keyframes ai-coach-toggle-bounce {
  0%, 100% {
    transform: var(--toggle-base-transform) scale(1);
  }
  40% {
    transform: var(--toggle-base-transform) scale(1.08);
  }
  60% {
    transform: var(--toggle-base-transform) scale(0.95);
  }
}


.ai-coach-header {
  background: linear-gradient(135deg, #4A6CF7, #8C5AEF);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  position: relative;
  border-radius: 16px 16px 0 0;
}

.ai-coach-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  font-size: 0;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.15));
}

.ai-coach-icon svg {
  width: 100%;
  height: 100%;
}

.ai-coach-title {
  flex: 1;
  color: white;
  font-weight: 700;
  font-size: 16px;
  letter-spacing: -0.2px;
}

.ai-coach-close {
  background: rgba(255,255,255,0.2);
  border: none;
  color: white;
  font-size: 20px;
  cursor: pointer;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ai-coach-body {
  padding: 18px;
}

.ai-coach-message {
  font-size: 15px;
  line-height: 1.6;
  color: #333;
  margin-bottom: 14px;
  font-weight: 500;
  letter-spacing: -0.2px;
}

.ai-coach-reasons {
  margin: 0 0 12px 18px;
  padding: 0;
  color: #666;
  font-size: 12px;
  line-height: 1.4;
  list-style: disc;
}

.ai-coach-reasons li + li {
  margin-top: 4px;
}

.ai-coach-actions {
  display: flex;
  gap: 8px;
}

.ai-coach-btn {
  flex: 1;
  padding: 12px 10px;
  border-radius: 8px;
  border: none;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  text-align: center;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.ai-coach-btn.primary {
  background: linear-gradient(135deg, #4A6CF7, #8C5AEF);
  color: white;
}

.ai-coach-btn.secondary {
  background: white;
  color: #4A6CF7;
  border: 2px solid #4A6CF7;
}

.ai-coach-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 18px rgba(74, 108, 247, 0.2);
}

@media (max-width: 768px) {
  .ai-coach-popup {
    width: calc(100% - 32px);
    left: 16px !important;
    right: 16px;
    transform: translateY(120%);
    bottom: 0 !important;
    border-radius: 16px 16px 0 0;
  }

  .ai-coach-popup.show {
    transform: translateY(0);
  }

  .ai-coach-popup.collapsed {
    transform: translateY(calc(100% - 60px));
  }

  .ai-coach-popup .ai-coach-toggle {
    right: 50%;
    left: 50%;
    width: 120px;
    height: 48px;
    --toggle-base-transform: translate(-50%, -100%);
    transform: var(--toggle-base-transform);
    border-radius: 12px 12px 0 0;
    writing-mode: horizontal-tb;
    text-orientation: initial;
    box-shadow: 0 10px 20px rgba(76, 89, 148, 0.25);
  }

  .ai-coach-body {
    padding: 20px;
  }
}
