:root{
  --topbar-bg: #24252f;
  --sidebar-bg: #1f1f28;
  --content-bg: #000000;
  --accent: #2563eb;
  --text-on-top: #ffffff;
  --muted: #A0AEC0;
  --online: #22c55e;

  --topbar-height: 100px;
  --sidebar-width: 265px;

  --logo-box-w: 265px;
  --logo-box-h: 100px;
  --logo-img-w: 175px;
  --logo-img-h: 55.34px;

  --btn-color: rgb(160, 174, 192);
  --btn-hover: rgb(33, 150, 243);
}

@font-face {
  font-family: "Rubik";
  src: url('../fonts/Rubik-Regular.woff2') format('woff2');
  font-weight: 300;
  font-style: normal;
}

/* reset */
*{box-sizing:border-box;margin:0;padding:0}
html,body{height:100%}

body{
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial;
  background-color:#1a1c24;
  display:flex;
  flex-direction:column;
  background-image:url('../images/background.svg');
  background-size:cover;
  background-position:center;
  background-attachment:fixed;
}

/* topbar */
.topbar{
  height:var(--topbar-height);
  background-color:var(--topbar-bg);
  display:flex;
  align-items:center;
  padding:0;
  position:relative;
}

.topbar::before{
  content:'';
  position:absolute;
  top:0;
  left:0;
  right:0;
  bottom:0;
  background-image:url('../images/pattern.png');
  background-repeat:repeat;
  background-size:auto;
  opacity:0.25;
  pointer-events:none;
}

.topbar-nav{
  display:flex;
  align-items:center;
  gap:16px;
  margin-left:16px;
  height:100%;
  position:relative;
  z-index:1;
  flex:1;
}

.topbar-btn{
  background:none;
  border:none;
  cursor:pointer;
  display:flex;
  align-items:center;
  justify-content:center;
  font-family: "Rubik", sans-serif;
  font-size:16px;
  font-weight:300;
  font-style:normal;
  color:var(--btn-color);
  transition:color 0.5s ease;
  padding:0;
  height:auto;
  gap:8px;
}

.topbar-btn svg{
  width:16px;
  height:16px;
  flex-shrink:0;
}

.topbar-btn span{
  white-space:nowrap;
}

.topbar-btn:hover{
  color:var(--btn-hover);
}

.topbar-btn-login{
  background-color: rgb(33, 150, 243);
  color: white;
  border: none;
  padding: 4px 16px;
  font-family: "Rubik", sans-serif;
  font-size: 16px;
  font-weight: 300;
  border-radius: 16px;
  cursor: pointer;
  transition: background-color 0.5s ease;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-left: auto;
  margin-right: 16px;
}

.topbar-btn-login:hover{
  background-color: rgb(43, 108, 176);
}

.topbar-btn-icon{
  display:flex;
  align-items:center;
  justify-content:center;
}

.logo-box{
  width:var(--logo-box-w);
  height:var(--logo-box-h);
  display:flex;
  align-items:center;
  justify-content:center;
  padding:0;
  position:relative;
  z-index:1;
}

.logo-img{
  width:var(--logo-img-w);
  height:var(--logo-img-h);
  object-fit:contain;
}

/* layout */
.page{
  display:grid;
  grid-template-columns: var(--sidebar-width) 1fr;
  flex:1;
  height:100%;
  min-height: 0;
}

.sidebar{
  background:var(--sidebar-bg);
  padding:8px;
  color:white;
  overflow:hidden;
  display:flex;
  flex-direction:column;
  height:100%;
  min-height: 0;
}

.content{
  overflow:auto;
  color:#1a1c24;
  background-image:linear-gradient(rgba(26, 28, 36, 0.67), rgba(26, 28, 36, 0.67)), url('../images/background.svg');
  background-size:cover;
  background-position:center;
  background-attachment:fixed;
}

/* chat */
.chat-container{
  display:flex;
  flex-direction:column;
  height:100%;
}

.chat-header{
  height:35px;
  display:flex;
  align-items:center;
  padding:0 12px;
  font-weight: 300;
  font-family: "Rubik", sans-serif;
  font-size: 16px;
  color: var(--btn-color);
  background-color: var(--topbar-bg);
  width: 241px;
  border-radius: 4px;
  margin: 8px 8px 8px 8px;
  flex-shrink: 0;
}

.messages{
  flex: 1;
  max-height: calc(100% - 35px - 80px - 48px);
  overflow-y: auto;
  padding:8px 5px;
  display:flex;
  flex-direction:column;
  gap:8px;
  scrollbar-gutter: stable;
  min-height: 0;
}
.messages::-webkit-scrollbar {
  width: 4px;
}

.messages::-webkit-scrollbar-track {
  background: transparent;
}

.messages::-webkit-scrollbar-thumb {
  background: rgba(160, 174, 192, 0.6);
  border-radius: 4px;
}

.messages::-webkit-scrollbar-thumb:hover {
  background: rgba(160, 174, 192, 0.8);
}

.message{
  display:flex;
  flex-direction:column;
  gap:1px;
  padding:8px 0;
  color:var(--muted);
  font-size:13px;
}

.message-header{
  display:flex;
  align-items:center;
  gap:8px;
}

.message-avatar{
  width:32px;
  height:32px;
  min-width:32px;
  background:#4a5568;
  border-radius:50%;
  display:flex;
  align-items:center;
  justify-content:center;
  font-size:14px;
  color:white;
}

.message-username{
  color:white;
  font-weight:600;
  font-size:12px;
}

.message-content{
  display:flex;
  flex-direction:column;
  gap:2px;
  flex:1;
}

.message-text{
  color:var(--muted);
  font-size:13px;
  line-height:1.3;
}

.chat-input{
  padding:8px 0;
  display:flex;
  flex-direction:column;
  gap:8px;
  flex-shrink: 0;
  height: 80px;
  margin: 0 4px 8px 4px;
}

.chat-input input{
  padding:8px;
  background:#0b0b0c;
  color:white;
  border-radius:6px;
  border:1px solid rgba(255,255,255,0.04);
}

.chat-input button{
  padding:8px;
  background:#4a5568;
  border:0;
  border-radius:6px;
  color:white;
  font-weight:500;
  transition:background-color 0.3s ease;
  cursor:pointer;
}

.chat-input button:hover{
  background:#5a6578;
}

.spinner {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 50px;
  height: 50px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top: 2px solid #2196f3;
  border-radius: 50%;
  animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}
