/* =========================================================
   Prof. Dr. Berkan Reşorlu — AI Chatbot Widget  v2
   Futuristik mor/pembe tema (wireframe / parçacık arka plan)
   ========================================================= */

   :root {
    --brr-p:          #a855f7;
    --brr-p-hover:    #9333ea;
    --brr-p-dark:     #6b21a8;
    --brr-p-mid:      #c084fc;
    --brr-p-light:    #e9d5ff;
    --brr-p-xlight:   rgba(168, 85, 247, 0.12);
    --brr-accent:     #ec4899;
    --brr-magenta:    #d946ef;
    --brr-pink:       #f472b6;
    --brr-surface:    rgba(15, 10, 25, 0.88);
    --brr-surface-2:  rgba(10, 5, 20, 0.6);
    --brr-border:     rgba(168, 85, 247, 0.25);
    --brr-text:       #f3e8ff;
    --brr-text-2:     #c4b5fd;
    --brr-text-3:     #a78bfa;
    --brr-online:     #34d399;
    --brr-shadow-lg:  0 28px 64px rgba(0,0,0,.45), 0 0 40px rgba(168, 85, 247, .15);
    --brr-shadow-fab: 0 10px 30px rgba(168, 85, 247, .5), 0 0 20px rgba(236, 72, 153, .2);
    --brr-glow:       0 0 20px rgba(168, 85, 247, .35);
    --brr-radius:     20px;
    --brr-font:       "Montserrat", sans-serif;
    --brr-z:          2147483000;
    --brr-ease:       cubic-bezier(.4,0,.2,1);
    --brr-spring:     cubic-bezier(.34,1.56,.64,1);
  }
  
  /* ─── Root ─────────────────────────────────────────────── */
  .brr-chatbot-root {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: var(--brr-z);
    font-family: var(--brr-font);
  }
  .brr-chatbot-root *,
  .brr-chatbot-root *::before,
  .brr-chatbot-root *::after { box-sizing: border-box; margin: 0; padding: 0; }
  
  /* ─── FAB Trigger ──────────────────────────────────────── */
  .brr-chatbot-trigger {
    position: fixed;
    right: 27px;
    bottom: 100px;
    height: 50px;
    padding: 0 20px 0 16px;
    border-radius: 999px;
    border: 1px solid rgba(236, 72, 153, 0.35);
    background: linear-gradient(145deg, var(--brr-magenta) 0%, var(--brr-p) 50%, var(--brr-p-dark) 100%);
    color: #fff;
    cursor: pointer;
    pointer-events: auto;
    display: flex;
    align-items: center;
    gap: 9px;
    box-shadow: var(--brr-shadow-fab);
    transition: transform .22s var(--brr-spring), box-shadow .22s var(--brr-ease), padding .22s var(--brr-ease), width .22s var(--brr-ease);
    outline: none;
    white-space: nowrap;
    overflow: visible;
  }
  
  .brr-chatbot-trigger-label {
    font-family: var(--brr-font);
    font-size: 14px;
    font-weight: 600;
    letter-spacing: .01em;
    transition: opacity .18s var(--brr-ease), max-width .22s var(--brr-ease);
    max-width: 100px;
    overflow: hidden;
  }
  
  /* Kapalıyken label görünür, açıkken gizlenir ve buton yuvarlak olur */
  .brr-chatbot-trigger--open {
    padding: 0 14px;
    width: 50px;
    justify-content: center;
  }
  .brr-chatbot-trigger--open .brr-chatbot-trigger-label {
    opacity: 0;
    max-width: 0;
  }
  
  /* pulse ring */
  .brr-chatbot-trigger::before {
    content: '';
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    border: 2px solid rgba(168, 85, 247, .5);
    animation: brr-pulse 2.8s ease-out infinite;
    pointer-events: none;
    z-index: -1;
  }
  .brr-chatbot-trigger--open::before { animation: none; opacity: 0; }
  
  /* star glow field around FAB */
  .brr-chatbot-trigger::after {
    content: '';
    position: absolute;
    inset: -6px;
    border-radius: 999px;
    pointer-events: none;
    background:
      url('/parilti.png') center center / 115% 115% no-repeat,
      radial-gradient(circle at 5% 20%,  rgba(244, 114, 182, .9) 0, transparent 45%),
      radial-gradient(circle at 85% 30%, rgba(168, 85, 247, .9) 0, transparent 50%),
      radial-gradient(circle at 25% 80%, rgba(236, 72, 153, .85) 0, transparent 50%),
      radial-gradient(circle at 70% 90%, rgba(129, 140, 248, .8) 0, transparent 55%);
    opacity: 1;
    mix-blend-mode: screen;
    filter: blur(0.1px);
    animation: brr-stars 5.5s ease-in-out infinite alternate;
    z-index: 1;
  }
  .brr-chatbot-trigger--open::after {
    opacity: .7;
  }
  
  @keyframes brr-pulse {
    0%   { transform: scale(.9);  opacity: .8; }
    70%  { transform: scale(1.4); opacity: 0;  }
    100% { transform: scale(1.4); opacity: 0;  }
  }
  
  @keyframes brr-stars {
    0% {
      transform: translate3d(0, 0, 0) scale(1);
      opacity: .8;
    }
    50% {
      transform: translate3d(1px, -1px, 0) scale(1.04);
      opacity: 1;
    }
    100% {
      transform: translate3d(-1px, 1px, 0) scale(1.02);
      opacity: .75;
    }
  }
  
  /* icon wrapper — fixed size, icons stacked via absolute */
  .brr-chatbot-trigger-icon-wrap {
    position: relative;
    width: 24px;
    height: 24px;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }
  
  /* icon swap */
  .brr-chatbot-trigger-icon-wrap svg {
    width: 24px; height: 24px;
    position: absolute;
    top: 0; left: 0;
    transition: transform .24s var(--brr-spring), opacity .2s;
  }
  .brr-chatbot-trigger:not(.brr-chatbot-trigger--open) svg.brr-icon-chat  { opacity:1; transform:scale(1) rotate(0); }
  .brr-chatbot-trigger:not(.brr-chatbot-trigger--open) svg.brr-icon-close { opacity:0; transform:scale(.4) rotate(20deg); }
  .brr-chatbot-trigger--open svg.brr-icon-chat  { opacity:0; transform:scale(.4) rotate(-20deg); }
  .brr-chatbot-trigger--open svg.brr-icon-close { opacity:1; transform:scale(1) rotate(0); }
  
  .brr-chatbot-trigger:hover {
    transform: translateY(-3px) scale(1.06);
    box-shadow: 0 18px 44px rgba(168, 85, 247, .55), 0 0 28px rgba(236, 72, 153, .25);
  }
  .brr-chatbot-trigger:active  { transform: scale(.96); }
  .brr-chatbot-trigger:focus-visible {
    box-shadow: 0 0 0 3px rgba(15, 10, 25, .9), 0 0 0 6px var(--brr-p), var(--brr-shadow-fab);
  }
  
  /* ─── Chat Window ──────────────────────────────────────── */
  .brr-chatbot-window {
    position: fixed;
    right: 10px;
    bottom: 96px;
    width: 390px;
    max-width: calc(100vw - 32px);
    min-height: 360px;
    height: auto;
    max-height: calc(100vh - 120px);
    background: rgba(15, 10, 28, 0.92);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-radius: var(--brr-radius);
    box-shadow: var(--brr-shadow-lg);
    border: 1px solid rgba(168, 85, 247, 0.2);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    pointer-events: auto;
    transform-origin: right bottom;
    transform: scale(.94) translateY(14px);
    opacity: 0;
    visibility: hidden;
    transition: opacity .24s var(--brr-ease), transform .3s var(--brr-spring), visibility .24s;
  }
  .brr-chatbot-window--open {
    opacity: 1; visibility: visible; transform: scale(1) translateY(0);
  }
  
  /* ─── Header ───────────────────────────────────────────── */
  .brr-chatbot-header {
    flex-shrink: 0;
    background: linear-gradient(130deg, rgba(107, 33, 168, .95) 0%, rgba(88, 28, 135, .98) 50%, rgba(59, 7, 100, .98) 100%);
    padding: 14px 16px;
    display: flex;
    align-items: center;
    gap: 11px;
    position: relative;
    overflow: hidden;
    border-bottom: 1px solid rgba(168, 85, 247, 0.2);
    box-shadow: 0 4px 20px rgba(0, 0, 0, .2);
  }
  
  /* decorative soft circles (glow) */
  .brr-chatbot-header::before {
    content: '';
    position: absolute;
    width: 160px; height: 160px;
    border-radius: 50%;
    right: -45px; top: -55px;
    background: radial-gradient(circle, rgba(236, 72, 153, .15) 0%, transparent 70%);
    pointer-events: none;
  }
  .brr-chatbot-header::after {
    content: '';
    position: absolute;
    width: 90px; height: 90px;
    border-radius: 50%;
    right: 48px; bottom: -38px;
    background: radial-gradient(circle, rgba(168, 85, 247, .12) 0%, transparent 70%);
    pointer-events: none;
  }
  
  .brr-chatbot-avatar-wrap { position: relative; flex-shrink: 0; }
  
  .brr-chatbot-avatar {
    width: 44px; height: 44px;
    border-radius: 50%;
    background: rgba(255,255,255,.15);
    border: 2px solid rgba(255,255,255,.30);
    display: flex; align-items: center; justify-content: center;
    color: #fff;
    font-size: 15px; font-weight: 700; letter-spacing: .03em;
    position: relative; z-index: 1;
    box-shadow: 0 4px 14px rgba(0,0,0,.18);
  }
  
  .brr-chatbot-online-dot {
    position: absolute;
    bottom: 0; right: 0;
    width: 12px; height: 12px;
    border-radius: 50%;
    background: var(--brr-online);
    border: 2.5px solid rgba(59, 7, 100, .9);
    box-shadow: 0 0 10px rgba(52, 211, 153, .5);
    z-index: 2;
  }
  
  .brr-chatbot-header-text { flex: 1; min-width: 0; z-index: 1; }
  
  .brr-chatbot-header-title {
    font-size: 15px; font-weight: 700;
    color: #fff; line-height: 1.2; letter-spacing: -.01em;
  }
  
  .brr-chatbot-header-subtitle {
    font-size: 11.5px; font-weight: 400;
    color: rgba(255,255,255,.68);
    margin-top: 2px;
  }
  
  .brr-chatbot-close {
    flex-shrink: 0; z-index: 1;
    background: rgba(255,255,255,.1);
    border: 1px solid rgba(255,255,255,.16);
    border-radius: 50%;
    width: 32px; height: 32px;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    color: rgba(255,255,255,.8);
    transition: background .16s, transform .16s var(--brr-spring);
    outline: none;
  }
  .brr-chatbot-close svg { width: 15px; height: 15px; }
  .brr-chatbot-close:hover  { background: rgba(255,255,255,.22); color:#fff; transform: scale(1.08); }
  .brr-chatbot-close:active { transform: scale(.94); }
  .brr-chatbot-close:focus-visible { box-shadow: 0 0 0 2px rgba(255,255,255,.9); }
  
  /* ─── Messages Body ────────────────────────────────────── */
  .brr-chatbot-body {
    flex: 1; overflow: hidden;
    display: flex; flex-direction: column;
    position: relative;
    background: linear-gradient(180deg, rgba(15, 8, 28, .75) 0%, rgba(20, 10, 35, .85) 100%),
      url('arkaplan.jpg') center center / cover no-repeat;
    background-color: #0a0518;
  }
  .brr-chatbot-body::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(15, 8, 28, .7) 0%, rgba(20, 10, 35, .82) 50%, rgba(15, 8, 28, .88) 100%);
    pointer-events: none;
  }
  .brr-chatbot-messages {
    position: relative;
    z-index: 1;
    flex: 1;
    overflow-y: auto;
    padding: 18px 16px 10px;
    scroll-behavior: smooth;
    display: flex;
    flex-direction: column;
  }
  
  .brr-chatbot-messages::-webkit-scrollbar { width: 4px; }
  .brr-chatbot-messages::-webkit-scrollbar-track { background: transparent; }
  .brr-chatbot-messages::-webkit-scrollbar-thumb {
    background: rgba(168, 85, 247, .35);
    border-radius: 4px;
  }
  
  /* sender label */
  .brr-chatbot-meta {
    font-size: 10.5px;
    font-weight: 500;
    color: var(--brr-text-3);
    letter-spacing: .01em;
    margin-bottom: 4px;
    margin-top: 14px;
  }
  .brr-chatbot-meta:first-child { margin-top: 0; }
  .brr-chatbot-meta--user { text-align: right; padding-right: 2px; }
  .brr-chatbot-meta--bot  { text-align: left;  padding-left: 2px; }
  
  /* row */
  .brr-chatbot-message-row {
    display: flex;
    margin-bottom: 2px;
    animation: brr-msg-in .2s var(--brr-ease) both;
  }
  .brr-chatbot-message-row--user { justify-content: flex-end; }
  .brr-chatbot-message-row--bot  { justify-content: flex-start; }
  
  @keyframes brr-msg-in {
    from { opacity:0; transform: translateY(6px); }
    to   { opacity:1; transform: translateY(0); }
  }
  
  /* bubble base */
  .brr-chatbot-message {
    max-width: 82%;
    padding: 10px 14px;
    font-size: 13.5px;
    line-height: 1.55;
    word-break: break-word;
    white-space: pre-wrap;
  }
  .brr-chatbot-message p { margin: 0; }
  .brr-chatbot-message p + p { margin-top: 5px; }
  
  /* user bubble */
  .brr-chatbot-message--user {
    background: linear-gradient(145deg, var(--brr-magenta) 0%, var(--brr-p) 50%, var(--brr-p-dark) 100%);
    color: #fff;
    border-radius: 18px 18px 4px 18px;
    border: 1px solid rgba(236, 72, 153, 0.3);
    box-shadow: 0 4px 20px rgba(168, 85, 247, .35), 0 0 15px rgba(236, 72, 153, .15);
  }
  .brr-chatbot-message--user a { color: rgba(255,255,255,.9); }
  
  /* bot bubble */
  .brr-chatbot-message--bot {
    background: var(--brr-surface);
    color: var(--brr-text);
    border-radius: 18px 18px 18px 4px;
    border: 1px solid var(--brr-border);
    box-shadow: 0 2px 12px rgba(0, 0, 0, .25), var(--brr-glow);
  }
  .brr-chatbot-message--bot a {
    color: var(--brr-p-mid);
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 2px;
  }
  
  /* ─── Typing dots ──────────────────────────────────────── */
  .brr-chatbot-typing {
    display: flex; align-items: center; gap: 5px;
    padding: 3px 2px;
  }
  .brr-chatbot-typing-dot {
    width: 7px; height: 7px; border-radius: 50%;
    background: var(--brr-pink);
    box-shadow: 0 0 10px rgba(244, 114, 182, .6);
    animation: brr-dot .9s ease-in-out infinite;
  }
  .brr-chatbot-typing-dot:nth-child(2) { animation-delay: .15s; }
  .brr-chatbot-typing-dot:nth-child(3) { animation-delay: .30s; }
  
  @keyframes brr-dot {
    0%,60%,100% { transform: translateY(0);   opacity: .4; }
    30%          { transform: translateY(-6px); opacity: 1;  }
  }
  
  /* ─── Footer / Input ───────────────────────────────────── */
  .brr-chatbot-footer {
    flex-shrink: 0;
    background: rgba(15, 10, 28, 0.95);
    border-top: 1px solid rgba(168, 85, 247, 0.2);
    padding: 10px 14px 13px;
  }
  
  .brr-chatbot-input-row {
    display: flex;
    align-items: flex-end;
    gap: 9px;
  }
  
  .brr-chatbot-input-wrapper { flex: 1; }
  
  .brr-chatbot-input {
    display: block;
    width: 100%;
    resize: none;
    overflow: hidden;
    min-height: 42px;
    max-height: 100px;
    border-radius: 21px;
    border: 1.5px solid rgba(168, 85, 247, 0.35);
    background: rgba(30, 20, 50, 0.6);
    font-family: var(--brr-font);
    font-size: 13.5px;
    line-height: 1.45;
    color: var(--brr-text);
    padding: 10px 16px;
    outline: none;
    transition: border-color .18s, background .18s, box-shadow .18s;
  }
  .brr-chatbot-input::placeholder { color: var(--brr-text-3); }
  .brr-chatbot-input:focus {
    border-color: var(--brr-p);
    background: rgba(40, 25, 65, 0.7);
    box-shadow: 0 0 0 3px rgba(168, 85, 247, .15), 0 0 20px rgba(168, 85, 247, .1);
  }
  
  .brr-chatbot-send {
    flex-shrink: 0;
    width: 42px; height: 42px;
    border-radius: 50%;
    border: 1px solid rgba(236, 72, 153, 0.3);
    background: linear-gradient(145deg, var(--brr-magenta), var(--brr-p-dark));
    color: #fff;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 4px 20px rgba(168, 85, 247, .4), 0 0 15px rgba(236, 72, 153, .2);
    transition: transform .2s var(--brr-spring), box-shadow .2s, opacity .16s;
    outline: none;
  }
  .brr-chatbot-send svg { width: 19px; height: 19px; }
  .brr-chatbot-send:not([disabled]):hover {
    transform: translateY(-2px) scale(1.07);
    box-shadow: 0 8px 28px rgba(168, 85, 247, .5), 0 0 22px rgba(236, 72, 153, .25);
  }
  .brr-chatbot-send:not([disabled]):active {
    transform: scale(.94);
    box-shadow: 0 2px 10px rgba(168, 85, 247, .3);
  }
  .brr-chatbot-send[disabled] { opacity: .4; cursor: default; box-shadow: none; }
  .brr-chatbot-send:focus-visible { box-shadow: 0 0 0 3px rgba(15,10,25,.9), 0 0 0 6px var(--brr-p); }
  
  /* ─── Disclaimer ───────────────────────────────────────── */
  .brr-chatbot-disclaimer {
    margin-top: 8px;
    padding: 7px 11px;
    background: rgba(168, 85, 247, 0.12);
    border-left: 3px solid rgba(168, 85, 247, 0.5);
    border-radius: 0 8px 8px 0;
    font-size: 10.5px;
    line-height: 1.5;
    color: var(--brr-text-2);
  }
  .brr-chatbot-disclaimer strong { color: var(--brr-p-mid); font-weight: 700; }
  
  /* ─── DSA Branding ─────────────────────────────────────── */
  .brr-chatbot-branding {
    text-align: center;
    font-size: 9.5px;
    color: var(--brr-text-3);
    margin-top: 7px;
    letter-spacing: .01em;
    opacity: .85;
  }
  .brr-chatbot-branding a {
    color: var(--brr-p-mid);
    text-decoration: none;
    font-weight: 600;
    transition: color .15s;
  }
  .brr-chatbot-branding a:hover { color: var(--brr-pink); text-decoration: underline; }
  
  /* ─── Mobile ───────────────────────────────────────────── */
  @media (max-width: 600px) {
    .brr-chatbot-window {
      left: 0; right: 0; bottom: 0;
      width: 100%; max-width: 100%;
      height: 100%; max-height: 100%;
      border-radius: 0; border: none;
      transform-origin: center bottom;
    }
    .brr-chatbot-header { padding-top: 20px; }
    .brr-chatbot-trigger { right: 10px; bottom: 96px; }
    .brr-chatbot-footer {
      padding-bottom: max(16px, env(safe-area-inset-bottom, 16px));
    }
  }

  /* Laptop yüksekliğinde taşmayı engelle (ör. 768px ve altı) */
  @media (max-height: 800px) and (min-width: 601px) {
    .brr-chatbot-window {
      bottom: 72px;
      max-height: calc(100vh - 96px);
    }
  }
