:root {
  --primary: #00f0ff;
  --background: #000000;
  --text: #ffffff;
  --card: #111111;
  --glow: 0 0 15px var(--primary);
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  font-family: 'Segoe UI', sans-serif;
  background: var(--background);
  color: var(--text);
  height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  overflow-y: auto;
}

/* ===== HEADER ===== */
.main-header {
  position: fixed;
  top: 0;
  width: 100%;
  background: #171F55;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  box-shadow: 0 1px 5px rgba(0, 255, 255, 0.1);
}

.top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 1rem;
  height: 50px;
}

.top-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.menu-btn {
  font-size: 1.4rem;
  background: none;
  border: none;
  color: var(--primary);
  cursor: pointer;
}

.logo-title {
  display: flex;
  align-items: center;
  gap: 6px;
}

.logo {
  height: 160px;
  filter: drop-shadow(0 0 5px var(--primary));
}

.title {
  font-size: 1.1rem;
  font-weight: bold;
  color: var(--primary);
  text-shadow: 0 0 3px var(--primary);
}

.top-right {
  display: flex;
  gap: 8px;
  align-items: center;
}

.login-btn, .logout-btn {
  background: var(--primary);
  border: none;
  padding: 6px 12px;
  color: #000;
  font-weight: bold;
  border-radius: 5px;
  box-shadow: 0 0 6px var(--primary);
  cursor: pointer;
}

.logout-btn {
  background: #f44336;
  color: white;
  box-shadow: 0 0 6px #f44336;
}

/* ===== NAV MENU ===== */
.nav-menu {
  background: #0d0d0d;
  padding: 0.5rem 1rem;
  display: flex;
  flex-direction: column;
}

.nav-menu ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.nav-menu a {
  color: var(--primary);
  text-decoration: none;
  font-weight: bold;
}

@media (min-width: 768px) {
  .menu-btn {
    display: none;
  }

  .nav-menu {
    flex-direction: row;
    justify-content: flex-end;
  }

  .nav-menu ul {
    flex-direction: row;
    gap: 20px;
  }
}

/* ===== MAIN ===== */
main {
  flex: 1;
  padding: 70px 1rem 1rem;
  background: #0D1433;
}

/* ===== CHAT AREA ===== */
#chat-container {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  margin-bottom: 100px;
  height: calc(100dvh - 140px);
}

@keyframes bubbleIn {
  0% {
    opacity: 0;
    transform: translateY(10px) scale(0.95);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.msg-bubble {
  border-radius: 16px;
  padding: 16px 20px;
  margin: 10px 0;
  font-size: 1.05rem;
  line-height: 1.6;
  word-wrap: break-word;
  max-width: 90%;
  animation: bubbleIn 0.3s ease forwards;
  box-shadow: 0 0 12px rgba(0, 255, 255, 0.2), 0 0 4px rgba(0, 255, 255, 0.5);
}

/* AI (kiri) */
.ai-msg {
  align-self: flex-start;
  background: #111;
  color: #fff;
  border-top-left-radius: 0;
  margin-left: 0;
  margin-right: auto;
  box-shadow: 0 0 8px rgba(255,255,255,0.15);
}

/* User (kanan) */
.user-msg {
  align-self: flex-end;
  background: var(--primary);
  color: #000;
  border-top-right-radius: 0;
  margin-left: auto;
  margin-right: 0;
  box-shadow: 0 0 10px var(--primary);
}


/* Animasi loading dots */
.loading-dots::after {
  content: '.';
  animation: dots 1s steps(3, end) infinite;
  margin-left: 4px;
  opacity: 0.7;
}

@keyframes dots {
  0% { content: '.'; }
  33% { content: '..'; }
  66% { content: '...'; }
  100% { content: '.'; }
}

/* Cursor effect waktu taip */
.typing-cursor::after {
  content: '|';
  animation: blink 1s infinite;
  margin-left: 4px;
}

@keyframes blink {
  0%, 100% { opacity: 0; }
  50% { opacity: 1; }
}



/* ===== INPUT AREA ===== */
#input-area {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  width: 100%;
  max-width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #3b5265;
  padding: 10px 16px;
  border-radius: 25px 25px 0 0;
  box-shadow: 0 -2px 12px rgba(0, 255, 255, 0.2);
  z-index: 999;
  overflow: hidden;
  gap: 10px;
  box-sizing: border-box;
  padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 10px);
}

#user-input {
  flex: 1;
  border: none;
  background: transparent;
  color: #fff;
  font-size: 1.1rem;
  outline: none;
}

#user-input::placeholder {
  color: #1DDDF2;
  opacity: 0.5;
}

.icon-btn {
  background: transparent;
  border: none;
  padding: 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.icon-btn img {
  width: 30px;
  height: 30px;
  max-width: 100%;
  filter: brightness(1.8);
  object-fit: contain;
}

/* ===== MIC & WAVE ICONS BULAT ===== */
#mic-btn, #wave-btn {
  width: 42px;
  height: 42px;
  background: #222;
  border: none;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 6px rgba(0, 255, 255, 0.2);
  cursor: pointer;
  transition: transform 0.2s ease;
  padding: 0;
}

#mic-btn {
  margin-right: 8px;
}

#mic-btn img,
#wave-btn img {
  width: 30px;
  height: 30px;
  object-fit: contain;
  filter: brightness(1.8);
}

/* ===== SEND BUTTON ===== */
#send-btn {
  background: var(--primary);
  color: black;
  font-weight: bold;
  border: none;
  border-radius: 50%;
  width: 42px;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 10px var(--primary);
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

#send-btn img {
  width: 24px;
  height: 24px;
  filter: brightness(1.8);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

#send-btn:hover {
  animation: pulse 5s infinite;
}

#send-btn:active img {
  transform: scale(1.2);
  filter: brightness(2.5);
  box-shadow: 0 0 10px var(--primary);
}

@keyframes pulse {
  0% { box-shadow: 0 0 10px var(--primary); }
  50% { box-shadow: 0 0 20px var(--primary), 0 0 10px var(--primary); }
  100% { box-shadow: 0 0 10px var(--primary); }
}

/* ===== MISC ===== */
.hidden {
  display: none !important;
}

button:active,
input[type="submit"]:active {
  outline: none;
  border: none;
  animation: neon-smooth 0.5s ease-in-out;
  border-radius: 8px;
}

button,
.icon-btn,
button:focus,
.icon-btn:focus,
button:active,
.icon-btn:active {
  outline: none;
  border: none;
  box-shadow: none;
  background: none;
}

.icon-btn,
#mic-btn,
#wave-btn,
#send-btn {
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.icon-btn:hover,
#mic-btn:hover,
#wave-btn:hover,
#send-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 0 10px var(--primary), 0 0 4px var(--primary);
}

.icon-btn:active,
#mic-btn:active,
#wave-btn:active,
#send-btn:active {
  transform: scale(0.95);
  box-shadow: 0 0 4px var(--primary);
}

@keyframes neon-smooth {
  0% { box-shadow: 0 0 0px transparent; transform: scale(1); }
  50% { box-shadow: 0 0 10px var(--primary), 0 0 20px var(--primary); transform: scale(1.03); }
  100% { box-shadow: 0 0 0px transparent; transform: scale(1); }
}
