/* OBI Chat Widget — Glassmorphism Style */
/* Natural English Training */

#obi-fab {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: linear-gradient(135deg, #1e40af, #3b82f6);
  box-shadow: 0 8px 32px rgba(30, 64, 175, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 10000;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  border: none;
}

#obi-fab:hover {
  transform: scale(1.1);
  box-shadow: 0 12px 40px rgba(30, 64, 175, 0.5);
}

#obi-fab.obi-fab-active {
  transform: scale(0.9) rotate(90deg);
  background: linear-gradient(135deg, #dc2626, #ef4444);
}

.obi-fab-emoji {
  font-size: 28px;
  line-height: 1;
}

/* Panel */
#obi-panel {
  position: fixed;
  bottom: 100px;
  right: 24px;
  width: 380px;
  height: 520px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(255, 255, 255, 0.2);
  display: flex;
  flex-direction: column;
  z-index: 10001;
  overflow: hidden;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

#obi-panel.obi-hidden {
  opacity: 0;
  transform: translateY(20px) scale(0.95);
  pointer-events: none;
}

#obi-panel.obi-visible {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

/* Header */
.obi-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  background: linear-gradient(135deg, #1e40af, #3b82f6);
  color: white;
}

.obi-header-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.obi-header-emoji {
  font-size: 28px;
}

.obi-header-title {
  font-family: 'Inter', sans-serif;
  font-weight: 700;
  font-size: 1.1rem;
}

.obi-header-subtitle {
  font-size: 0.75rem;
  opacity: 0.85;
}

.obi-header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.obi-level-badge {
  background: #fbbf24;
  color: #1e293b;
  font-size: 0.65rem;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: 10px;
  letter-spacing: 0.05em;
}

.obi-close {
  background: rgba(255,255,255,0.2);
  border: none;
  color: white;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

.obi-close:hover {
  background: rgba(255,255,255,0.3);
}

/* Messages */
.obi-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.obi-messages::-webkit-scrollbar {
  width: 4px;
}

.obi-messages::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
}

.obi-msg {
  display: flex;
  max-width: 85%;
}

.obi-msg-user {
  align-self: flex-end;
  justify-content: flex-end;
}

.obi-msg-assistant {
  align-self: flex-start;
}

.obi-msg-bubble {
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 0.9rem;
  line-height: 1.5;
  word-wrap: break-word;
}

.obi-bubble-user {
  background: linear-gradient(135deg, #1e40af, #3b82f6);
  color: white;
  border-bottom-right-radius: 4px;
}

.obi-bubble-assistant {
  background: #f1f5f9;
  color: #1e293b;
  border-bottom-left-radius: 4px;
}

/* Typing indicator */
.obi-typing {
  padding: 8px 20px;
  display: flex;
  gap: 4px;
  align-items: center;
}

.obi-typing.obi-hidden {
  display: none;
}

.obi-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #94a3b8;
  animation: obiBounce 1.4s ease-in-out infinite;
}

.obi-dot:nth-child(2) { animation-delay: 0.2s; }
.obi-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes obiBounce {
  0%, 60%, 100% { transform: translateY(0); }
  30% { transform: translateY(-6px); }
}

/* Input area */
.obi-input-area {
  display: flex;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid #e2e8f0;
  background: white;
}

#obi-input {
  flex: 1;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 10px 14px;
  font-size: 0.9rem;
  font-family: 'Inter', sans-serif;
  outline: none;
  transition: border-color 0.2s;
}

#obi-input:focus {
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

#obi-input::placeholder {
  color: #94a3b8;
}

.obi-send-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, #1e40af, #3b82f6);
  color: white;
  border: none;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  flex-shrink: 0;
}

.obi-send-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(30, 64, 175, 0.3);
}

/* Mobile responsive */
@media (max-width: 480px) {
  #obi-panel {
    width: calc(100vw - 16px);
    height: calc(100vh - 120px);
    bottom: 80px;
    right: 8px;
    border-radius: 16px;
  }

  #obi-fab {
    bottom: 16px;
    right: 16px;
    width: 56px;
    height: 56px;
  }

  .obi-fab-emoji {
    font-size: 24px;
  }
}
