/* ==============================================
   UI CHAT KEREN - Desain Glassmorphism Modern
   ============================================== */

/* Wadah Chat Utama - Efek Kaca */
#chat-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 360px;
  height: 480px;
  background: linear-gradient(
    135deg,
    rgba(20, 20, 40, 0.95) 0%,
    rgba(30, 30, 60, 0.9) 100%
  );
  border: 1px solid rgba(0, 242, 255, 0.3);
  border-radius: 20px;
  display: flex;
  flex-direction: column;
  box-shadow:
    0 8px 32px rgba(0, 0, 0, 0.4),
    0 0 60px rgba(0, 242, 255, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
  z-index: 2000;
  overflow: hidden;
  transform: translateY(120%);
  transition:
    transform 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55),
    height 0.3s ease,
    box-shadow 0.3s ease;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

#chat-container.open {
  transform: translateY(0);
  box-shadow:
    0 20px 60px rgba(0, 0, 0, 0.5),
    0 0 80px rgba(0, 242, 255, 0.15),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

#chat-container.minimized {
  height: 55px !important;
  border-radius: 20px;
}

/* Header Chat - Gradien Premium */
.chat-header {
  background: linear-gradient(
    135deg,
    rgba(0, 242, 255, 0.2) 0%,
    rgba(138, 43, 226, 0.3) 50%,
    rgba(255, 0, 128, 0.2) 100%
  );
  padding: 15px 20px;
  font-weight: 700;
  color: white;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

/* Animasi kilau di header */
.chat-header::before {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 200%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.1),
    transparent
  );
  animation: headerShimmer 3s infinite;
}

@keyframes headerShimmer {
  0% {
    left: -100%;
  }
  100% {
    left: 100%;
  }
}

.chat-header span {
  font-size: 1rem;
  letter-spacing: 1px;
  text-shadow: 0 2px 10px rgba(0, 242, 255, 0.5);
  display: flex;
  align-items: center;
  gap: 8px;
  z-index: 1;
}

/* Indikator online */
.chat-header span::after {
  content: "";
  width: 8px;
  height: 8px;
  background: #00ff88;
  border-radius: 50%;
  animation: onlinePulse 2s infinite;
  box-shadow: 0 0 10px #00ff88;
}

@keyframes onlinePulse {
  0%,
  100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.5;
    transform: scale(0.8);
  }
}

/* Tombol Kontrol Header */
.chat-controls {
  display: flex;
  gap: 8px;
  z-index: 1;
}

.chat-controls button {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: white;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 1rem;
  font-weight: bold;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  backdrop-filter: blur(5px);
}

.chat-controls button:hover {
  background: rgba(0, 242, 255, 0.3);
  border-color: rgba(0, 242, 255, 0.5);
  transform: scale(1.1);
  box-shadow: 0 0 15px rgba(0, 242, 255, 0.4);
}

/* Area Pesan */
.chat-messages {
  flex: 1;
  padding: 15px;
  overflow-y: auto;
  font-size: 0.9rem;
  color: #ddd;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: linear-gradient(
    180deg,
    rgba(0, 0, 0, 0.2) 0%,
    rgba(0, 0, 0, 0.1) 100%
  );
}

/* Scrollbar Kustom */
.chat-messages::-webkit-scrollbar {
  width: 6px;
}

.chat-messages::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 10px;
}

.chat-messages::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, #00f2ff, #8a2be2);
  border-radius: 10px;
}

/* Bubbles Pesan */
.msg-bubble {
  background: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.1) 0%,
    rgba(255, 255, 255, 0.05) 100%
  );
  padding: 12px 16px;
  border-radius: 16px 16px 16px 4px;
  align-self: flex-start;
  max-width: 85%;
  border: 1px solid rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  position: relative;
  animation: messageSlideIn 0.3s ease;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

@keyframes messageSlideIn {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Pesanku - Gaya Spesial */
.msg-me {
  background: linear-gradient(135deg, #00f2ff 0%, #00c8ff 50%, #0099ff 100%);
  color: #000;
  align-self: flex-end;
  border-radius: 16px 16px 4px 16px;
  border: none;
  font-weight: 500;
  box-shadow:
    0 4px 15px rgba(0, 242, 255, 0.3),
    0 0 30px rgba(0, 242, 255, 0.1);
}

/* Nama Pengirim */
.msg-name {
  font-size: 0.7rem;
  color: #00f2ff;
  margin-bottom: 4px;
  display: block;
  font-weight: 600;
  letter-spacing: 0.5px;
}

.msg-me .msg-name {
  display: none;
}

/* Waktu Pesan */
.msg-time {
  display: block;
  font-size: 0.65rem;
  color: rgba(255, 255, 255, 0.5);
  text-align: right;
  margin-top: 6px;
}

.msg-me .msg-time {
  color: rgba(0, 0, 0, 0.5);
}

/* Pesan Selamat Datang */
.chat-welcome {
  text-align: center;
  color: rgba(255, 255, 255, 0.4);
  font-size: 0.85rem;
  margin: auto;
  padding: 20px;
  background: linear-gradient(
    135deg,
    rgba(0, 242, 255, 0.05) 0%,
    rgba(138, 43, 226, 0.05) 100%
  );
  border-radius: 12px;
  border: 1px dashed rgba(255, 255, 255, 0.1);
}

.chat-welcome::before {
  content: "💬";
  display: block;
  font-size: 2rem;
  margin-bottom: 10px;
  animation: float 3s ease-in-out infinite;
}

@keyframes float {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-5px);
  }
}

/* Area Input */
.chat-input-area {
  padding: 15px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  gap: 10px;
  background: linear-gradient(
    180deg,
    rgba(0, 0, 0, 0.1) 0%,
    rgba(0, 0, 0, 0.3) 100%
  );
}

/* Kolom Input Chat */
.chat-input {
  flex: 1;
  padding: 12px 18px;
  border-radius: 25px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.05);
  color: white;
  outline: none;
  font-size: 0.9rem;
  transition: all 0.3s ease;
}

.chat-input::placeholder {
  color: rgba(255, 255, 255, 0.4);
}

.chat-input:focus {
  border-color: rgba(0, 242, 255, 0.5);
  background: rgba(255, 255, 255, 0.1);
  box-shadow:
    0 0 0 3px rgba(0, 242, 255, 0.1),
    0 0 20px rgba(0, 242, 255, 0.1);
}

/* Tombol Kirim */
.chat-send {
  background: linear-gradient(135deg, #00f2ff 0%, #00c8ff 100%);
  border: none;
  border-radius: 50%;
  width: 45px;
  height: 45px;
  cursor: pointer;
  font-size: 1.1rem;
  color: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(0, 242, 255, 0.3);
}

.chat-send:hover {
  transform: scale(1.1) rotate(15deg);
  box-shadow:
    0 6px 20px rgba(0, 242, 255, 0.5),
    0 0 30px rgba(0, 242, 255, 0.3);
}

.chat-send:active {
  transform: scale(0.95);
}

/* Tombol Chat di Sidebar */
.btn-menu:has(#chat-notif),
button[onclick*="toggleChat"] {
  position: relative;
  overflow: hidden;
}

/* Badge Notifikasi */
#chat-notif {
  display: none;
  color: #00ff88;
  margin-left: 5px;
  font-size: 0.8rem;
  animation: notifBounce 1s infinite;
}

@keyframes notifBounce {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.3);
  }
}

/* =========================================
   RESPONSIVE DESIGN
   ========================================= */
@media (max-width: 800px) {
  #chat-container {
    width: calc(100% - 30px);
    right: 15px;
    left: 15px;
    bottom: 15px;
    height: 60vh;
    max-height: 500px;
    border-radius: 20px;
  }

  #chat-container.minimized {
    height: 50px !important;
  }

  .chat-header {
    padding: 12px 15px;
  }

  .chat-messages {
    padding: 12px;
  }

  .msg-bubble {
    max-width: 90%;
    padding: 10px 14px;
  }

  .chat-input-area {
    padding: 12px;
  }

  .chat-input {
    padding: 10px 15px;
  }

  .chat-send {
    width: 40px;
    height: 40px;
  }
}

/* Layar Kecil Banget */
@media (max-width: 400px) {
  #chat-container {
    width: calc(100% - 20px);
    right: 10px;
    left: 10px;
  }

  .chat-header span {
    font-size: 0.9rem;
  }
}
