@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&display=swap');

:root {
  --bg: #0b0c10;
  --panel: #0f1115;
  --card: #11141a;
  --muted: #9aa0a6;
  --text: #e8eaed;

  --accent: #8b5cf6;
  /* tema rengi (tören) */
  --accent-2: #60a5fa;

  --bubble-user: #1f2937;
  --bubble-ai: #111827;

  --border: #21242b;
  --shadow: 0 10px 30px rgba(0, 0, 0, .35);

  /* Glow (duyguya göre JS ayarlıyor) */
  --glow-color: 139, 92, 246;
  /* RGB */
  --glow-min: 0.16;
  --glow-max: 0.30;

  /* Parlama kontrolü */
  --halo-strength: .36;
  /* genel parlaklık (0.2–.5 arası) */
  --halo-spread: 16px;
  /* taşma miktarı */
  --halo-blur: 22px;
  /* yumuşaklık */

  /* Buton & kart */
  --radius: 14px;
  --btn-h: 42px;
}

* {
  box-sizing: border-box
}

html,
body {
  height: 100%;
  overflow: hidden
}

body {
  margin: 0;
  color: var(--text);
  font: 16px/1.55 ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial;
  background:
    radial-gradient(1200px 600px at -10% -10%, rgba(139, 92, 246, .14), transparent 60%),
    radial-gradient(1000px 500px at 110% 10%, rgba(96, 165, 250, .12), transparent 55%),
    var(--bg);
}

/* --- Layout --- */
.app {
  display: grid;
  grid-template-columns: 300px 1fr;
  grid-template-rows: auto 1fr;
  grid-template-areas:
    "rail toolbar"
    "rail stage";
  height: 100vh;
  overflow: hidden;
}

.rail {
  grid-area: rail;
  padding: 18px;
  border-right: 1px solid var(--border);
  background: rgba(0, 0, 0, .06);
  overflow-y: auto;
}

.toolbar {
  grid-area: toolbar;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  backdrop-filter: saturate(140%) blur(6px);
  background: rgba(15, 17, 21, .7);
  z-index: 5;
}

.content {
  display: contents;
}

.stage {
  grid-area: stage;
  display: flex;
  align-items: stretch;
  justify-content: center;
  padding: 22px;
  overflow: hidden;
  min-height: 0;
}


/* --- Kartlar & form öğeleri --- */
.card {
  background: linear-gradient(180deg, rgba(255, 255, 255, .02), rgba(255, 255, 255, 0) 40%), var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.card .body {
  padding: 16px
}

.input,
select,
textarea {
  width: 100%;
  background: #0d1016;
  color: var(--text);
  border: 1px solid var(--border);
  padding: 10px 12px;
  border-radius: var(--radius);
  outline: none;
}

select {
  appearance: none
}

.row {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap
}

.badge {
  font-size: 12px;
  border: 1px solid var(--border);
  background: #0d1016;
  border-radius: 10px;
  padding: 4px 8px;
  color: #cbd5e1
}

/* --- Sol ray: marka + avatar + puan --- */
.brandBox {
  display: flex;
  align-items: center;
  gap: 12px
}

.logo {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: conic-gradient(from 180deg, var(--accent), var(--accent-2));
  box-shadow: 0 8px 28px rgba(0, 0, 0, .35);
}

.title {
  font-weight: 700;
  letter-spacing: .3px
}

.avatarBox {
  margin-top: 14px;
  display: grid;
  grid-template-columns: 64px 1fr;
  gap: 12px;
  align-items: center
}

#avatarPreview {
  width: 64px;
  height: 64px;
  border-radius: 12px;
  object-fit: cover;
  background: #0d1016;
  border: 1px solid var(--border);
}

.upload {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.upload input[type="file"] {
  display: none
}

.upload label {
  border: 1px dashed var(--border);
  padding: 8px 10px;
  border-radius: 10px;
  cursor: pointer;
  color: #cbd5e1;
  font-size: 13px;
}

.score {
  margin-top: 14px;
  background: rgba(0, 0, 0, .15);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
}

.score .label {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 13px
}

.meter {
  height: 12px;
  margin-top: 8px;
  border-radius: 999px;
  overflow: hidden;
  background: #0d1016;
  border: 1px solid var(--border);
}

.meter>span {
  display: block;
  height: 100%;
  width: 30%;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
}

.meter.low>span {
  background: linear-gradient(90deg, #ef4444, #f97316)
}

.meter.mid>span {
  background: linear-gradient(90deg, #60a5fa, #8b5cf6)
}

.meter.high>span {
  background: linear-gradient(90deg, #10b981, #60a5fa)
}

/* --- Sağ üst: menüler --- */
.btn {
  appearance: none;
  border: 1px solid var(--border);
  background: #151923;
  color: var(--text);
  height: var(--btn-h);
  padding: 0 14px;
  border-radius: 12px;
  cursor: pointer;
  transition: all .15s ease;
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, .25)
}

.btn.primary {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-2) 100%);
  border-color: transparent;
}

.menu {
  position: relative
}

.menu-btn {
  min-width: 110px
}

.menu-pop {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  min-width: 190px;
  background: #0f1218;
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 6px;
  display: none;
}

.menu-pop a,
.menu-pop button {
  display: flex;
  width: 100%;
  text-align: left;
  border: none;
  background: transparent;
  color: var(--text);
  padding: 10px 10px;
  border-radius: 10px;
  cursor: pointer;
}

.menu-pop a:hover,
.menu-pop button:hover {
  background: #121722
}

.menu.open .menu-pop {
  display: block
}

/* --- Sohbet --- */
.chat-box {
  width: 100%;
  max-width: 880px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  height: 100%;
  overflow: visible;
  position: relative;
}

.messages {
  padding: 24px 16px 24px 48px;
  overflow-y: auto;
  overflow-x: clip;
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex: 1;
  min-height: 0;
  margin-left: -36px;
  border: none;
  outline: none;
}

/* Scrollbar stilleri - tema uyumlu */
.messages::-webkit-scrollbar {
  width: 8px;
  background: transparent;
}

.messages::-webkit-scrollbar-track {
  background: transparent;
  border: none;
}

.messages::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, var(--accent), var(--accent-2));
  border-radius: 4px;
}

.messages::-webkit-scrollbar-thumb:hover {
  background: var(--accent);
}

.bubble {
  max-width: 78%;
  padding: 14px 16px;
  border-radius: 16px;
  position: relative;
  line-height: 1.6;
  word-wrap: break-word;
  white-space: pre-wrap;
  box-shadow: var(--shadow);
}

.bubble.user {
  margin-left: auto;
  background: var(--bubble-user);
  border: 1px solid #2b2f39
}

.bubble.ai {
  background: var(--bubble-ai);
  border: 1px solid #232329;
  outline: 1px solid rgba(255, 255, 255, .02)
}

/* —— 360° homojen halo — Tam kutu boyutu + yüksek parlaklık —— */
.bubble.ai.glow {
  position: relative;
}

/* ::before ile yapılan iç/dış gradyan kaldırıldı, sadece box-shadow kullanılacak */
.bubble.ai.glow::before {
  display: none;
}



/* Kontrast garanti */
.bubble {
  color: #e8eaed !important
}

.bubble.ai {
  background: #0e1117 !important;
  border: 1px solid #232329
}

.bubble.user {
  background: #1f2937 !important;
  border: 1px solid #2b2f39
}

.composer {
  display: flex;
  gap: 12px;
  align-items: flex-end;
  border-top: 1px solid var(--border);
  background: rgba(0, 0, 0, .08);
  padding: 16px;
  backdrop-filter: blur(10px);
}

textarea {
  flex: 1;
  resize: none;
  min-height: 80px;
  max-height: 180px;
  padding: 16px;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 15px;
  line-height: 1.5;
  border-radius: 12px;
  border: 2px solid rgba(139, 92, 246, 0.2);
  background: rgba(15, 17, 21, 0.6);
  color: #e8eaed;
  transition: all 0.3s ease;
}

textarea:focus {
  border-color: rgba(139, 92, 246, 0.5);
  background: rgba(15, 17, 21, 0.8);
  box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.1);
}

textarea::placeholder {
  color: rgba(232, 234, 237, 0.5);
}

.composer .actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.composer .btn {
  transform: translateY(1px);
  padding: 12px 20px;
  font-weight: 500;
  border-radius: 10px;
  transition: all 0.2s ease;
}

.composer .btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.composer .btn.primary {
  background: linear-gradient(135deg, #8b5cf6, #7c3aed);
  border: none;
  color: white;
}

.composer .btn.primary:hover {
  background: linear-gradient(135deg, #a78bfa, #8b5cf6);
}

/* textarea tabanına tam oturur */

/* --- Tema varyantları (törene göre) + glow rengi --- */
.theme-neutral {
  --accent: #64748b;
  --accent-2: #94a3b8;
  --glow-color: 100, 116, 139;
}

.theme-calm {
  --accent: #60a5fa;
  --accent-2: #38bdf8;
  --glow-color: 56, 189, 248;
}

.theme-joy {
  --accent: #f59e0b;
  --accent-2: #f97316;
  --glow-color: 245, 158, 11;
}

.theme-warm {
  --accent: #8b5cf6;
  --accent-2: #ec4899;
  --glow-color: 139, 92, 246;
}

/* Hareket hassasiyeti olan kullanıcılar için animasyonu yavaşlat */
@media (prefers-reduced-motion: reduce) {
  .bubble.ai.glow::before {
    animation-duration: 5s;
  }
}

/* — Premium mor degrade + cam efekti (senin önceki ayarların) — */
body {
  background: radial-gradient(circle at top left,
      rgba(140, 82, 255, 0.12),
      transparent 60%),
    radial-gradient(circle at bottom right,
      rgba(255, 105, 180, 0.12),
      transparent 60%),
    #1a1a1a;
  background-attachment: fixed;
}

/* Ek premium cam doku */
body.theme-warm {
  background:
    radial-gradient(1200px 600px at -10% -10%, rgba(147, 51, 234, 0.18), transparent 65%),
    radial-gradient(1000px 500px at 110% 110%, rgba(236, 72, 153, 0.14), transparent 60%),
    #0b0812;
  background-attachment: fixed;
  position: relative;
  overflow-x: hidden;
}

body.theme-warm::before {
  content: "";
  position: fixed;
  inset: -10vmax;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(120% 120% at 50% 50%, transparent 60%, rgba(0, 0, 0, 0.12) 85%, rgba(0, 0, 0, 0.22) 100%);
}

body.theme-warm::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: 0.04;
  background-image:
    radial-gradient(circle at 25% 20%, rgba(255, 255, 255, .35) 0.75px, transparent 0.75px),
    radial-gradient(circle at 75% 80%, rgba(255, 255, 255, .35) 0.75px, transparent 0.75px);
  background-size: 3px 3px;
}

.toolbar,
.card {
  background: linear-gradient(180deg, rgba(255, 255, 255, .05), rgba(255, 255, 255, .02) 40%), rgba(17, 17, 26, 0.28);
  backdrop-filter: blur(12px) saturate(130%);
  -webkit-backdrop-filter: blur(12px) saturate(130%);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 10px 30px rgba(0, 0, 0, .35), inset 0 1px 0 rgba(255, 255, 255, .06);
  position: relative;
  z-index: 1;
}

.toolbar::after,
.card::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background: linear-gradient(120deg, rgba(139, 92, 246, .18), rgba(236, 72, 153, .14));
  mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  padding: 1px;
  border-radius: inherit;
  opacity: .55;
}

/* ===========================
   TÖRENE GÖRE PREMIUM ARKA PLAN + CAM EFEKTİ
   (HTML/JS değiştirmeden, body.class ile çalışır)
   =========================== */

/* RGB tabanı: (rgba'da kullanacağız) */
:root {
  --accent-rgb: 139, 92, 246;
  /* warm default */
  --accent2-rgb: 236, 72, 153;
}

/* Her tema için RGB değerlerini tanımla */
.theme-warm {
  --accent-rgb: 139, 92, 246;
  --accent2-rgb: 236, 72, 153;
}

/* mor + pembe */
.theme-neutral {
  --accent-rgb: 100, 116, 139;
  --accent2-rgb: 148, 163, 184;
}

/* soğuk gri tonlar */
.theme-calm {
  --accent-rgb: 56, 189, 248;
  --accent2-rgb: 96, 165, 250;
}

/* mavi */
.theme-joy {
  --accent-rgb: 245, 158, 11;
  --accent2-rgb: 249, 115, 22;
}

/* amber / turuncu */

/* Premium degrade arka plan – her tema kendi tonlarında */
body.theme-warm {
  background:
    radial-gradient(1200px 600px at -12% -10%, rgba(var(--accent-rgb), .20), transparent 65%),
    radial-gradient(1100px 520px at 110% 110%, rgba(var(--accent2-rgb), .16), transparent 60%),
    #0b0812;
  background-attachment: fixed;
}

body.theme-neutral {
  background:
    radial-gradient(1200px 600px at -12% -10%, rgba(var(--accent-rgb), .20), transparent 65%),
    radial-gradient(1100px 520px at 110% 110%, rgba(var(--accent2-rgb), .14), transparent 60%),
    #0b0e12;
  background-attachment: fixed;
}

body.theme-calm {
  background:
    radial-gradient(1200px 600px at -12% -10%, rgba(var(--accent-rgb), .22), transparent 65%),
    radial-gradient(1100px 520px at 110% 110%, rgba(var(--accent2-rgb), .16), transparent 60%),
    #07121a;
  background-attachment: fixed;
}

body.theme-joy {
  background:
    radial-gradient(1200px 600px at -12% -10%, rgba(var(--accent-rgb), .22), transparent 65%),
    radial-gradient(1100px 520px at 110% 110%, rgba(var(--accent2-rgb), .16), transparent 60%),
    #140e06;
  background-attachment: fixed;
}

/* Cam (glass) efektini tema renklerine bağla */
.toolbar,
.card {
  background: linear-gradient(180deg, rgba(255, 255, 255, .05), rgba(255, 255, 255, .02) 40%), rgba(17, 17, 26, 0.28);
  backdrop-filter: blur(12px) saturate(130%);
  -webkit-backdrop-filter: blur(12px) saturate(130%);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 10px 30px rgba(0, 0, 0, .35), inset 0 1px 0 rgba(255, 255, 255, .06);
  position: relative;
  z-index: 1;
}

/* Cam kenarında tema rengine göre ışık yansıması */
.toolbar::after,
.card::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  /* tema rengine bağlı kenar ışıması */
  background: linear-gradient(120deg,
      rgba(var(--accent-rgb), .22),
      rgba(var(--accent2-rgb), .16));
  mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  padding: 1px;
  opacity: .55;
}

/* Balon glow’unu da tema rengine bağlayalım (mevcutta varsa override eder) */
.bubble.ai.glow {
  /* Box-shadow ile çok daha yumuşak geçiş */
  box-shadow:
    0 0 60px -10px rgba(var(--accent-rgb), 0.25),
    0 0 100px -20px rgba(var(--accent2-rgb), 0.15);
  animation: glowPulseTheme 3s ease-in-out infinite;
  /* Filter kaldırıldı */
  filter: none;
}

@keyframes glowPulseTheme {

  0%,
  100% {
    box-shadow:
      0 0 60px -15px rgba(var(--accent-rgb), 0.20),
      0 0 90px -25px rgba(var(--accent2-rgb), 0.10);
  }

  50% {
    box-shadow:
      0 0 80px -5px rgba(var(--accent-rgb), 0.35),
      0 0 120px -15px rgba(var(--accent2-rgb), 0.20);
  }
}

/* === Glow toggle control === */
.glow-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border: 1px solid var(--border);
  background: #151923;
  color: var(--text);
  border-radius: 10px;
  user-select: none;
  cursor: pointer;
}

.glow-toggle input {
  accent-color: var(--accent);
}

/* Glow KAPALI iken tüm halo/animasyonlar susturulsun */
body.glow-off .bubble.ai.glow::before,
body.glow-off .bubble.ai.glow::after {
  display: none !important;
  animation: none !important;
  opacity: 0 !important;
  box-shadow: none !important;
  filter: none !important;
}

/* === Toolbar hizalama düzeltmeleri (ekleme) === */
.toolbar {
  align-items: center;
  /* tüm öğeleri dikeyde orta hizala */
}

/* Parlama ve Sakin Müzik label'larını aynı çizgiye getir */
.music-toggle,
.glow-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  line-height: 1;
  /* metin yüksekliği tutarlı olsun */
}

.music-toggle input,
.glow-toggle input {
  margin: 0;
  vertical-align: middle;
  transform: translateY(0);
  /* olası piksel kaymalarını sıfırla */
}

/* Seçiciler ve butonla aynı hizada dursun */
.toolbar .input,
.toolbar .btn {
  align-self: center;
}

/* — Toggle chip'ler için yeknesak hizalama/ölçü — */
.music-toggle,
.glow-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;

  /* butonlarla aynı yükseklik ve iç boşluk */
  height: var(--btn-h);
  padding: 0 14px;

  /* butonla aynı görsel stil */
  border: 1px solid var(--border);
  background: #151923;
  color: var(--text);
  border-radius: 12px;

  /* ufak titreşimleri engelle */
  line-height: 1;
  vertical-align: middle;
}

/* kutucukları tam ortaya getir ve boyutu sabitle */
.music-toggle input[type="checkbox"],
.glow-toggle input[type="checkbox"] {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--accent);
}

/* metinler checkbox ile tam aynı hizaya gelsin */
.music-toggle span,
.glow-toggle span {
  display: inline-block;
  transform: translateY(0);
  /* olası 1px kaymaları önler */
}

.music-toggle span,
.glow-toggle span {
  transform: translateY(0);
}

/* === Toolbar hizalama & chip görünümü (EKLE) === */
.toolbar {
  align-items: center;
  /* dikeyde ortala (varsa tekrar yazmak sorun değil) */
}

/* İki toggle'ı da aynı "chip" yüksekliği ve padding ile hizala */
.toolbar .music-toggle,
.toolbar .glow-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: var(--btn-h);
  /* select ve butonlarla aynı yükseklik */
  padding: 0 12px;
  /* chip içi boşluk */
  border: 1px solid var(--border);
  background: #151923;
  color: var(--text);
  border-radius: 12px;
  line-height: 1;
  /* metin yüksekliğini sabitle */
}

/* Checkbox’ların “bir tık yukarı” görünmesini engelle */
.toolbar .music-toggle input,
.toolbar .glow-toggle input {
  margin: 0;
  vertical-align: middle;
  transform: translateY(0);
  accent-color: var(--accent);
}

/* Hidden elementler - tamamen gizle (::after dahil) */
.hidden {
  display: none !important;
}

.hidden::before,
.hidden::after {
  display: none !important;
}