/* ==========================================================================
   Slide 1: 3D AI Brain Canvas, Azile Interactive Chat & Logic Panel
   ========================================================================== */

/* 1. 3D Yapay Zekâ Beyni (Arka Planda Sabit Hızla Döner) */
.brain-stage {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  user-select: none;
  cursor: default;
}

.ai-brain-canvas {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 100%;
  height: 100%;
  display: block;
  opacity: 0;
  transition: opacity 2s cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: none;
}

.ai-brain-canvas.visible {
  opacity: 1;
}

/* 2. Etkileşimli Yapay Zekâ Sohbet Bölümü (Koyu Gri Zemin & Oval Tasarım) */
.chat-stage {
  position: absolute;
  top: 4.2rem;
  bottom: 11.2rem;
  left: 0;
  right: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 1.5rem;
  pointer-events: none;
  opacity: 0;
  transition: opacity 2s cubic-bezier(0.16, 1, 0.3, 1);
}

.chat-stage.visible {
  opacity: 1;
  pointer-events: auto;
}

.chat-card {
  width: clamp(22rem, 42vw, 38rem);
  max-width: 92vw;
  max-height: 100%;
  margin: auto;
  background: rgba(26, 27, 32, 0.92);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 0.95rem;
  box-shadow: 0 16px 45px rgba(0, 0, 0, 0.85), 0 0 25px rgba(56, 189, 248, 0.08);
  display: flex;
  flex-direction: column;
  overflow: visible;
  position: relative;
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.chat-card:hover {
  border-color: rgba(255, 255, 255, 0.32);
}

.chat-card.expanded {
  border-radius: 0.95rem;
  border-color: rgba(255, 255, 255, 0.28);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.92), 0 0 40px rgba(56, 189, 248, 0.12);
  overflow: visible;
}

/* Mesajlar Bölümü */
.chat-messages {
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  border-top-left-radius: 0.95rem;
  border-top-right-radius: 0.95rem;
  padding: 0 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  scroll-behavior: smooth;
  transition: 
    max-height 0.5s cubic-bezier(0.16, 1, 0.3, 1),
    opacity 0.35s ease 0.1s,
    padding 0.4s ease;
}

.chat-card.expanded .chat-messages {
  max-height: clamp(7rem, 24vh, 16rem);
  opacity: 1;
  overflow-y: auto;
  padding: 0.95rem 1.15rem 0.45rem 1.15rem;
}

.chat-messages::-webkit-scrollbar {
  width: 4px;
}
.chat-messages::-webkit-scrollbar-track {
  background: transparent;
}
.chat-messages::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 9999px;
}
.chat-messages::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.4);
}

.chat-msg {
  display: flex;
  max-width: 84%;
  animation: msgAppear 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

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

.chat-msg-user {
  align-self: flex-end;
}

.chat-msg-user .msg-bubble {
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.35);
  color: #ffffff;
  padding: 0.7rem 1.1rem;
  font-size: 0.9rem;
  line-height: 1.45;
  border-radius: 1.25rem 1.25rem 0.25rem 1.25rem;
}

.chat-msg-ai {
  align-self: flex-start;
  max-width: 100%;
  width: 100%;
}

.chat-msg-ai .msg-bubble {
  background: transparent;
  border: none;
  color: rgba(255, 255, 255, 0.95);
  padding: 0.35rem 0.2rem;
  font-size: 0.93rem;
  line-height: 1.55;
  border-radius: 0;
  box-shadow: none;
}

.eliza-link {
  color: #38bdf8;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
  display: inline-flex;
  align-items: center;
  gap: 0.18rem;
  transition: color 0.18s ease, text-decoration-color 0.18s ease;
  cursor: pointer;
}

.eliza-link:hover {
  color: #7dd3fc;
  text-decoration-color: #7dd3fc;
}

.eliza-arrow-icon {
  display: inline-block;
  vertical-align: middle;
  transition: transform 0.18s ease;
  pointer-events: none;
}

.eliza-link:hover .eliza-arrow-icon {
  transform: translate(1.5px, -1.5px);
}

.azile-followup {
  color: #38bdf8;
  font-weight: inherit;
  cursor: pointer;
  letter-spacing: 0.01em;
  transition: color 0.18s ease, text-decoration 0.18s ease;
}

.azile-followup:hover {
  color: #7dd3fc;
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* Mesaj Gönderme Giriş Satırı (Oval Tasarım) */
.chat-input-row {
  padding: 0.45rem 0.55rem;
  display: flex;
  gap: 0.6rem;
  align-items: center;
  background: transparent;
  border-radius: 0.95rem;
  transition: padding 0.3s ease, border-top 0.3s ease, background-color 0.3s ease;
}

.chat-card.expanded .chat-input-row {
  padding: 0.75rem 1rem;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(18, 19, 23, 0.65);
  border-radius: 0 0 0.95rem 0.95rem;
}

.chat-input {
  flex: 1;
  background: transparent;
  border: none;
  color: #ffffff;
  padding: 0.75rem 1.1rem;
  font-family: inherit;
  font-size: 0.95rem;
  border-radius: 0.65rem;
  outline: none;
}

.chat-input::placeholder {
  color: rgba(255, 255, 255, 0.42);
  font-size: 0.92rem;
}

.chat-send-btn {
  background: #ffffff;
  color: #000000;
  border: none;
  border-radius: 0.65rem;
  width: 2.75rem;
  height: 2.75rem;
  padding: 0;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  user-select: none;
  position: relative;
  flex-shrink: 0;
}

.chat-send-btn:hover {
  background: #ffffff;
  color: #000000;
  transform: none;
  box-shadow: none;
}

.chat-send-btn:active {
  transform: scale(0.96);
}

.send-arrow-icon {
  width: 1.15rem;
  height: 1.15rem;
  stroke: #000000;
  stroke-width: 2.4;
  display: block;
}

/* Üzerinde Gönder Yazan Küçük Dikdörtgen Tooltip */
.send-tooltip {
  position: absolute;
  bottom: calc(100% + 7px);
  left: 50%;
  transform: translateX(-50%) translateY(3px);
  background: #000000;
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 0;
  padding: 0.22rem 0.52rem;
  font-family: inherit;
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.18s ease, transform 0.18s ease, visibility 0.18s ease;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.75);
  z-index: 70;
}

.chat-send-btn:hover .send-tooltip,
.chat-send-btn:focus-visible .send-tooltip {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}

/* Alt Bölüm: Siyah Zemin & Beyaz Stroke Python Kod Kutusu */
.algo-panel {
  position: fixed;
  bottom: 2.2rem;
  left: 50%;
  transform: translateX(-50%) translateY(10px);
  z-index: 40;
  width: max-content;
  max-width: min(50rem, calc(100vw - 6.8rem));
  background-color: #000000;
  border: 1px solid #ffffff;
  border-radius: 0;
  padding: 0.65rem 1.25rem;
  color: #ffffff;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.95);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.6s cubic-bezier(0.16, 1, 0.3, 1), transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
  user-select: text;
  box-sizing: border-box;
}

.algo-panel.visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(-50%) translateY(0);
}

.algo-panel-header {
  display: flex;
  justify-content: flex-start;
  align-items: center;
  margin-bottom: 0.35rem;
}

.algo-panel-disclaimer {
  font-size: 0.5rem;
  font-weight: 300;
  font-style: italic;
  line-height: 1.35;
  color: rgba(255, 255, 255, 0.42);
  letter-spacing: 0.02em;
  user-select: none;
  text-align: left;
}

.code-snippet-box {
  margin: 0;
  padding: 0;
  font-family: 'SF Mono', Menlo, Monaco, Consolas, 'Courier New', monospace;
  font-size: clamp(0.72rem, 0.9vw, 0.88rem);
  line-height: 1.5;
  color: #ffffff;
  white-space: pre-wrap;
  word-break: break-word;
  overflow-wrap: anywhere;
  tab-size: 4;
}

.code-line {
  min-height: 1.5em;
  display: block;
  white-space: pre-wrap;
  word-break: break-word;
  overflow-wrap: anywhere;
}

.code-snippet-box .code-kw {
  color: #38bdf8;
  font-weight: 600;
}

.code-snippet-box .code-str {
  color: #ffffff;
  opacity: 0.95;
}

@media (max-width: 640px) {
  .chat-stage {
    top: 3.2rem;
    bottom: 11.8rem;
    padding: 0 0.65rem;
  }
  .chat-card {
    width: 95vw;
    max-width: 95vw;
  }
  .chat-card.expanded .chat-messages {
    max-height: clamp(5rem, 20vh, 12rem);
    padding: 0.7rem 0.85rem 0.35rem;
    gap: 0.6rem;
  }
  .chat-msg-user .msg-bubble {
    font-size: 0.82rem;
    padding: 0.5rem 0.8rem;
  }
  .chat-msg-ai .msg-bubble {
    font-size: 0.85rem;
    padding: 0.2rem 0.1rem;
  }
  .chat-input-row {
    padding: 0.3rem 0.4rem;
  }
  .chat-card.expanded .chat-input-row {
    padding: 0.5rem 0.65rem;
  }
  .chat-input {
    font-size: 0.85rem;
    padding: 0.55rem 0.8rem;
  }
  .chat-send-btn {
    width: 2.35rem;
    height: 2.35rem;
    padding: 0;
  }
  .algo-panel {
    bottom: 3.6rem; /* Cleanly above the 3.2rem top of bottom widgets */
    padding: 0.5rem 0.85rem;
    max-width: calc(100vw - 1.6rem);
  }
  .code-snippet-box {
    font-size: 0.65rem;
    line-height: 1.4;
  }
}

@media (max-height: 720px) {
  .chat-stage {
    top: 3.4rem;
    bottom: 9.5rem;
  }
  .chat-card.expanded .chat-messages {
    max-height: clamp(5rem, 20vh, 11rem);
  }
  .algo-panel {
    bottom: 1.8rem;
    padding: 0.5rem 1rem;
  }
}

