/* CHAT - FULL WHITE MODE (CERAH & NYAMAN MATA) */
/* Pastikan html dan body mengambil tinggi penuh dari viewport */
html, body {
  height: 100%;
  margin:0;
  padding:0;
  box-sizing:border-box;
}

body {
  font-family:'Segoe UI',Arial,sans-serif;
  background:#ffffff;           /* BACKGROUND PUTIH */
  color:#1e1e1e;                 /* TEKS HITAM */
  display:flex;
  flex-direction:column;
  min-height: 100%; /* Pastikan body minimal 100% tinggi */
}

/* Container utama harus mengambil sisa ruang */
.chat-container {
    display: flex;
    flex-direction: column;
    flex-grow: 1; 
    width: 100%;
    min-height: 0; /* Penting untuk flexbox */
}

/* Header */
.header-row {
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:3px;
  padding:5px 5px;
  background:#4f9cff;           /* BIRU CERAH */
  color:white;
  font-weight:600;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1); 
  flex-shrink: 0; 
}
.header-actions {
  display: flex;
  align-items: center;
  gap: 4px; 
}
.online-count {font-size:0.95rem;color:#e8f5ff;}

/* Chat Box */
.chat-box {
  flex:1;
  overflow-y:auto;
  padding:15px;
  background:#f8f9fa;           /* ABU-ABU SUPER MUDA */
  position: relative; 
  min-height: 0; /* Penting agar chat-box bisa di-scroll di dalam flex container */
}

/* Tombol Scroll Bawah (FIXED POSITION) */
.scroll-button {
  position: fixed; /* Posisi tetap pada layar */
  bottom: 80px; /* Jarak dari bawah, di atas input area */
  right: 25px;
  width: 45px;
  height: 45px;
  border-radius: 50%;
  background: #34495e; 
  color: white;
  border: none;
  cursor: pointer;
  font-size: 1.5rem;
  line-height: 45px;
  text-align: center;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
  transition: opacity 0.3s, transform 0.2s;
  z-index: 10;
}
.scroll-button:hover {
  background: #4f9cff; 
  transform: scale(1.05);
}
@media (max-width: 600px) {
  .scroll-button {
    bottom: 70px;
    right: 15px;
    width: 40px;
    height: 40px;
    font-size: 1.3rem;
  }
}

/* Pesan */
.chat-message {
  display:flex;
  gap:12px;
  align-items:flex-start;
  margin-bottom:16px;
  max-width:85%;
  margin-right: auto;
}
.chat-message.mine {
  margin-left:auto;
  align-self:flex-end;
}
.chat-message.mine .msg-body {
  background:#d0e6ff; 
  border-radius:18px 18px 0 18px;
}
.chat-message:not(.mine) .msg-body {
  background:#ffffff; 
  border-radius:18px 18px 18px 0;
}

.msg-avatar {
  width:40px;
  height:40px;
  border-radius:50%;
  overflow:hidden;
  flex-shrink:0;
  background:#4f9cff;
  color:white;
  display:flex;
  align-items:center;
  justify-content:center;
  font-size:0.9rem;
  font-weight:bold;
  border:2px solid #ddd;
}
.chat-message.mine .msg-avatar { order:2; } 
.chat-message.mine .msg-body { order:1; } 
.msg-body {
  padding:12px 18px;
  box-shadow:0 1px 3px rgba(0,0,0,0.08);
  max-width:calc(100% - 52px);
  word-wrap:break-word;
  font-size:0.95rem;
  line-height:1.4;
}
.msg-name {
  font-weight:600;
  display:block;
  margin-bottom:3px;
  color:#333;
}
.chat-message.mine .msg-name {color:#0056b3;} 

/* Typing Status */
.typing-status {
  height:25px;
  padding:5px 20px;
  font-size:0.85rem;
  color:#666;
  background:#f8f9fa;
  flex-shrink: 0;
}

/* Input Area */
.input-area {
  display:flex;
  gap:10px;
  padding:10px 20px;
  border-top:1px solid #eee;
  background:#fff;
  box-shadow: 0 -2px 5px rgba(0,0,0,0.05);
  flex-shrink: 0;
}
.input-area input {
  flex:1;
  padding:12px 18px;
  border:1px solid #ccc;
  border-radius:25px;
  font-size:1rem;
  transition:border-color 0.2s;
  outline:none;
}
.input-area input:focus {border-color:#4f9cff;}
.input-area button {
  width:52px;
  height:52px;
  border-radius:50%;
  background:#4f9cff;
  color:white;
  border:none;
  cursor:pointer;
  font-weight:bold;
  font-size:1.1rem;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
  transition: transform 0.1s;
}
.input-area button:active {
    transform: scale(0.95);
}

/* Profile Modal */
.modal[aria-hidden="true"] {display:none;}
.modal {
  position:fixed;
  inset:0;
  background:rgba(0,0,0,0.4);
  display:flex;
  align-items:center;
  justify-content:center;
  z-index:1000;
  backdrop-filter: blur(4px);
}
.modal-content {
  background:#ffffff;           
  color:#1e1e1e;
  width:90%;
  max-width:420px;
  border-radius:16px;
  padding:28px;
  box-shadow:0 15px 40px rgba(0,0,0,0.15);
}
.modal-content h3 { margin-bottom: 20px; color:#4f9cff; }
.modal-content label { display: block; margin-top: 15px; margin-bottom: 5px; font-weight: 600; font-size: 0.9rem; }
.modal-content input[type="text"] { width: 100%; padding: 10px; border: 1px solid #ccc; border-radius: 8px; font-size: 1rem; }
.modal-content input[type="file"] { margin-top: 10px; }

.color-choices {display:flex;gap:12px;margin:15px 0;}
.color-dot {
  width:44px;
  height:44px;
  border-radius:50%;
  border:3px solid transparent;
  cursor:pointer;
  transition:border-color 0.2s, transform 0.2s;
  background-color: var(--data-color, #4f9cff);
  padding: 0;
}
.color-dot:hover { transform: scale(1.1); }
.color-dot.selected {
  border-color:#4f9cff;
  transform: scale(1.1);
}

.avatar-preview {
  width:100px;
  height:100px;
  border-radius:50%;
  background:#eee;
  margin:10px auto 20px;
  display:none;
  background-size:cover;
  background-position:center;
  border:3px solid #eee;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
.modal-actions {
  display:flex;
  justify-content:flex-end;
  gap:10px;
  margin-top:20px;
}
.btn-primary {
  background:#4f9cff;
  color:white;
  padding:10px 20px;
  border:none;
  border-radius:8px;
  cursor:pointer;
  font-weight:600;
  transition:background 0.2s;
}
.btn-primary:hover { background:#3a7fd9; }

/* Tombol sederhana (untuk Profile) */
.btn-simple {
  background:transparent;
  color:white; 
  padding:8px 12px;
  border:1px solid transparent;
  border-radius:8px;
  cursor:pointer;
  font-weight:600;
  transition:background 0.2s, color 0.2s;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 5px;
}
.btn-simple:hover { 
  background:rgba(255,255,255,0.15); 
}
/* Untuk tombol CANCEL di modal */
.modal-actions .btn-simple {
  color:#666; 
  border:1px solid #ccc; 
  background:transparent;
}
.modal-actions .btn-simple:hover { 
  border-color:#4f9cff; 
  color:#4f9cff; 
  background: transparent;
}


/* Toast Notification */
.toast {
  position: fixed;
  bottom: 80px; 
  left: 50%;
  transform: translateX(-50%);
  background: #333;
  color: white;
  padding: 10px 20px;
  border-radius: 8px;
  box-shadow: 0 3px 10px rgba(0,0,0,0.3);
  z-index: 1001;
  font-size: 0.9rem;
  white-space: nowrap;
}