/*
Theme Name: RBKI Chat Theme Neon
Theme URI: https://rbki.de/
Author: RBKI / Mastertcape
Author URI: https://rbki.de/
Description: Neon, mobile-first Chat Theme with image mode loader + lightbox.
Version: 1.2.4
License: GPLv2 or later
Text Domain: rbki-chat-theme-neon
*/

:root{
  --rbki-bg: #070a14;
  --rbki-panel: rgba(10,15,35,.55);
  --rbki-border: rgba(255,255,255,.14);
  --rbki-text: #eaf6ff;
  --rbki-muted: rgba(234,246,255,.78);
  --rbki-glow: rgba(43,217,255,.35);
  --rbki-glow2: rgba(90,110,255,.28);
}

html,body{height:100%;}
body{
  margin:0;
  font: 15px/1.45 system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  color: var(--rbki-text);
  background:
    radial-gradient(900px 500px at 20% 10%, rgba(43,217,255,.14), transparent 60%),
    radial-gradient(900px 500px at 80% 0%, rgba(90,110,255,.12), transparent 60%),
    linear-gradient(180deg, #050711, var(--rbki-bg));
}

/* Layout */
.rbki-shell{
  min-height:100%;
  display:flex;
  flex-direction:column;
}

.rbki-topbar{
  position:sticky; top:0;
  z-index:10;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  background: rgba(7,10,20,.62);
  border-bottom: 1px solid rgba(255,255,255,.10);
}

.rbki-topbar-inner{
  max-width: 1120px;
  margin: 0 auto;
  padding: 14px 16px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 12px;
}

.rbki-brand{
  display:flex;
  align-items:center;
  gap: 10px;
  text-decoration:none;
  color: var(--rbki-text);
}
.rbki-logo{
  width:38px;height:38px;border-radius:12px;
  background:
    radial-gradient(18px 18px at 30% 25%, rgba(43,217,255,.75), transparent 60%),
    radial-gradient(18px 18px at 70% 70%, rgba(90,110,255,.65), transparent 60%),
    rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.16);
  box-shadow: 0 10px 30px rgba(0,0,0,.35), 0 0 30px var(--rbki-glow);
}
.rbki-title{
  font-weight: 750;
  letter-spacing: .2px;
}
.rbki-subtitle{
  font-size:12px;
  color: var(--rbki-muted);
}

.rbki-main{
  width:100%;
  max-width: 1120px;
  margin: 0 auto;
  padding: 18px 16px 8px;
  flex: 1 1 auto;
}

/* Chat card */
.rbki-card{
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(10,15,35,.35);
  border-radius: 18px;
  box-shadow: 0 12px 40px rgba(0,0,0,.35);
  overflow:hidden;
}

.rbki-card-head{
  padding: 14px 14px 10px;
  display:flex;
  flex-wrap:wrap;
  gap: 10px;
  align-items:center;
  justify-content:space-between;
  border-bottom: 1px solid rgba(255,255,255,.10);
}

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

/* Buttons */
.rbki-btn{
  appearance:none;
  border:1px solid rgba(255,255,255,.14);
  background: rgba(10,15,35,.55);
  color: var(--rbki-text);
  border-radius: 999px;
  padding: 10px 12px;
  font: 650 12px/1 system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  cursor:pointer;
  user-select:none;
  box-shadow: 0 8px 22px rgba(0,0,0,.28);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.rbki-btn:hover{ filter: brightness(1.08); }
.rbki-btn:active{ transform: translateY(1px); }
.rbki-btn.is-active{
  border-color: rgba(43,217,255,.5);
  box-shadow: 0 0 0 2px rgba(43,217,255,.16), 0 14px 30px rgba(0,0,0,.35);
}

.rbki-hint{
  font-size: 12px;
  color: var(--rbki-muted);
  padding: 0 14px 12px;
}

/* Chat stream */
#rbkiOut{
  padding: 14px;
  display:flex;
  flex-direction:column;
  gap: 10px;

  /* Dynamic height (compact for text, expands for images via viewport) */
  min-height: 260px;
  max-height: 60vh;
  overflow-y: auto;
  transition: max-height .35s ease;
}

/* Messages */
.rbki-msg{
  border: 1px solid rgba(255,255,255,.10);
  background: rgba(255,255,255,.04);
  border-radius: 14px;
  padding: 10px 12px;
  box-shadow: 0 10px 26px rgba(0,0,0,.22);
}
.rbki-user{ align-self:flex-end; max-width: min(92%, 760px); }
.rbki-bot{ align-self:flex-start; max-width: min(92%, 760px); }
.rbki-err{
  align-self:stretch;
  border-color: rgba(255,100,100,.25);
  background: rgba(255,100,100,.07);
  color: rgba(255,230,230,.95);
}
.rbki-upload{
  align-self:stretch;
  background: rgba(255,255,255,.03);
}
.rbki-msg strong{ color: rgba(234,246,255,.95); }

/* Upload previews */
.rbki-up-head{ font-size: 13px; margin-bottom: 8px; color: rgba(234,246,255,.92); }
.rbki-up-sub{ font-size: 12px; color: var(--rbki-muted); }
.rbki-up-img{ max-width: 260px; width:100%; border-radius: 14px; border:1px solid rgba(255,255,255,.12); }

/* Citations */
.rbki-cites{ margin-top: 10px; font-size: 12px; color: var(--rbki-muted); }
.rbki-cites ul{ margin: 6px 0 0 16px; padding:0; }
.rbki-cites li{ margin: 2px 0; }
.rbki-cites a{ color: rgba(43,217,255,.92); text-decoration:none; }
.rbki-cites a:hover{ text-decoration:underline; }

/* Composer */
.rbki-composer{
  border-top: 1px solid rgba(255,255,255,.10);
  padding: 12px 14px 14px;
  display:flex;
  flex-direction:column;
  gap: 10px;
}

.rbki-chips{
  display:flex;
  flex-wrap:wrap;
  gap: 8px;
}
.rbki-chip{
  display:inline-flex;
  align-items:center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(255,255,255,.05);
  border: 1px solid rgba(255,255,255,.10);
  font-size: 12px;
}
.rbki-chip button{
  appearance:none;
  border:none;
  background: transparent;
  color: rgba(234,246,255,.85);
  cursor:pointer;
  font-size: 14px;
}

.rbki-row{
  display:flex;
  gap: 10px;
  align-items:stretch;
}
.rbki-row textarea{
  flex: 1 1 auto;
  width:100%;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,.14);
  background: rgba(10,15,35,.45);
  color: var(--rbki-text);
  padding: 12px 12px;
  outline:none;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.2);
  font: 600 14px/1.35 system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;

  /* compact answer box */
  height: 70px;
  min-height: 60px;
  max-height: 120px;
  resize: vertical;
}
.rbki-row textarea:focus{
  border-color: rgba(43,217,255,.45);
  box-shadow: 0 0 0 3px rgba(43,217,255,.12);
}

/* Upload progress */
#rbkiUploadProgress{
  display:none;
  height: 8px;
  width:100%;
  border-radius: 999px;
  overflow:hidden;
  background: rgba(255,255,255,.12);
  border: 1px solid rgba(255,255,255,.10);
}
#rbkiUploadBar{
  height:100%;
  width:0%;
  background: linear-gradient(90deg, rgba(43,217,255,.9), rgba(90,110,255,.9));
  transition: width .15s ease;
}

/* Image generation loader */
.rbki-image-loader{
  margin-top: 8px;
  padding: 12px;
  border-radius: 14px;
  background: rgba(255,255,255,.05);
  border: 1px solid rgba(255,255,255,.12);
}
.rbki-progress-row{ display:flex; align-items:center; gap:10px; margin-bottom:10px; }
.rbki-spinner{
  width:16px; height:16px; border-radius:50%;
  border:2px solid rgba(255,255,255,.25);
  border-top-color: rgba(255,255,255,.9);
  animation: rbkiSpin .85s linear infinite;
}
@keyframes rbkiSpin{ to{ transform: rotate(360deg);} }
.rbki-progress-text{ font-size: 13px; color: rgba(234,246,255,.92); }
.rbki-progress-bar{
  width:100%; height:8px; border-radius:999px; overflow:hidden;
  background: rgba(255,255,255,.14);
}
.rbki-progress-fill{
  height:100%;
  width:0%;
  border-radius:999px;
  background: linear-gradient(90deg, rgba(43,217,255,.9), rgba(90,110,255,.9));
  transition: width .25s ease;
}

/* Generated image */
.rbki-genimg{
  display:block;
  max-width: 100%;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,.12);
  margin-top: 10px;
  cursor: zoom-in;
}

/* Lightbox */
.rbki-lightbox{
  position: fixed;
  inset: 0;
  z-index: 999999;
  background: rgba(0,0,0,.72);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
}
.rbki-lightbox[hidden]{ display:none; }
.rbki-lightbox-inner{
  position: relative;
  width: min(96vw, 1100px);
  max-height: 92vh;
}
.rbki-lightbox-img{
  width: 100%;
  height: auto;
  max-height: 92vh;
  object-fit: contain;
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0,0,0,.55);
  background: rgba(255,255,255,.04);
}
.rbki-lightbox-close{
  position: absolute;
  top: -10px;
  right: -10px;
  width: 38px;
  height: 38px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,.25);
  background: rgba(10,15,35,.55);
  color: #eaf6ff;
  font-size: 18px;
  cursor: pointer;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

/* Footer */
.rbki-footer{
  border-top: 1px solid rgba(255,255,255,.10);
  background: rgba(7,10,20,.62);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}
.rbki-footer-inner{
  max-width:1120px;
  margin:0 auto;
  padding: 16px;
  font-size: 12px;
  color: var(--rbki-muted);
  display:flex;
  flex-wrap:wrap;
  gap: 10px;
  align-items:center;
  justify-content:space-between;
}
.rbki-footer a{ color: rgba(43,217,255,.92); text-decoration:none; }
.rbki-footer a:hover{ text-decoration:underline; }

@media (max-width: 520px){
  .rbki-topbar-inner{ padding: 12px 12px; }
  .rbki-main{ padding: 14px 12px 6px; }
  .rbki-card-head{ padding: 12px; }
  #rbkiOut{ max-height: 58vh; }
  .rbki-row{ flex-direction:column; }
  .rbki-row textarea{ height: 70px; }
}
.rbki-upload-privacy{
  margin-top:10px;
  color:rgba(234,246,255,.62);
  font-size:11px;
  line-height:1.45;
}
