/* ============================================
   GSM Call Beta Feedback Widget
   ============================================ */

/* Floating Mascot Button */
#beta-feedback-fab {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 68px;
  height: 68px;
  border-radius: 50%;
  background: linear-gradient(135deg, #2563eb 0%, #1e40af 100%);
  border: 3px solid rgba(255, 255, 255, 0.9);
  box-shadow: 0 6px 24px rgba(37, 99, 235, 0.4), 0 0 0 0 rgba(37, 99, 235, 0.3);
  cursor: pointer;
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.3s ease;
  animation: fabPulse 3s ease-in-out infinite;
}

#beta-feedback-fab:hover {
  transform: scale(1.12);
  box-shadow: 0 8px 32px rgba(37, 99, 235, 0.5), 0 0 0 6px rgba(37, 99, 235, 0.15);
  animation: none;
}

#beta-feedback-fab img {
  width: 52px;
  height: 52px;
  object-fit: contain;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,0.15));
  pointer-events: none;
  border-radius: 50%;
}

@keyframes fabPulse {
  0%, 100% { box-shadow: 0 6px 24px rgba(37, 99, 235, 0.4), 0 0 0 0 rgba(37, 99, 235, 0.3); }
  50% { box-shadow: 0 6px 24px rgba(37, 99, 235, 0.4), 0 0 0 10px rgba(37, 99, 235, 0); }
}

/* Badge */
#beta-feedback-fab .fab-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  width: 20px;
  height: 20px;
  background: #ef4444;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #fff;
  opacity: 0;
  transform: scale(0);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

#beta-feedback-fab .fab-badge.visible {
  opacity: 1;
  transform: scale(1);
}

/* Tooltip */
#beta-feedback-fab .fab-tooltip {
  position: absolute;
  right: 80px;
  top: 50%;
  transform: translateY(-50%);
  background: #1e293b;
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: 8px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s ease;
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

#beta-feedback-fab .fab-tooltip::after {
  content: '';
  position: absolute;
  right: -6px;
  top: 50%;
  transform: translateY(-50%);
  border: 6px solid transparent;
  border-left-color: #1e293b;
  border-right: none;
}

#beta-feedback-fab:hover .fab-tooltip {
  opacity: 1;
}

/* ============================================
   Chat Panel
   ============================================ */
#beta-feedback-panel {
  position: fixed;
  bottom: 100px;
  right: 24px;
  width: 380px;
  max-height: 560px;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.18), 0 0 0 1px rgba(0, 0, 0, 0.05);
  z-index: 99998;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: scale(0.85) translateY(20px);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.25s ease;
  transform-origin: bottom right;
}

#beta-feedback-panel.open {
  transform: scale(1) translateY(0);
  opacity: 1;
  pointer-events: auto;
}

/* Panel Header */
.bf-header {
  background: linear-gradient(135deg, #2563eb 0%, #1e40af 100%);
  color: #fff;
  padding: 16px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.bf-header-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
}

.bf-header-avatar img {
  width: 34px;
  height: 34px;
  object-fit: contain;
  border-radius: 50%;
}

.bf-header-info {
  flex: 1;
  min-width: 0;
}

.bf-header-title {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.bf-header-subtitle {
  font-size: 11px;
  opacity: 0.8;
  margin-top: 1px;
}

.bf-header-close {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.15);
  border: none;
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  transition: background 0.2s ease;
  flex-shrink: 0;
}

.bf-header-close:hover {
  background: rgba(255, 255, 255, 0.3);
}

/* Chat Messages Area */
.bf-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 200px;
  max-height: 300px;
  background: #f8fafc;
}

.bf-msg {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 13px;
  line-height: 1.5;
  word-wrap: break-word;
  position: relative;
  animation: msgFadeIn 0.3s ease;
}

@keyframes msgFadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.bf-msg.user {
  align-self: flex-end;
  background: #2563eb;
  color: #fff;
  border-bottom-right-radius: 4px;
}

.bf-msg.admin {
  align-self: flex-start;
  background: #fff;
  color: #334155;
  border: 1px solid #e2e8f0;
  border-bottom-left-radius: 4px;
}

.bf-msg .msg-meta {
  font-size: 10px;
  opacity: 0.65;
  margin-top: 4px;
}

.bf-msg.admin .msg-sender {
  font-size: 10px;
  font-weight: 700;
  color: #2563eb;
  margin-bottom: 2px;
}

.bf-msg.user .msg-sender {
  font-size: 10px;
  font-weight: 700;
  color: #bfdbfe;
  margin-bottom: 2px;
}

.bf-msg .msg-screenshot {
  display: block;
  max-width: 100%;
  border-radius: 8px;
  margin-top: 6px;
  cursor: pointer;
  border: 1px solid rgba(0,0,0,0.08);
}

/* Welcome Message */
.bf-welcome {
  text-align: center;
  padding: 20px 10px;
}

.bf-welcome-icon {
  width: 60px;
  height: 60px;
  margin: 0 auto 10px;
}

.bf-welcome-title {
  font-size: 15px;
  font-weight: 700;
  color: #1e293b;
  margin-bottom: 4px;
}

.bf-welcome-text {
  font-size: 12px;
  color: #64748b;
  line-height: 1.5;
}

/* Input Area */
.bf-input-area {
  padding: 12px 14px;
  border-top: 1px solid #e2e8f0;
  background: #fff;
  flex-shrink: 0;
}

.bf-input-row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
}

.bf-input-row textarea {
  flex: 1;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 10px 14px;
  font-size: 13px;
  font-family: inherit;
  resize: none;
  min-height: 40px;
  max-height: 100px;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  line-height: 1.4;
}

.bf-input-row textarea:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.bf-input-row textarea::placeholder {
  color: #94a3b8;
}

.bf-send-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #2563eb;
  color: #fff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.2s ease, transform 0.15s ease;
}

.bf-send-btn:hover {
  background: #1d4ed8;
  transform: scale(1.05);
}

.bf-send-btn:disabled {
  background: #94a3b8;
  cursor: not-allowed;
  transform: none;
}

.bf-send-btn svg {
  width: 18px;
  height: 18px;
}

/* Tools Bar (screenshot, etc.) */
.bf-tools {
  display: flex;
  gap: 4px;
  margin-top: 8px;
}

.bf-tool-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  font-size: 11px;
  font-weight: 600;
  color: #64748b;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.bf-tool-btn:hover {
  background: #e2e8f0;
  color: #334155;
}

.bf-tool-btn.active {
  background: #dbeafe;
  color: #2563eb;
  border-color: #93c5fd;
}

.bf-tool-btn svg {
  width: 14px;
  height: 14px;
}

/* Screenshot Preview */
.bf-screenshot-preview {
  margin-top: 8px;
  position: relative;
  display: none;
}

.bf-screenshot-preview.visible {
  display: block;
}

.bf-screenshot-preview img {
  width: 100%;
  max-height: 120px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
}

.bf-screenshot-remove {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(0,0,0,0.6);
  color: #fff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
}

/* BETA label on FAB */
.fab-beta-label {
  position: absolute;
  bottom: -4px;
  left: 50%;
  transform: translateX(-50%);
  background: #f59e0b;
  color: #fff;
  font-size: 8px;
  font-weight: 800;
  letter-spacing: 0.5px;
  padding: 1px 6px;
  border-radius: 4px;
  text-transform: uppercase;
}

/* Responsive */
@media (max-width: 440px) {
  #beta-feedback-panel {
    width: calc(100vw - 16px);
    right: 8px;
    bottom: 88px;
    max-height: calc(100vh - 120px);
  }

  #beta-feedback-fab {
    bottom: 16px;
    right: 16px;
    width: 56px;
    height: 56px;
  }

  #beta-feedback-fab img {
    width: 42px;
    height: 42px;
    border-radius: 50%;
  }
}
