/* BSCR — Bibliotecarul Bursei */

body.bscr-librarian-open{
  overflow:hidden !important;
}

.bscr-librarian-overlay{
  position:fixed;
  inset:0;
  z-index:1000020;
  display:none;
  align-items:center;
  justify-content:center;
  padding:20px;
  background:rgba(0,0,0,.68);
  backdrop-filter:blur(12px);
  -webkit-backdrop-filter:blur(12px);
}

.bscr-librarian-overlay.open{
  display:flex;
}

.bscr-librarian-shell{
  width:min(980px, 100%);
  height:min(88dvh, 880px);
  min-height:560px;
  display:flex;
  flex-direction:column;
  overflow:hidden;
  border:1px solid rgba(255,255,255,.14);
  border-radius:24px;
  background:
    linear-gradient(rgba(31,35,42,.92), rgba(11,11,11,.97)),
    url("/img/bscr-feather.png") center/cover no-repeat;
  box-shadow:0 24px 70px rgba(0,0,0,.58);
  color:#fff;
}

.bscr-librarian-header{
  flex:0 0 auto;
  display:flex;
  align-items:center;
  gap:14px;
  padding:16px 18px;
  border-bottom:1px solid rgba(255,255,255,.09);
  background:rgba(255,255,255,.025);
}

.bscr-librarian-avatar{
  width:58px;
  height:58px;
  flex:0 0 58px;
  overflow:hidden;
  display:flex;
  align-items:center;
  justify-content:center;
  border-radius:50%;
  border:1px solid rgba(255,255,255,.18);
  background:rgba(255,255,255,.06);
  font-size:28px;
}

.bscr-librarian-avatar img{
  width:100%;
  height:100%;
  object-fit:cover;
  display:block;
}

.bscr-librarian-heading{
  min-width:0;
  flex:1 1 auto;
}

.bscr-librarian-title{
  margin:0;
  font-size:21px;
  line-height:1.15;
  font-weight:900;
}

.bscr-librarian-subtitle{
  margin-top:4px;
  font-size:13px;
  line-height:1.35;
  color:rgba(255,255,255,.68);
}

.bscr-librarian-close{
  appearance:none;
  width:42px;
  height:42px;
  min-height:42px;
  flex:0 0 42px;
  padding:0;
  border-radius:50%;
  border:1px solid rgba(255,255,255,.12);
  background:rgba(255,255,255,.05);
  color:#fff;
  font-size:24px;
  line-height:1;
  cursor:pointer;
}

.bscr-librarian-close:hover{
  background:rgba(255,255,255,.10);
}

.bscr-librarian-messages{
  flex:1 1 auto;
  min-height:0;
  overflow:auto;
  padding:20px;
  scroll-behavior:smooth;
}

.bscr-librarian-message-row{
  display:flex;
  align-items:flex-end;
  gap:9px;
  margin:0 0 8px 0;
}

.bscr-librarian-message-row.user{
  justify-content:flex-end;
  background:transparent !important;
}

.bscr-librarian-message-avatar{
  width:34px;
  height:34px;
  flex:0 0 34px;
  display:block;
  object-fit:cover;
  border-radius:50%;
  border:1px solid rgba(255,255,255,.16);
  background:rgba(255,255,255,.05);
}

.bscr-librarian-message{
  width:fit-content;
  max-width:min(760px, 88%);
  margin:0;
  padding:12px 15px;
  border-radius:18px;
  font-size:15px;
  line-height:1.52;
  white-space:pre-wrap;
  overflow-wrap:anywhere;
}

.bscr-librarian-message.assistant{
  background:rgba(255,255,255,.065);
  border:1px solid rgba(255,255,255,.08);
  border-bottom-left-radius:6px;
box-shadow:
  0 2px 10px rgba(0,0,0,.18);
}

.bscr-librarian-message.user{
  margin-left:auto;
  background:rgba(125,211,252,.16);
  border:1px solid rgba(125,211,252,.22);
  border-bottom-right-radius:6px;
box-shadow:
  0 2px 10px rgba(0,0,0,.18);
}

.bscr-librarian-message.pending{
  opacity:.68;
  font-style:italic;
}

.bscr-librarian-suggestions{
  flex:0 0 auto;
  display:flex;
  gap:8px;
  overflow-x:auto;
  padding:0 18px 12px;
  scrollbar-width:none;
}

.bscr-librarian-suggestions::-webkit-scrollbar{
  display:none;
}

.bscr-librarian-suggestion{
  appearance:none;
  flex:0 0 auto;
  min-height:38px;
  padding:0 13px;
  border-radius:999px;
  border:1px solid rgba(255,255,255,.11);
  background:rgba(255,255,255,.045);
  color:#fff;
  font-size:13px;
  cursor:pointer;
}

.bscr-librarian-suggestion:hover{
  background:rgba(255,255,255,.09);
}

.bscr-librarian-composer{
  flex:0 0 auto;
  display:flex;
  align-items:flex-end;
  gap:10px;
  padding:14px 18px 18px;
  border-top:1px solid rgba(255,255,255,.09);
  background:rgba(0,0,0,.18);
}

.bscr-librarian-input{
  flex:1 1 auto;
  min-width:0;
  min-height:46px;
  max-height:160px;
  resize:none;
  overflow-y:auto;
  padding:12px 15px;
  border-radius:18px;
  border:1px solid rgba(255,255,255,.11);
  background:rgba(255,255,255,.07);
  color:#fff;
  font:inherit;
  font-size:15px;
  line-height:1.42;
  outline:none;
}

.bscr-librarian-input::placeholder{
  color:rgba(255,255,255,.52);
}

.bscr-librarian-input:focus{
  border-color:rgba(125,211,252,.44);
  box-shadow:0 0 0 3px rgba(125,211,252,.10);
}

.bscr-librarian-send{
  appearance:none;
  width:46px;
  height:46px;
  min-height:46px;
  flex:0 0 46px;
  padding:0;
  display:flex;
  align-items:center;
  justify-content:center;
  border-radius:50%;
  border:1px solid rgba(125,211,252,.30);
  background:rgba(125,211,252,.17);
  color:#fff;
  font-size:22px;
  font-weight:900;
  cursor:pointer;
}

.bscr-librarian-send:hover{
  background:rgba(125,211,252,.25);
}

.bscr-librarian-send:disabled,
.bscr-librarian-input:disabled{
  cursor:not-allowed;
  opacity:.55;
}

@media (max-width:720px){
  .bscr-librarian-overlay{
    inset:auto 0 auto 0;

    top:
      var(
        --bscr-librarian-viewport-top,
        0px
      );

    width:100vw;

    height:
      var(
        --bscr-librarian-viewport-height,
        100dvh
      );

    padding:0;

    align-items:stretch;
    justify-content:stretch;

    overflow:hidden;
  }

  .bscr-librarian-shell{
    width:100vw;
    height:100%;
    min-height:0;
    max-height:100%;

    border:0;
    border-radius:0;
  }

  .bscr-librarian-header{
    padding:
      calc(10px + env(safe-area-inset-top))
      12px
      10px;
  }

  .bscr-librarian-avatar{
    width:48px;
    height:48px;
    flex-basis:48px;
  }

  .bscr-librarian-title{
    font-size:19px;
  }

  .bscr-librarian-subtitle{
    font-size:12px;
  }

  .bscr-librarian-messages{
    padding:14px 12px;
  }

  .bscr-librarian-message{
    max-width:91%;
    font-size:15px;
  }

  .bscr-librarian-suggestions{
    padding:0 12px 10px;
  }

  .bscr-librarian-composer{
    padding:10px 12px calc(10px + env(safe-area-inset-bottom));
  }
}

body.bscr-librarian-open
.bscr-quick-actions{
  opacity:0;
  visibility:hidden;

  pointer-events:none;

  transition:
    opacity 160ms ease,
    visibility 160ms ease;
}

body:not(.bscr-librarian-open)
.bscr-quick-actions{
  opacity:1;
  visibility:visible;

  transition:
    opacity 160ms ease,
    visibility 160ms ease;
}

@media (prefers-reduced-motion:reduce){
  .bscr-librarian-messages{
    scroll-behavior:auto;
  }
}