/* ==========================================================================
   FELEROUS AI Destek - Antigravity OS Masaüstü, Yüzen & Mobil Tasarım Sistemi
   ========================================================================== */

:root,
#fel-chat-container,
#fel-chat-launcher {
  --fel-primary: #9333ea;
  --fel-primary-glow: rgba(147, 51, 234, 0.45);
  --fel-cyan: #06b6d4;
  --fel-cyan-glow: rgba(6, 182, 212, 0.4);
  --fel-bg-glass: rgba(11, 14, 24, 0.95);
  --fel-card-glass: rgba(20, 25, 42, 0.78);
  --fel-border-glass: rgba(255, 255, 255, 0.12);
  --fel-border-glow: rgba(147, 51, 234, 0.35);
  --fel-text-main: #f3f4f6;
  --fel-text-muted: #9ca3af;
  --fel-online-green: #10b981;
}

/* Floating Launcher */
#fel-chat-launcher {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: linear-gradient(135deg, #7c3aed, #06b6d4);
  box-shadow: 0 8px 24px var(--fel-primary-glow), 0 0 16px var(--fel-cyan-glow);
  cursor: pointer;
  z-index: 999998;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  border: 1px solid rgba(255, 255, 255, 0.25);
  outline: none;
  padding: 0;
}

#fel-chat-launcher:hover {
  transform: scale(1.08) rotate(5deg);
  box-shadow: 0 12px 32px var(--fel-primary-glow), 0 0 24px var(--fel-cyan-glow);
}

#fel-chat-launcher svg {
  width: 28px;
  height: 28px;
  fill: #ffffff;
}

#fel-chat-launcher .fel-unread-dot {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 14px;
  height: 14px;
  background-color: #ef4444;
  border: 2px solid #0f172a;
  border-radius: 50%;
  box-shadow: 0 0 8px #ef4444;
}

/* Ana Konteyner (Varsayılan Yüzen Mod) */
#fel-chat-container {
  position: fixed;
  bottom: 94px;
  right: 24px;
  width: 450px;
  max-width: calc(100vw - 32px);
  height: 640px;
  max-height: calc(100vh - 116px);
  max-height: calc(100dvh - 116px);
  background: var(--fel-bg-glass);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid var(--fel-border-glass);
  border-radius: 20px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.78), 0 0 30px var(--fel-border-glow);
  z-index: 999999;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
  transform: translateY(20px) scale(0.96);
  transition: opacity 0.28s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.28s cubic-bezier(0.16, 1, 0.3, 1);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: var(--fel-text-main);
  box-sizing: border-box;
}

#fel-chat-container *,
#fel-chat-container *::before,
#fel-chat-container *::after {
  box-sizing: border-box;
}

#fel-chat-container.fel-open {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}

/* ==========================================================================
   ANTIGRAVITY MASAÜSTÜ & TAM EKRAN MODU
   ========================================================================== */
#fel-chat-container.fel-fullscreen {
  top: 0 !important;
  left: 0 !important;
  bottom: 0 !important;
  right: 0 !important;
  width: 100vw !important;
  max-width: 100vw !important;
  height: 100vh !important;
  height: 100dvh !important;
  max-height: 100vh !important;
  max-height: 100dvh !important;
  border-radius: 0 !important;
  border: none !important;
}

/* Header */
.fel-chat-header {
  padding: 13px 18px;
  background: linear-gradient(180deg, rgba(28, 23, 48, 0.94), rgba(13, 16, 28, 0.78));
  border-bottom: 1px solid var(--fel-border-glass);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  z-index: 70;
}

.fel-header-profile {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.fel-avatar-wrapper {
  position: relative;
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  border-radius: 10px;
  background: linear-gradient(135deg, #9333ea, #06b6d4);
  padding: 2px;
}

.fel-avatar-img {
  width: 100%;
  height: 100%;
  border-radius: 8px;
  background-color: #0b0f19;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  color: #38bdf8;
  font-size: 16px;
}

.fel-avatar-status {
  position: absolute;
  bottom: -2px;
  right: -2px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background-color: var(--fel-online-green);
  border: 2px solid #0f172a;
  box-shadow: 0 0 6px var(--fel-online-green);
}

.fel-header-text {
  min-width: 0;
}

.fel-header-text h3 {
  margin: 0;
  font-size: 13.5px;
  font-weight: 700;
  letter-spacing: 0.4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  background: linear-gradient(90deg, #f3f4f6, #38bdf8);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.fel-header-text p {
  margin: 2px 0 0 0;
  font-size: 11px;
  color: var(--fel-text-muted);
}

.fel-header-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.fel-header-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--fel-text-muted);
  cursor: pointer;
  padding: 6px 8px;
  border-radius: 8px;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.fel-header-btn:hover {
  background: rgba(255, 255, 255, 0.15);
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.2);
}

/* Layout: Gövde */
.fel-desktop-layout {
  display: flex;
  flex: 1;
  overflow: hidden;
  position: relative;
}

/* Yüzen & Mobil Mod Çekmece Karartması */
.fel-drawer-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(4, 6, 12, 0.65);
  backdrop-filter: blur(3px);
  z-index: 55;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.28s ease;
}

/* Varsayılan (Yüzen 450px Pencere & Mobil): Kayar Katman (Overlay Drawer) */
.fel-sidebar {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: min(305px, 86%);
  background: rgba(7, 10, 18, 0.98);
  border-right: 1px solid var(--fel-border-glass);
  padding: 18px 14px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  overflow-y: auto;
  transform: translateX(0);
  transition: transform 0.32s cubic-bezier(0.16, 1, 0.3, 1),
              margin-left 0.32s cubic-bezier(0.16, 1, 0.3, 1),
              opacity 0.25s ease;
  box-shadow: 12px 0 32px rgba(0, 0, 0, 0.65);
  z-index: 60;
}

#fel-chat-container:not(.fel-drawer-closed) .fel-drawer-backdrop {
  opacity: 1;
  pointer-events: auto;
}

#fel-chat-container.fel-drawer-closed .fel-sidebar {
  transform: translateX(-105%);
  opacity: 0;
  pointer-events: none;
}

/* Masaüstü Tam Ekran (> 860px): Yan Yana Bölünmüş Antigravity Paneli */
@media (min-width: 861px) {
  #fel-chat-container.fel-fullscreen .fel-sidebar {
    position: relative;
    width: 320px;
    min-width: 320px;
    transform: none;
  }

  #fel-chat-container.fel-fullscreen .fel-drawer-backdrop {
    display: none !important;
  }

  #fel-chat-container.fel-fullscreen.fel-drawer-closed .fel-sidebar {
    margin-left: -320px !important;
    transform: none;
    opacity: 0;
    pointer-events: none;
  }
}

.fel-sidebar::-webkit-scrollbar {
  width: 4px;
}

.fel-sidebar::-webkit-scrollbar-thumb {
  background: rgba(147, 51, 234, 0.35);
  border-radius: 4px;
}

/* Çekmece Aç/Kapa Buton Durumu */
.fel-drawer-btn {
  margin-right: 2px;
  background: rgba(147, 51, 234, 0.22);
  border-color: rgba(147, 51, 234, 0.45);
  color: #c084fc;
}

.fel-drawer-btn.fel-btn-inactive {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.08);
  color: #9ca3af;
}

.fel-sidebar-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1px;
  color: #6b7280;
  display: block;
  margin-bottom: 8px;
}

.fel-sys-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.07);
  padding: 8px 12px;
  border-radius: 10px;
  font-size: 11px;
  color: #d1d5db;
  margin-bottom: 6px;
}

.fel-dot-green {
  width: 8px;
  height: 8px;
  flex-shrink: 0;
  border-radius: 50%;
  background-color: #10b981;
  box-shadow: 0 0 6px #10b981;
}

.fel-dot-blue {
  width: 8px;
  height: 8px;
  flex-shrink: 0;
  border-radius: 50%;
  background-color: #38bdf8;
  box-shadow: 0 0 6px #38bdf8;
}

.fel-dot-purple {
  width: 8px;
  height: 8px;
  flex-shrink: 0;
  border-radius: 50%;
  background-color: #a855f7;
  box-shadow: 0 0 6px #a855f7;
}

.fel-side-link {
  width: 100%;
  text-align: left;
  background: transparent;
  border: 1px solid transparent;
  color: #9ca3af;
  padding: 8px 11px;
  border-radius: 8px;
  font-size: 12.5px;
  line-height: 1.35;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 8px;
}

.fel-side-link:hover {
  background: rgba(147, 51, 234, 0.15);
  border-color: rgba(147, 51, 234, 0.3);
  color: #f3f4f6;
  transform: translateX(3px);
}

.fel-sidebar-footer {
  margin-top: auto;
  border-top: 1px solid var(--fel-border-glass);
  padding-top: 14px;
}

.fel-contact-card {
  display: block;
  background: rgba(88, 101, 242, 0.15);
  border: 1px solid rgba(88, 101, 242, 0.3);
  padding: 10px;
  border-radius: 10px;
  text-decoration: none;
  margin-bottom: 8px;
  transition: all 0.2s;
}

.fel-contact-card:hover {
  background: rgba(88, 101, 242, 0.25);
  border-color: #5865f2;
}

.fel-contact-name {
  color: #ffffff;
  font-size: 12px;
  font-weight: 600;
}

.fel-contact-id {
  color: #93c5fd;
  font-size: 10.5px;
  margin-top: 2px;
}

.fel-contact-mail {
  display: block;
  font-size: 11px;
  color: #9ca3af;
  text-decoration: none;
  padding: 4px 6px;
}

.fel-contact-mail:hover {
  color: #38bdf8;
}

/* Ana Sohbet Gövdesi */
.fel-main-chat {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  background: rgba(11, 14, 24, 0.6);
}

.fel-chat-body {
  flex: 1;
  overflow-y: auto;
  padding: 18px 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.fel-chat-body::-webkit-scrollbar {
  width: 6px;
}

.fel-chat-body::-webkit-scrollbar-track {
  background: rgba(5, 8, 16, 0.4);
}

.fel-chat-body::-webkit-scrollbar-thumb {
  background: rgba(147, 51, 234, 0.35);
  border-radius: 6px;
}

.fel-chat-body::-webkit-scrollbar-thumb:hover {
  background: rgba(147, 51, 234, 0.7);
}

#fel-chat-container.fel-fullscreen .fel-chat-body {
  max-width: 1400px;
  width: 96%;
  margin: 0 auto;
  transition: max-width 0.3s ease;
}

/* Quick Suggestion Chips */
.fel-chips-wrapper {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
}

.fel-chip {
  background: rgba(147, 51, 234, 0.15);
  border: 1px solid rgba(147, 51, 234, 0.35);
  color: #c084fc;
  font-size: 12px;
  padding: 8px 12px;
  border-radius: 14px;
  cursor: pointer;
  transition: all 0.2s;
}

.fel-chip:hover {
  background: rgba(147, 51, 234, 0.35);
  color: #ffffff;
  border-color: #a855f7;
  transform: translateY(-1px);
}

/* Messages */
.fel-msg {
  position: relative;
  max-width: 88%;
  padding: 12px 16px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.62;
  word-break: break-word;
  animation: felFadeIn 0.22s ease-out;
}

.fel-msg-content {
  padding-right: 20px;
}

.fel-md-heading {
  display: block;
  color: #38bdf8;
  font-size: 14.5px;
  margin: 6px 0 2px;
}

.fel-msg-copy-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.55);
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 6px;
  opacity: 0;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.fel-msg:hover .fel-msg-copy-btn {
  opacity: 1;
}

.fel-msg-copy-btn:hover {
  background: rgba(255, 255, 255, 0.15);
  color: #38bdf8;
  border-color: rgba(56, 189, 248, 0.4);
}

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

.fel-msg-user {
  align-self: flex-end;
  background: linear-gradient(135deg, #7c3aed, #4f46e5);
  color: #ffffff;
  border-bottom-right-radius: 4px;
  box-shadow: 0 4px 16px rgba(124, 58, 237, 0.3);
}

.fel-msg-bot {
  align-self: flex-start;
  background: var(--fel-card-glass);
  color: var(--fel-text-main);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-bottom-left-radius: 4px;
}

.fel-msg-bot a {
  color: #38bdf8;
  text-decoration: underline;
}

/* Satır içi kod rozetleri (`manifest.json` vb.) */
.fel-msg-bot .fel-inline-code {
  display: inline;
  font-family: Consolas, Monaco, "Courier New", monospace;
  font-size: 12.5px;
  padding: 2px 6px;
  border-radius: 5px;
  background: rgba(56, 189, 248, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.22);
  color: #7dd3fc;
}

/* İnteraktif Aksiyon Butonları (Zero-Emoji Minimalist Terminal) */
.fel-chat-root .fel-action-buttons,
.fel-action-buttons {
  display: flex !important;
  flex-wrap: wrap !important;
  gap: 8px !important;
  margin-top: 14px !important;
  padding-top: 12px !important;
  border-top: 1px solid rgba(255, 255, 255, 0.1) !important;
}

.fel-chat-root .fel-action-btn,
.fel-action-btn {
  background: rgba(56, 189, 248, 0.08) !important;
  border: 1px solid rgba(56, 189, 248, 0.3) !important;
  color: #38bdf8 !important;
  font-family: inherit !important;
  font-size: 12px !important;
  font-weight: 500 !important;
  padding: 7px 12px !important;
  border-radius: 8px !important;
  cursor: pointer !important;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1) !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 6px !important;
  user-select: none !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25) !important;
  outline: none !important;
}

.fel-chat-root .fel-action-btn:hover,
.fel-action-btn:hover {
  background: rgba(56, 189, 248, 0.22) !important;
  border-color: #38bdf8 !important;
  color: #ffffff !important;
  transform: translateY(-1px) !important;
  box-shadow: 0 4px 14px rgba(56, 189, 248, 0.3) !important;
}

.fel-chat-root .fel-action-btn:active,
.fel-action-btn:active {
  transform: translateY(0) !important;
}

.fel-btn-arrow {
  color: #38bdf8 !important;
  font-weight: bold !important;
}

/* Kod Blokları & Command Tepsisi */
.fel-msg-bot pre {
  background: #070a12;
  border-radius: 12px;
  border: 1px solid rgba(56, 189, 248, 0.25);
  margin: 12px 0;
  overflow: hidden;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45), 0 0 15px rgba(56, 189, 248, 0.08);
}

.fel-code-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 14px;
  background: rgba(15, 23, 42, 0.92);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.fel-code-dots {
  display: flex;
  align-items: center;
  gap: 6px;
}

.fel-c-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  display: inline-block;
}

.fel-c-dot.d-red { background: #ef4444; box-shadow: 0 0 6px rgba(239, 68, 68, 0.4); }
.fel-c-dot.d-yellow { background: #f59e0b; box-shadow: 0 0 6px rgba(245, 158, 11, 0.4); }
.fel-c-dot.d-green { background: #10b981; box-shadow: 0 0 6px rgba(16, 185, 129, 0.4); }

.fel-code-lang {
  margin-left: 10px;
  font-family: Consolas, monospace;
  font-weight: 700;
  color: #38bdf8;
  font-size: 11px;
  letter-spacing: 0.8px;
}

.fel-copy-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #e2e8f0;
  font-size: 11px;
  padding: 4px 10px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
  font-weight: 600;
}

.fel-copy-btn:hover {
  background: rgba(56, 189, 248, 0.2);
  border-color: #38bdf8;
  color: #ffffff;
}

.fel-msg-bot pre code {
  font-family: Consolas, Monaco, "Courier New", monospace;
  padding: 14px 16px;
  display: block;
  white-space: pre;
  overflow-x: auto;
  font-size: 13px;
  color: #e2e8f0;
  line-height: 1.58;
}

/* Typing Indicator */
.fel-typing {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 12px 18px;
  background: var(--fel-card-glass);
  border-radius: 16px;
  width: fit-content;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.fel-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background-color: #38bdf8;
  animation: felBounce 1.4s infinite ease-in-out both;
}

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

@keyframes felBounce {
  0%, 80%, 100% { transform: scale(0); opacity: 0.4; }
  40% { transform: scale(1); opacity: 1; }
}

/* Chat Footer / Input Dock */
.fel-chat-footer {
  padding: 12px 18px;
  background: rgba(13, 16, 28, 0.92);
  border-top: 1px solid var(--fel-border-glass);
  flex-shrink: 0;
}

#fel-chat-container.fel-fullscreen .fel-chat-footer {
  max-width: 1400px;
  width: 96%;
  margin: 0 auto;
  border-top: none;
  padding: 14px 20px 22px;
  transition: max-width 0.3s ease;
}

.fel-input-row {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 16px;
  padding: 8px 12px 8px 14px;
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}

.fel-input-row:focus-within {
  border-color: #a855f7;
  box-shadow: 0 0 16px rgba(168, 85, 247, 0.3);
  background: rgba(255, 255, 255, 0.08);
}

.fel-prompt-symbol {
  font-family: Consolas, monospace;
  font-weight: 700;
  color: #38bdf8;
  font-size: 14px;
  height: 34px;
  display: flex;
  align-items: center;
  flex-shrink: 0;
  user-select: none;
}

#fel-input-field {
  box-sizing: border-box;
  flex: 1;
  min-width: 0;
  background: transparent;
  border: none;
  outline: none;
  color: #ffffff;
  font-family: inherit;
  font-size: 14px;
  line-height: 22px;
  resize: none;
  height: 34px;
  min-height: 34px;
  max-height: 144px;
  padding: 6px 0;
  margin: 0;
  overflow-y: hidden;
  overflow-x: hidden;
  white-space: pre-wrap;
  word-wrap: break-word;
  overflow-wrap: anywhere;
}

#fel-input-field::-webkit-scrollbar {
  width: 4px;
}

#fel-input-field::-webkit-scrollbar-thumb {
  background: rgba(168, 85, 247, 0.45);
  border-radius: 4px;
}

#fel-input-field::placeholder {
  color: #6b7280;
}

#fel-send-btn {
  background: linear-gradient(135deg, #7c3aed, #06b6d4);
  border: none;
  border-radius: 10px;
  width: 34px;
  height: 34px;
  flex-shrink: 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s;
  padding: 0;
}

#fel-send-btn:hover {
  transform: scale(1.06);
}

#fel-send-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

#fel-send-btn svg {
  width: 16px;
  height: 16px;
  fill: #ffffff;
}

.fel-footer-subtext {
  text-align: center;
  font-size: 11px;
  color: #6b7280;
  margin-top: 7px;
}

/* Mobil Küçük Ekran İyileştirmeleri */
@media (max-width: 540px) {
  #fel-chat-launcher {
    bottom: 16px;
    right: 16px;
    width: 52px;
    height: 52px;
  }

  #fel-chat-container:not(.fel-fullscreen) {
    right: 12px;
    left: 12px;
    bottom: 78px;
    width: auto;
    max-width: none;
    height: calc(100dvh - 96px);
  }

  .fel-msg {
    max-width: 93%;
    font-size: 13.5px;
  }
}
