/* ==========================================================================
   FRAMEE AI AGENT - WIDGET & CHAT SYSTEM
   Design System: Obsidian Dark Void + Neon Lime (#97DE24) + Cyber Cyan (#06B6D4)
   ========================================================================== */

:root {
  --framee-primary: #97DE24;
  --framee-primary-glow: rgba(151, 222, 36, 0.45);
  --framee-primary-subtle: rgba(151, 222, 36, 0.12);
  --framee-cyan: #06B6D4;
  --framee-bg-glass: rgba(8, 12, 8, 0.92);
  --framee-card-bg: rgba(15, 22, 15, 0.85);
  --framee-border: rgba(151, 222, 36, 0.25);
  --framee-border-hover: rgba(151, 222, 36, 0.6);
  --framee-text: #FFFFFF;
  --framee-text-muted: #94A3B8;
  --framee-font: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --framee-font-heading: 'Space Grotesk', sans-serif;
  --framee-shadow: 0 20px 50px rgba(0, 0, 0, 0.8), 0 0 30px rgba(151, 222, 36, 0.2);
}

/* ==========================================
   LAUNCHER FLOATING BUTTON
   ========================================== */
.framee-launcher-wrapper {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 99999;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  font-family: var(--framee-font);
}

/* Teaser / Unread Bubble */
.framee-teaser-bubble {
  background: var(--framee-card-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--framee-border);
  border-radius: 16px;
  padding: 12px 18px;
  color: #FFFFFF;
  font-size: 13px;
  font-weight: 500;
  max-width: 250px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5), 0 0 15px var(--framee-primary-glow);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  animation: framee-slide-up 0.5s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  cursor: pointer;
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.framee-teaser-bubble:hover {
  transform: translateY(-2px);
  border-color: var(--framee-primary);
}

.framee-teaser-close {
  position: absolute;
  top: -6px;
  right: -6px;
  background: #1E293B;
  color: #94A3B8;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  cursor: pointer;
}

.framee-teaser-close:hover {
  color: #FFF;
  background: #000;
}

/* Trigger Button */
.framee-launcher-btn {
  width: 62px;
  height: 62px;
  border-radius: 50%;
  background: linear-gradient(135deg, #0A0F0A 0%, #141E14 100%);
  border: 2px solid var(--framee-primary);
  box-shadow: var(--framee-shadow);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  outline: none;
}

.framee-launcher-btn:hover {
  transform: scale(1.08) rotate(3deg);
  box-shadow: 0 0 35px var(--framee-primary-glow), 0 10px 40px rgba(0,0,0,0.8);
}

.framee-launcher-btn:active {
  transform: scale(0.95);
}

/* Pulse Glow Rings */
.framee-launcher-pulse {
  position: absolute;
  top: -6px;
  left: -6px;
  right: -6px;
  bottom: -6px;
  border-radius: 50%;
  border: 2px solid var(--framee-primary);
  opacity: 0.7;
  animation: framee-ping 2s cubic-bezier(0, 0, 0.2, 1) infinite;
  pointer-events: none;
}

/* Avatar Icon Container */
.framee-avatar-icon {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--framee-primary) 0%, var(--framee-cyan) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: visible;
  padding: 2px;
}

.framee-avatar-img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  display: block;
}

.framee-status-dot {
  position: absolute;
  bottom: 0px;
  right: 0px;
  width: 13px;
  height: 13px;
  background: #10B981;
  border: 2.5px solid #0A0F0A;
  border-radius: 50%;
}

.framee-close-icon {
  display: none;
  color: var(--framee-primary);
  font-size: 24px;
  line-height: 1;
}

.framee-launcher-wrapper.active .framee-avatar-icon {
  display: none;
}
.framee-launcher-wrapper.active .framee-close-icon {
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ==========================================
   CHAT WINDOW CONTAINER
   ========================================== */
.framee-chat-window {
  position: fixed;
  bottom: 100px;
  right: 28px;
  width: 420px;
  max-width: calc(100vw - 36px);
  height: 640px;
  max-height: calc(100vh - 120px);
  background: var(--framee-bg-glass);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid var(--framee-border);
  border-radius: 24px;
  box-shadow: var(--framee-shadow);
  z-index: 99998;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  transform: translateY(20px) scale(0.96);
  transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  font-family: var(--framee-font);
}

.framee-chat-window.open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

/* Header */
.framee-chat-header {
  padding: 16px 20px;
  background: rgba(14, 20, 14, 0.95);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.framee-header-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.framee-header-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--framee-primary) 0%, var(--framee-cyan) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2px;
  box-shadow: 0 0 15px var(--framee-primary-glow);
  overflow: hidden;
}

.framee-header-avatar-img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  display: block;
}

.framee-header-title {
  font-family: var(--framee-font-heading);
  font-size: 16px;
  font-weight: 700;
  color: #FFFFFF;
  display: flex;
  align-items: center;
  gap: 8px;
}

.framee-badge {
  font-size: 10px;
  background: rgba(16, 185, 129, 0.15);
  color: #34D399;
  border: 1px solid rgba(52, 211, 153, 0.3);
  padding: 2px 8px;
  border-radius: 20px;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.framee-header-subtitle {
  font-size: 11px;
  color: var(--framee-text-muted);
}

.framee-header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.framee-icon-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--framee-text-muted);
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.framee-icon-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #FFFFFF;
  border-color: var(--framee-border);
}

/* Chat Body / Messages Scroll Area */
.framee-chat-messages {
  flex: 1;
  padding: 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
  scroll-behavior: smooth;
}

/* Custom Scrollbar */
.framee-chat-messages::-webkit-scrollbar {
  width: 5px;
}

.framee-chat-messages::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.2);
}

.framee-chat-messages::-webkit-scrollbar-thumb {
  background: rgba(151, 222, 36, 0.3);
  border-radius: 10px;
}

/* Welcome Card */
.framee-welcome-card {
  background: linear-gradient(145deg, rgba(20, 30, 20, 0.8) 0%, rgba(10, 15, 10, 0.9) 100%);
  border: 1px solid var(--framee-border);
  border-radius: 16px;
  padding: 16px;
  color: #FFF;
  margin-bottom: 8px;
}

.framee-welcome-title {
  font-family: var(--framee-font-heading);
  font-size: 15px;
  font-weight: 700;
  color: var(--framee-primary);
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.framee-welcome-desc {
  font-size: 12.5px;
  color: var(--framee-text-muted);
  line-height: 1.5;
}

/* Message Rows */
.framee-msg-row {
  display: flex;
  gap: 10px;
  max-width: 90%;
  animation: framee-fade-in 0.3s ease;
}

.framee-msg-row.user {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.framee-msg-row.bot {
  align-self: flex-start;
}

.framee-msg-avatar {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--framee-primary) 0%, var(--framee-cyan) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #000;
  font-size: 12px;
  font-weight: 800;
  flex-shrink: 0;
  margin-top: 2px;
}

.framee-msg-bubble {
  padding: 12px 16px;
  border-radius: 16px;
  font-size: 13.5px;
  line-height: 1.55;
  position: relative;
  word-wrap: break-word;
}

.framee-msg-row.bot .framee-msg-bubble {
  background: rgba(20, 28, 20, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: #E2E8F0;
  border-top-left-radius: 4px;
}

.framee-msg-row.user .framee-msg-bubble {
  background: linear-gradient(135deg, #8DC63F 0%, #97DE24 100%);
  color: #050805;
  font-weight: 500;
  border-top-right-radius: 4px;
  box-shadow: 0 4px 15px rgba(141, 198, 63, 0.3);
}

.framee-msg-time {
  font-size: 10px;
  color: rgba(255, 255, 255, 0.4);
  margin-top: 4px;
  display: block;
}

.framee-msg-row.user .framee-msg-time {
  color: rgba(0, 0, 0, 0.5);
  text-align: right;
}

/* Typing Indicator */
.framee-typing-bubble {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 12px 16px;
  background: rgba(20, 28, 20, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  border-top-left-radius: 4px;
  width: fit-content;
}

.framee-typing-dot {
  width: 7px;
  height: 7px;
  background: var(--framee-primary);
  border-radius: 50%;
  animation: framee-bounce 1.4s infinite ease-in-out both;
}

.framee-typing-dot:nth-child(1) { animation-delay: -0.32s; }
.framee-typing-dot:nth-child(2) { animation-delay: -0.16s; }

/* Quick Action Chips */
.framee-chips-container {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.framee-chip {
  background: rgba(141, 198, 63, 0.1);
  border: 1px solid rgba(141, 198, 63, 0.3);
  color: var(--framee-primary);
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.framee-chip:hover {
  background: var(--framee-primary);
  color: #050805;
  border-color: var(--framee-primary);
  box-shadow: 0 0 12px var(--framee-primary-glow);
  transform: translateY(-1px);
}

/* Interactive Cards inside Chat */
.framee-card-widget {
  background: rgba(14, 22, 14, 0.95);
  border: 1px solid var(--framee-border);
  border-radius: 14px;
  padding: 14px;
  margin-top: 10px;
  width: 100%;
}

.framee-card-header {
  font-family: var(--framee-font-heading);
  font-size: 13.5px;
  font-weight: 700;
  color: var(--framee-primary);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.framee-btn-primary {
  background: linear-gradient(135deg, #8DC63F 0%, #97DE24 100%);
  color: #050805;
  font-weight: 700;
  font-size: 12px;
  padding: 8px 14px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
  text-decoration: none;
}

.framee-btn-primary:hover {
  box-shadow: 0 0 15px var(--framee-primary-glow);
  transform: translateY(-1px);
}

.framee-form-group {
  margin-bottom: 10px;
}

.framee-form-group label {
  display: block;
  font-size: 11px;
  color: var(--framee-text-muted);
  margin-bottom: 4px;
}

.framee-input-field {
  width: 100%;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  padding: 8px 10px;
  color: #FFF;
  font-size: 12px;
  outline: none;
  font-family: var(--framee-font);
}

.framee-input-field:focus {
  border-color: var(--framee-primary);
}

/* Project Estimator Widget */
.framee-estimator-slider {
  width: 100%;
  accent-color: var(--framee-primary);
  margin: 8px 0;
}

.framee-estimate-val {
  font-size: 18px;
  font-weight: 800;
  color: var(--framee-primary);
  font-family: var(--framee-font-heading);
}

/* Footer / Input Area */
.framee-chat-footer {
  padding: 14px 16px;
  background: rgba(10, 15, 10, 0.98);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.framee-input-container {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(20, 30, 20, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 16px;
  padding: 6px 8px 6px 14px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.framee-input-container:focus-within {
  border-color: var(--framee-primary);
  box-shadow: 0 0 15px rgba(151, 222, 36, 0.25);
}

.framee-input {
  flex: 1;
  background: transparent;
  border: none;
  color: #FFFFFF;
  font-size: 13px;
  font-family: var(--framee-font);
  outline: none;
  max-height: 80px;
  resize: none;
}

.framee-input::placeholder {
  color: #64748B;
}

.framee-mic-btn {
  background: transparent;
  border: none;
  color: var(--framee-text-muted);
  cursor: pointer;
  padding: 6px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.framee-mic-btn:hover {
  color: var(--framee-cyan);
}

.framee-mic-btn.recording {
  color: #EF4444;
  animation: framee-pulse-red 1s infinite;
}

.framee-send-btn {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  background: linear-gradient(135deg, #8DC63F 0%, #97DE24 100%);
  border: none;
  color: #050805;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.framee-send-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 0 12px var(--framee-primary-glow);
}

.framee-send-btn svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: #050805;
  stroke-width: 2.5;
}

.framee-footer-powered {
  text-align: center;
  font-size: 10px;
  color: #475569;
  margin-top: 8px;
}

.framee-footer-powered span {
  color: var(--framee-primary);
  font-weight: 600;
}

/* API Settings Modal inside Chat */
.framee-settings-panel {
  position: absolute;
  top: 60px;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(8, 12, 8, 0.98);
  backdrop-filter: blur(20px);
  z-index: 10;
  padding: 20px;
  display: none;
  flex-direction: column;
  animation: framee-fade-in 0.25s ease;
}

.framee-settings-panel.active {
  display: flex;
}

.framee-settings-header {
  font-family: var(--framee-font-heading);
  font-size: 16px;
  color: #FFF;
  font-weight: 700;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* ANIMATIONS */
@keyframes framee-slide-up {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes framee-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes framee-ping {
  75%, 100% {
    transform: scale(1.4);
    opacity: 0;
  }
}

@keyframes framee-bounce {
  0%, 80%, 100% { transform: scale(0); }
  40% { transform: scale(1.0); }
}

@keyframes framee-pulse-red {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.15); opacity: 0.7; }
}

/* RESPONSIVE */
@media (max-width: 480px) {
  .framee-chat-window {
    right: 12px;
    left: 12px;
    bottom: 84px;
    width: auto;
    height: calc(100vh - 100px);
  }
  .framee-launcher-wrapper {
    right: 16px;
    bottom: 16px;
  }
}
