/* =========================================
   RESET
========================================= */

*{
  margin:0;
  padding:0;
  box-sizing:border-box;
}

/* =========================================
   BODY
========================================= */

body{
  font-family:Inter,sans-serif;
  background:#0f172a;
  color:white;
  overflow:hidden;
}

/* =========================================
   LAYOUT
========================================= */

.layout{
  display:flex;
  height:100vh;
}

/* =========================================
   SIDEBAR
========================================= */

.sidebar{
  width:320px;
  background:#111827;
  border-right:1px solid rgba(255,255,255,.05);
  display:flex;
  flex-direction:column;
  justify-content:space-between;
  padding:26px;
}

.brand{
  display:flex;
  align-items:center;
  gap:12px;
  margin-bottom:30px;
}

.brand-logo{
  width:220px;
  height:100px;
  object-fit:contain;
}

.brand-text{
  font-size:34px;
  font-weight:800;
  color:white;
}

/* =========================================
   USER BOX
========================================= */

.userbox{
  background:rgba(255,255,255,.04);
  border:1px solid rgba(255,255,255,.05);
  border-radius:18px;
  padding:16px;
  margin-bottom:20px;
}

.role{
  color:#94a3b8;
  margin-top:4px;
  font-size:13px;
}

/* =========================================
   UPLOAD
========================================= */

.upload-box{
  background:rgba(255,255,255,.03);
  border:1px solid rgba(255,255,255,.05);
  border-radius:18px;
  padding:18px;
  margin-bottom:20px;
}

.upload-box input{
  width:100%;
  margin-bottom:12px;
}

/* =========================================
   BUTTON
========================================= */

button{
  background:white;
  color:black;
  border:none;
  padding:12px 22px;
  border-radius:14px;
  cursor:pointer;
  font-weight:600;
  transition:.2s;
}

button:hover{
  opacity:.9;
  transform:translateY(-1px);
}

.stop-btn{
  background:#7f1d1d !important;
  color:white !important;
}

/* =========================================
   MENU
========================================= */

.menu-btn,
.logout-btn{
  display:block;
  padding:14px;
  border-radius:14px;
  text-decoration:none;
  color:white;
  background:rgba(255,255,255,.04);
  margin-top:12px;
}

/* =========================================
   MAIN
========================================= */

.main{
  flex:1;
  display:flex;
  flex-direction:column;
  background:#020617;
}

/* =========================================
   TOPBAR
========================================= */

.topbar{
  height:80px;
  display:flex;
  align-items:center;
  padding:0 30px;
  border-bottom:1px solid rgba(255,255,255,.05);
  background:rgba(15,23,42,.6);
  backdrop-filter:blur(20px);
}

.topbar-title{
  font-size:32px;
  font-weight:700;
  color:#94a3b8;
  line-height:1.4;
}

/* =========================================
   CHAT AREA
========================================= */

.chat-area{
  flex:1;
  overflow-y:auto;
  padding:30px;
  background:#0f172a;
}

/* =========================================
   MESSAGE
========================================= */

.msg{
  max-width:75%;
  padding:16px 18px;
  border-radius:18px;
  margin-bottom:18px;
  white-space:pre-wrap;
  line-height:1.5;
}

/* =========================================
   USER MESSAGE
========================================= */

.user-msg{
  margin-left:auto;
  background:#374151;
  color:white;
  border-radius:18px 18px 4px 18px;
  border:1px solid rgba(255,255,255,.05);
}

/* =========================================
   BOT MESSAGE
========================================= */

.bot-msg{
  background:transparent;
  color:#ffffff;
  border:none;
}

/* =========================================
   MARKDOWN NORMALIZE
========================================= */

.bot-msg *{
  margin:0;
}

.bot-msg p{
  line-height:1.5;
}

.bot-msg ul,
.bot-msg ol{
  padding-left:22px;
  margin:4px 0;
}

.bot-msg li{
  margin:2px 0;
  line-height:1.5;
}

.bot-msg h1,
.bot-msg h2,
.bot-msg h3{
  margin:10px 0 6px;
  line-height:1.3;
}

.bot-msg strong{
  font-weight:700;
}

.bot-msg pre{
  background:#111827;
  padding:12px;
  border-radius:12px;
  overflow:auto;
  margin:10px 0;
}

.bot-msg code{
  background:rgba(255,255,255,.08);
  padding:2px 5px;
  border-radius:5px;
}

.bot-msg table{
  width:100%;
  border-collapse:collapse;
  margin:10px 0;
}

.bot-msg th,
.bot-msg td{
  border:1px solid rgba(255,255,255,.08);
  padding:8px;
}

.bot-msg br{
  line-height:1.2;
}

/* =========================================
   INPUT AREA
========================================= */

.input-area{
  display:flex;
  gap:12px;
  padding:20px;
  background:#111827;
  border-top:1px solid rgba(255,255,255,.05);
}

.input-area input{
  flex:1;
  background:#1f2937;
  border:1px solid rgba(255,255,255,.08);
  border-radius:14px;
  padding:14px 16px;
  color:white;
  font-size:15px;
}

.input-area input::placeholder{
  color:#9ca3af;
}

/* =========================================
   LOGIN
========================================= */

.login-body{
  display:flex;
  align-items:center;
  justify-content:center;
  height:100vh;
  background:
  radial-gradient(circle at top right,#1e3a8a,#020617);
}

.login-card{
  width:420px;
  background:rgba(15,23,42,.95);
  border:1px solid rgba(255,255,255,.06);
  border-radius:28px;
  padding:40px;
  backdrop-filter:blur(20px);
}

.logo-wrap{
  display:flex;
  flex-direction:column;
  align-items:center;
  margin-bottom:16px;
}

.login-logo{
  width:90px;
  height:90px;
  object-fit:contain;
  margin-bottom:18px;
}

.logo-text{
  font-size:42px;
  font-weight:800;
  color:white;
  letter-spacing:.5px;
}

.subtitle{
  color:#94a3b8;
  margin-bottom:30px;
  text-align:center;
}

.login-card input{
  width:100%;
  padding:16px;
  margin-bottom:16px;
  border-radius:16px;
  border:1px solid rgba(255,255,255,.08);
  background:rgba(255,255,255,.04);
  color:white;
}

.error{
  background:#7f1d1d;
  padding:12px;
  border-radius:12px;
  margin-bottom:20px;
}

/* =========================================
   TYPING ANIMATION
========================================= */

.typing{
  display:flex;
  gap:6px;
  align-items:center;
  padding:6px 0;
}

.typing span{
  width:10px;
  height:10px;
  border-radius:50%;
  background:#8b5cf6;
  animation:bounce 1.2s infinite;
}

.typing span:nth-child(2){
  animation-delay:.2s;
}

.typing span:nth-child(3){
  animation-delay:.4s;
}

@keyframes bounce{

  0%,80%,100%{
    transform:scale(0);
    opacity:.5;
  }

  40%{
    transform:scale(1);
    opacity:1;
  }
}

/* =========================================
   CURSOR
========================================= */

.cursor{
  display:inline-block;
  width:10px;
  height:20px;
  background:#8b5cf6;
  margin-left:3px;
  border-radius:2px;
  animation:blink 1s infinite;
  vertical-align:middle;
}

@keyframes blink{

  0%,50%{
    opacity:1;
  }

  51%,100%{
    opacity:0;
  }
}

/* =========================================
   SOURCES
========================================= */

.sources-box{
  margin-top:16px;
  padding:14px;
  border-radius:14px;
  background:rgba(255,255,255,.04);
  border:1px solid rgba(255,255,255,.05);
}

.sources-title{
  font-weight:700;
  margin-bottom:10px;
  color:#a78bfa;
}

.sources-box pre{
  margin:0;
  white-space:pre-wrap;
  font-size:13px;
  color:#cbd5e1;
}

/* =========================================
   WELCOME
========================================= */

.welcome-title{
  font-size:21px;
  color:#94a3b8;
  line-height:1.6;
}

.welcome-subtitle{
  font-size:21px;
  color:#94a3b8;
  line-height:1.6;
}
button:disabled,
input:disabled{
  opacity:.5;
  cursor:not-allowed;
}