/* ==========================================================================
   AKILLI KOÇ - maskot düğmesi, konuşma baloncuğu ve defter avatarı
   ========================================================================== */

.chat-widget .koc-dugme {
  width: 68px;
  height: 68px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 38%, rgba(129, 140, 248, .34), rgba(99, 102, 241, .10) 62%, transparent 72%);
  box-shadow: 0 12px 26px rgba(49, 46, 129, .26);
  cursor: pointer;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform .25s cubic-bezier(.2, .9, .3, 1.3);
}

.chat-widget .koc-dugme:hover { transform: translateY(-4px) scale(1.06); }
.chat-widget .koc-dugme:active { transform: scale(.95); }

.koc-yuzler {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
}

.koc-yuz {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
  opacity: 0;
  transition: opacity .22s ease;
  filter: drop-shadow(0 5px 9px rgba(30, 27, 75, .32));
}

.koc-yuz.etkin { opacity: 1; }

.koc-dugme.koc-zipla .koc-yuz.etkin { animation: kocZipla 1.15s ease-in-out 2; }

@keyframes kocZipla {
  0%, 100% { transform: translateY(0) rotate(0); }
  25%      { transform: translateY(-7px) rotate(-5deg); }
  60%      { transform: translateY(0) rotate(4deg); }
}

/* --- konuşma baloncuğu --- */

.koc-balon {
  position: relative;
  max-width: 256px;
  margin-bottom: 14px;
  padding: 13px 15px;
  background: var(--yuzey, #ffffff);
  color: var(--text-primary, #1e293b);
  border: 1px solid var(--cizgi, rgba(148, 163, 184, .38));
  border-radius: 16px 16px 4px 16px;
  box-shadow: 0 16px 34px rgba(15, 23, 42, .18);
  font-size: .86rem;
  line-height: 1.5;
  opacity: 0;
  transform: translateY(10px) scale(.95);
  transform-origin: bottom right;
  transition: opacity .28s ease, transform .28s cubic-bezier(.2, .9, .3, 1.2);
  pointer-events: none;
}

.koc-balon.acik { opacity: 1; transform: none; pointer-events: auto; }

.koc-balon::after {
  content: '';
  position: absolute;
  right: 20px;
  bottom: -7px;
  width: 13px;
  height: 13px;
  background: var(--yuzey, #ffffff);
  border-right: 1px solid var(--cizgi, rgba(148, 163, 184, .38));
  border-bottom: 1px solid var(--cizgi, rgba(148, 163, 184, .38));
  transform: rotate(45deg);
  border-radius: 0 0 3px 0;
}

.koc-balon-metin { margin: 0 18px 0 0; }

.koc-balon-eylem {
  display: inline-block;
  margin-top: 9px;
  font-size: .8rem;
  font-weight: 700;
  color: var(--accent, #6366f1);
  text-decoration: none;
}
.koc-balon-eylem::after { content: ' →'; }
.koc-balon-eylem:hover { text-decoration: underline; }

.koc-balon-kapat {
  position: absolute;
  top: 5px;
  right: 6px;
  width: 22px;
  height: 22px;
  line-height: 1;
  padding: 0;
  background: none;
  border: none;
  border-radius: 6px;
  color: var(--muted, #94a3b8);
  font-size: 1.05rem;
  cursor: pointer;
}
.koc-balon-kapat:hover { background: rgba(148, 163, 184, .18); color: var(--text-primary, #1e293b); }

/* --- sohbet penceresi başlığındaki mini maskot --- */

.koc-mini {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  object-fit: contain;
  background: rgba(255, 255, 255, .20);
  flex: 0 0 auto;
}

/* --- Akıllı Defter sayfasındaki büyük maskot --- */

.koc-defter {
  width: 78px;
  height: 78px;
  object-fit: contain;
  display: block;
  filter: drop-shadow(0 7px 14px rgba(79, 70, 229, .34));
  transition: transform .25s cubic-bezier(.2, .9, .3, 1.3);
}
#aiAvatarBtn:hover .koc-defter { transform: translateY(-4px) scale(1.06); }

@media (max-width: 768px) {
  .chat-widget .koc-dugme { width: 58px; height: 58px; }
  .koc-balon { max-width: 212px; font-size: .82rem; padding: 11px 13px; }
  .koc-defter { width: 62px; height: 62px; }
}


/* ==========================================================================
   SOHBET PANELİ - okunabilirlik ve "yazıyor" göstergesi
   Pencere koyu sabitti, metin rengi temadan geliyordu: açık temada
   koyu zemin + koyu yazı çıkıyordu. Artık ikisi de temadan okunuyor.
   ========================================================================== */

.chat-window {
  background: var(--yuzey, #ffffff);
  border: 1px solid var(--cizgi, rgba(148, 163, 184, .35));
  box-shadow: 0 24px 56px rgba(15, 23, 42, .22);
}

.chat-messages { background: var(--yuzey, #ffffff); }

.message.bot {
  background: var(--yuzey-2, rgba(99, 102, 241, .08));
  border: 1px solid var(--cizgi, rgba(148, 163, 184, .3));
  color: var(--text-primary, #0f172a);
}

.message.user {
  background: var(--accent, #6366f1);
  color: #ffffff;
  border: none;
}

.chat-input-area { border-top: 1px solid var(--cizgi, rgba(148, 163, 184, .3)); }

.chat-input-area input {
  background: var(--yuzey-2, rgba(148, 163, 184, .12));
  border: 1px solid var(--cizgi, rgba(148, 163, 184, .35));
  color: var(--text-primary, #0f172a);
}
.chat-input-area input::placeholder { color: var(--muted, #94a3b8); }

.suggestions span {
  background: var(--yuzey-2, rgba(148, 163, 184, .12));
  border-color: var(--cizgi, rgba(148, 163, 184, .3));
  color: var(--text-secondary, #475569);
}

/* --- koç yazıyor --- */

.message.bot.yaziyor {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 14px 16px;
  max-width: 72px;
}

.message.bot.yaziyor .nokta {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--muted, #94a3b8);
  animation: kocNokta 1.25s infinite ease-in-out;
}
.message.bot.yaziyor .nokta:nth-child(2) { animation-delay: .18s; }
.message.bot.yaziyor .nokta:nth-child(3) { animation-delay: .36s; }

@keyframes kocNokta {
  0%, 60%, 100% { opacity: .28; transform: translateY(0); }
  30%           { opacity: 1;   transform: translateY(-3px); }
}


/* ==========================================================================
   SERBEST KOÇ - sohbet paneli olmayan sayfalarda kendi düğmesi
   ========================================================================== */

.koc-serbest {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

/* ==========================================================================
   "BU SAYFADA NE YAPIYORUM?" KARTI
   ========================================================================== */

.koc-perde[hidden] { display: none !important; }

.koc-perde {
  position: fixed;
  inset: 0;
  z-index: 12500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(10, 15, 28, .58);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  opacity: 0;
  transition: opacity .26s ease;
}
.koc-perde.acik { opacity: 1; }

.koc-kart {
  position: relative;
  width: 100%;
  max-width: 520px;
  max-height: 88vh;
  overflow-y: auto;
  padding: 26px 26px 22px;
  border-radius: 20px;
  background: var(--yuzey, #fff);
  color: var(--text-primary, #0f172a);
  border: 1px solid var(--cizgi, #e2e8f0);
  box-shadow: 0 30px 70px rgba(10, 15, 28, .36);
  transform: translateY(16px) scale(.97);
  transition: transform .3s cubic-bezier(.2, .9, .3, 1.2);
}
.koc-perde.acik .koc-kart { transform: none; }

.koc-kart-maskot {
  width: 96px;
  height: 96px;
  object-fit: contain;
  display: block;
  margin: -4px auto 8px;
  filter: drop-shadow(0 8px 16px rgba(79, 70, 229, .3));
  animation: kocSelam 2.8s ease-in-out .3s infinite;
}

@keyframes kocSelam {
  0%, 100% { transform: translateY(0) rotate(0); }
  45%      { transform: translateY(-6px) rotate(-3deg); }
  70%      { transform: translateY(0) rotate(2deg); }
}

.koc-kart h3 {
  margin: 0 0 18px;
  text-align: center;
  font-family: 'Montserrat', sans-serif;
  font-size: 1.22rem;
  line-height: 1.3;
  color: var(--text-primary, #0f172a);
}

.koc-kart-liste { list-style: none; margin: 0 0 18px; padding: 0; display: flex; flex-direction: column; gap: 14px; }
.koc-kart-liste li {
  position: relative;
  padding-left: 26px;
  font-size: .92rem;
  line-height: 1.55;
  color: var(--text-secondary, #475569);
}
.koc-kart-liste li::before {
  content: '';
  position: absolute;
  left: 6px;
  top: .55em;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent, #6366f1);
}
.koc-kart-liste b { color: var(--text-primary, #0f172a); }

.koc-kart-ipucu {
  margin: 0 0 18px;
  padding: 11px 13px;
  border-radius: 10px;
  background: var(--yuzey-2, #f6f8fb);
  font-size: .84rem;
  line-height: 1.55;
  color: var(--muted, #6b7789);
}

.koc-kart-eylem { display: flex; gap: 10px; }

.koc-dugme-birincil {
  flex: 1;
  padding: 13px;
  border: none;
  border-radius: 11px;
  cursor: pointer;
  background: var(--accent, #6366f1);
  color: #fff;
  font-family: 'Montserrat', sans-serif;
  font-weight: 700;
  font-size: .93rem;
}
.koc-dugme-birincil:hover { filter: brightness(1.08); }

.koc-dugme-sade {
  padding: 13px 18px;
  border: 1px solid var(--cizgi, #e2e8f0);
  border-radius: 11px;
  cursor: pointer;
  background: var(--yuzey, #fff);
  color: var(--text-secondary, #475569);
  font-family: 'Montserrat', sans-serif;
  font-weight: 600;
  font-size: .93rem;
}
.koc-dugme-sade:hover { border-color: var(--accent, #6366f1); color: var(--accent, #6366f1); }

.koc-kart-kapat {
  position: absolute;
  top: 10px;
  right: 12px;
  width: 30px;
  height: 30px;
  line-height: 1;
  padding: 0;
  background: none;
  border: none;
  border-radius: 8px;
  color: var(--muted, #94a3b8);
  font-size: 1.4rem;
  cursor: pointer;
}
.koc-kart-kapat:hover { background: rgba(148, 163, 184, .16); color: var(--text-primary, #0f172a); }

/* ==========================================================================
   KUTLAMA - konfeti + maskot
   ========================================================================== */

.koc-kutlama[hidden] { display: none !important; }

.koc-kutlama {
  position: fixed;
  inset: 0;
  z-index: 13500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(10, 15, 28, .5);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  opacity: 0;
  transition: opacity .3s ease;
  cursor: pointer;
  overflow: hidden;
}
.koc-kutlama.acik { opacity: 1; }

.koc-konfeti { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.koc-konfeti i {
  position: absolute;
  top: -24px;
  border-radius: 2px;
  opacity: .95;
  animation-name: kocDus;
  animation-timing-function: linear;
  animation-iteration-count: infinite;
}

@keyframes kocDus {
  0%   { transform: translateY(-10vh) rotate(0deg); opacity: 0; }
  10%  { opacity: 1; }
  100% { transform: translateY(105vh) rotate(720deg); opacity: .9; }
}

.koc-kutlama-kutu {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 400px;
  padding: 30px 26px 24px;
  border-radius: 22px;
  text-align: center;
  background: var(--yuzey, #fff);
  border: 1px solid var(--cizgi, #e2e8f0);
  box-shadow: 0 30px 70px rgba(10, 15, 28, .4);
  transform: translateY(20px) scale(.92);
  transition: transform .42s cubic-bezier(.16, .84, .32, 1.16);
}
.koc-kutlama.acik .koc-kutlama-kutu { transform: none; }

.koc-kutlama-maskot {
  width: 124px;
  height: 124px;
  object-fit: contain;
  display: block;
  margin: 0 auto 10px;
  filter: drop-shadow(0 12px 22px rgba(79, 70, 229, .34));
  animation: kocZipla 1.1s ease-in-out 3;
}

.koc-kutlama-kutu h3 {
  margin: 0 0 8px;
  font-family: 'Montserrat', sans-serif;
  font-size: 1.32rem;
  color: var(--text-primary, #0f172a);
}
.koc-kutlama-kutu p {
  margin: 0 0 20px;
  font-size: .92rem;
  line-height: 1.6;
  color: var(--text-secondary, #475569);
}

@media (max-width: 768px) {
  .koc-serbest { right: 16px; bottom: calc(76px + env(safe-area-inset-bottom, 0px)); z-index: 1200; }
  .koc-kart { padding: 22px 18px 18px; border-radius: 18px; }
  .koc-kart h3 { font-size: 1.08rem; }
  .koc-kart-liste li { font-size: .87rem; }
  .koc-kart-eylem { flex-direction: column; }
  .koc-dugme-sade { width: 100%; }
  .koc-kutlama-maskot { width: 104px; height: 104px; }
  .koc-kutlama-kutu h3 { font-size: 1.16rem; }
}

/* ==========================================================================
   TASINABILIR SOHBET PANELI - index disindaki sayfalarda
   ========================================================================== */

.koc-sohbet[hidden] { display: none !important; }

.koc-sohbet {
  position: fixed;
  right: 24px;
  bottom: 104px;
  z-index: 2100;
  width: 340px;
  max-width: calc(100vw - 32px);
  height: 460px;
  max-height: calc(100vh - 160px);
  display: flex;
  flex-direction: column;
  border-radius: 18px;
  overflow: hidden;
  background: var(--yuzey, #fff);
  border: 1px solid var(--cizgi, #e4e9f2);
  box-shadow: 0 24px 60px rgba(15, 23, 42, .28);
  opacity: 0;
  transform: translateY(14px) scale(.97);
  transform-origin: bottom right;
  transition: opacity .24s ease, transform .26s cubic-bezier(.2, .9, .3, 1.2);
}
.koc-sohbet.acik { opacity: 1; transform: none; }

.koc-sohbet-bas {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  background: var(--accent, #1e3a8a);
  color: #fff;
  flex: 0 0 auto;
}
.koc-sohbet-bas img { width: 34px; height: 34px; object-fit: contain; flex: 0 0 auto; }
.koc-sohbet-kim { flex: 1; min-width: 0; line-height: 1.25; }
.koc-sohbet-kim b { display: block; font-family: 'Montserrat', sans-serif; font-size: .93rem; }
.koc-sohbet-kim span { font-size: .72rem; opacity: .82; }
.koc-sohbet-kapat {
  border: none; background: rgba(255, 255, 255, .16); color: #fff;
  width: 28px; height: 28px; border-radius: 8px; font-size: 1.1rem; line-height: 1; cursor: pointer;
}
.koc-sohbet-kapat:hover { background: rgba(255, 255, 255, .28); }

.koc-sohbet-govde {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 9px;
  background: var(--yuzey-2, #f6f8fb);
}

.koc-mesaj {
  max-width: 88%;
  padding: 10px 13px;
  border-radius: 14px;
  font-size: .87rem;
  line-height: 1.55;
  overflow-wrap: anywhere;
}
.koc-mesaj.bot {
  align-self: flex-start;
  background: var(--yuzey, #fff);
  color: var(--text-primary, #0f172a);
  border: 1px solid var(--cizgi, #e4e9f2);
  border-bottom-left-radius: 4px;
}
.koc-mesaj.kullanici {
  align-self: flex-end;
  background: var(--accent, #1e3a8a);
  color: #fff;
  border-bottom-right-radius: 4px;
}
.koc-mesaj.bot .ko-blok { border: none; padding: 0; margin: 0; box-shadow: none; background: none; }

.koc-mesaj.yaziyor { display: flex; gap: 4px; align-items: center; padding: 13px; }
.koc-mesaj.yaziyor i {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--muted, #8c99ad);
  animation: kocNokta2 1.2s infinite ease-in-out;
}
.koc-mesaj.yaziyor i:nth-child(2) { animation-delay: .18s; }
.koc-mesaj.yaziyor i:nth-child(3) { animation-delay: .36s; }
@keyframes kocNokta2 { 0%, 80%, 100% { opacity: .3; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }

.koc-sohbet-oneri {
  display: flex;
  gap: 6px;
  padding: 9px 12px;
  overflow-x: auto;
  background: var(--yuzey, #fff);
  border-top: 1px solid var(--cizgi, #e4e9f2);
  flex: 0 0 auto;
  scrollbar-width: none;
}
.koc-sohbet-oneri::-webkit-scrollbar { display: none; }
.koc-sohbet-oneri button {
  white-space: nowrap;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--cizgi, #e4e9f2);
  background: var(--yuzey-2, #f6f8fb);
  color: var(--text-secondary, #475569);
  font-size: .76rem;
  font-weight: 600;
  cursor: pointer;
}
.koc-sohbet-oneri button:hover { border-color: var(--accent, #1e3a8a); color: var(--accent, #1e3a8a); }

.koc-sohbet-alt {
  display: flex;
  gap: 8px;
  padding: 10px 12px;
  background: var(--yuzey, #fff);
  border-top: 1px solid var(--cizgi, #e4e9f2);
  flex: 0 0 auto;
}
.koc-sohbet-alt input {
  flex: 1;
  min-width: 0;
  padding: 10px 13px;
  border-radius: 10px;
  border: 1px solid var(--cizgi, #e4e9f2);
  background: var(--yuzey-2, #f6f8fb);
  color: var(--text-primary, #0f172a);
  font: inherit;
  font-size: .87rem;
}
.koc-sohbet-alt input:focus { outline: none; border-color: var(--accent, #1e3a8a); }
.koc-sohbet-alt button {
  width: 40px;
  border: none;
  border-radius: 10px;
  background: var(--accent, #1e3a8a);
  color: #fff;
  font-size: 1rem;
  cursor: pointer;
  flex: 0 0 auto;
}
.koc-sohbet-alt button:hover { filter: brightness(1.1); }

/* ==========================================================================
   SECIM KARTLARI (kaynak onerisi)
   ========================================================================== */

.koc-secim { display: flex; flex-direction: column; gap: 9px; margin-bottom: 4px; }

.koc-secim-dugme {
  text-align: left;
  padding: 13px 15px;
  border: 1px solid var(--cizgi, #e4e9f2);
  border-radius: 13px;
  background: var(--yuzey-2, #f6f8fb);
  cursor: pointer;
  transition: border-color .15s ease, transform .15s ease;
}
.koc-secim-dugme:hover { border-color: var(--accent, #1e3a8a); transform: translateY(-2px); }
.koc-secim-dugme b {
  display: block;
  font-family: 'Montserrat', sans-serif;
  font-size: .95rem;
  color: var(--text-primary, #0f172a);
  margin-bottom: 3px;
}
.koc-secim-dugme small { font-size: .82rem; line-height: 1.5; color: var(--muted, #6b7789); }

.koc-etiketler { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 6px; }
.koc-etiket {
  padding: 9px 15px;
  border-radius: 999px;
  border: 1px solid var(--cizgi, #e4e9f2);
  background: var(--yuzey-2, #f6f8fb);
  color: var(--text-secondary, #475569);
  font-size: .86rem;
  font-weight: 600;
  cursor: pointer;
}
.koc-etiket:hover { border-color: var(--accent, #1e3a8a); color: var(--accent, #1e3a8a); }

@media (max-width: 768px) {
  .koc-sohbet {
    right: 12px;
    left: 12px;
    width: auto;
    bottom: calc(86px + env(safe-area-inset-bottom, 0px));
    height: 66vh;
    z-index: 1300;
  }
}