/*Penambahan file baru css agar ga puyeng liat indexx html jadi 1 - versaagonon*/

/* Chat container */
.chat-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--bg-card);
  border-radius: calc(var(--radius) - 4px);
  border: 1px solid var(--border-color);
  overflow: hidden;
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
  transition: all 0.25s ease;
  width: 100%;
  max-width: none;
  margin: 0 auto;
}

/* Chat log */
.chat-log {
  flex: 1;
  overflow-y: auto;
  padding: 22px;
  /* background image with red/dark overlay for a scary look (photo preserved) */
  background-image:
    linear-gradient(rgba(12, 6, 6, 0.55), rgba(10, 4, 4, 0.55)),
    url("https://uploader.zenzxz.dpdns.org/uploads/1767068581234.jpeg");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  display: flex;
  flex-direction: column;
  gap: 14px;
  transition: background 0.25s ease;
  border-radius: 12px;
}

[data-theme="light"] .chat-log {
  /* lighter, warm-pink overlay in light theme (photo preserved) */
  background-image:
    linear-gradient(rgba(255, 240, 240, 0.6), rgba(255, 240, 240, 0.6)),
    url("https://uploader.zenzxz.dpdns.org/uploads/1767068581234.jpeg");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

.chat-log::-webkit-scrollbar {
  width: 6px;
}

.chat-log::-webkit-scrollbar-track {
  background: rgba(30, 30, 30, 0.5);
  border-radius: 4px;
}

.chat-log::-webkit-scrollbar-thumb {
  background: rgba(255, 51, 51, 0.6);
  border-radius: 4px;
}

.chat-log::-webkit-scrollbar-thumb:hover {
  background: rgba(105, 255, 51, 0.8);
}

/* Message styles */
.message {
  display: flex;
  max-width: 100%;
  animation: fadeInUp 0.32s ease-out;
  align-items: flex-end;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes messageSlideIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.user-message {
  justify-content: flex-end;
}

.ai-message {
  justify-content: flex-start;
}

.message-bubble {
  max-width: 82%;
  padding: 14px 16px;
  border-radius: 14px;
  position: relative;
  font-size: 1em;
  line-height: 1.5;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.28);
  transition: all 0.22s ease;
  border: 1px solid rgba(255, 255, 255, 0.03);
}

.user-message .message-bubble {
  background: linear-gradient(
    135deg,
    var(--primary) 0%,
    var(--primary-dark) 100%
  );
  color: white;
  border-bottom-right-radius: 8px;
  border-top-right-radius: 12px;
  text-align: right;
  margin-right: 50px;
  /* Space for avatar */
}

.ai-message .message-bubble {
  background: #000;
  border: 1px solid rgba(255, 255, 255, 0.03);
  border-bottom-left-radius: 8px;
  border-top-left-radius: 12px;
  color: #fff;
  margin-left: 50px;
  /* Space for avatar */
}

/* Avatar dots */
.ai-message .message-bubble::before,
.user-message .message-bubble::after {
  content: "";
  position: absolute;
  top: 6px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(255, 43, 43, 1), rgba(122, 0, 0, 1));
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.45);
}

.ai-message .message-bubble::before {
  left: -48px;
}

.user-message .message-bubble::after {
  right: -48px;
}

.message-bubble:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

.message-content {
  line-height: 1.6;
}

.message-content p {
  margin-bottom: 10px;
}

.message-content p:last-child {
  margin-bottom: 0;
}

.message-content ul,
.message-content ol {
  margin: 12px 0;
  padding-left: 20px;
}

.message-content li {
  margin-bottom: 5px;
}

.history-highlight .message-bubble {
  box-shadow: 0 12px 30px rgba(215, 255, 17, 0.12) !important;
  transform: translateY(-4px) !important;
  border: 1px solid rgba(215, 255, 17, 0.12) !important;
}

/* Typing animation */
.typing-animation {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 8px 14px;
  background: var(--bg-card-light);
  border-radius: 12px;
  border: 1px solid var(--border-color);
}

.typing-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--primary);
  animation: professionalTyping 1.4s infinite ease-in-out;
}

.typing-dot:nth-child(1) {
  animation-delay: -0.32s;
}

.typing-dot:nth-child(2) {
  animation-delay: -0.16s;
}

.typing-dot:nth-child(3) {
  animation-delay: 0s;
}

@keyframes professionalTyping {
  0%,
  80%,
  100% {
    transform: scale(0.8);
    opacity: 0.5;
  }

  40% {
    transform: scale(1);
    opacity: 1;
  }
}

.typing-indicator {
  display: none;
  padding: 15px 18px;
  background: var(--bg-card-light);
  margin: 0 20px 15px 20px;
  border-radius: 18px;
  border: 1px solid var(--border-color);
  border-bottom-left-radius: 6px;
  max-width: 75%;
  align-self: flex-start;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

/* Code blocks */
.code-block {
  background: rgba(15, 15, 15, 0.9);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 15px;
  margin: 12px 0;
  font-family: "JetBrains Mono", "Consolas", "Monaco", monospace;
  font-size: 0.9em;
  overflow-x: auto;
  position: relative;
  transition: all 0.3s ease;
}

[data-theme="light"] .code-block {
  background: rgba(240, 240, 240, 0.9);
}

.code-block:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

.code-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-color);
}

.code-language {
  color: var(--primary);
  font-weight: 600;
  font-size: 0.8em;
  font-family: "Inter", sans-serif;
}

.copy-code-btn {
  background: rgba(255, 51, 51, 0.1);
  color: var(--text-secondary);
  border: 1px solid rgba(255, 51, 51, 0.3);
  border-radius: 6px;
  padding: 6px 12px;
  font-size: 0.75em;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  gap: 5px;
  font-family: "Inter", sans-serif;
  font-weight: 500;
}

.copy-code-btn:hover {
  background: rgba(255, 51, 51, 0.2);
  color: var(--text-primary);
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(255, 51, 51, 0.3);
}

/* Input area */
.input-area {
  display: flex;
  gap: 12px;
  padding: 14px 16px;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.02), rgba(0, 0, 0, 0.06));
  border-top: 1px solid rgba(255, 255, 255, 0.02);
  align-items: flex-end;
  transition: background 0.2s ease;
  position: sticky;
  bottom: 0;
  backdrop-filter: blur(6px);
}

.input-wrapper {
  flex: 1;
  position: relative;
}

.chat-input {
  width: 100%;
  padding: 15px 18px;
  border: 1px solid var(--border-color);
  border-radius: 14px;
  background: var(--bg-card-light);
  color: var(--text-primary);
  font-family: "Inter", sans-serif;
  font-size: 1em;
  transition: all 0.3s ease;
  resize: none;
  min-height: 50px;
  max-height: 100px;
  backdrop-filter: blur(10px);
}

.chat-input:focus {
  outline: none;
  border-color: rgb(215, 255, 17);
  background: var(--bg-card);
  box-shadow: 0 0 0 3px rgba(201, 255, 51, 0.1);
}

.chat-input::placeholder {
  color: var(--text-secondary);
  font-size: 1em;
}

.send-btn {
  padding: 15px;
  border: none;
  border-radius: 14px;
  background: linear-gradient(
    135deg,
    var(--primary) 0%,
    var(--primary-dark) 100%
  );
  color: #fff;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.3s ease;
  width: 50px;
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 4px 15px rgba(255, 51, 51, 0.3);
}

.send-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(251, 26, 26, 0.4);
}

.send-btn:active:not(:disabled) {
  transform: translateY(0);
}

.send-btn:disabled {
  background: rgba(64, 64, 64, 0.8);
  color: var(--text-secondary);
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.send-btn svg {
  width: 20px;
  height: 20px;
}

/* Responsive for chat elements */
@media (max-width: 768px) {
  .chat-log {
    padding: 12px 12px 140px 12px;
    gap: 12px;
    border-radius: 10px;
  }

  .chat-container {
    width: calc(100% - 24px);
    max-width: 100%;
    margin: 0 auto;
    height: calc(100vh - 140px);
  }

  .message-bubble {
    max-width: 92%;
    padding: 12px 14px;
    font-size: 0.95em;
  }

  .input-area {
    padding: 10px 12px;
    gap: 10px;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    margin: 0 12px 12px 12px;
    border-radius: 12px;
    max-width: calc(100% - 24px);
    display: flex;
    align-items: center;
  }

  .chat-input {
    padding: 12px 15px;
    font-size: 0.95em;
    min-height: 45px;
    max-height: 120px;
    overflow-y: auto;
    flex: 1;
    margin: 0;
  }

  .send-btn {
    width: 46px;
    height: 46px;
    padding: 8px;
    flex-shrink: 0;
    align-self: center;
  }

  .send-btn svg {
    width: 18px;
    height: 18px;
  }

  .code-block {
    padding: 12px;
    font-size: 0.85em;
  }
}

@media (max-width: 420px) {
  .chat-container {
    max-width: 100%;
    margin: 0;
  }

  .message-bubble::before,
  .message-bubble::after {
    display: none;
  }

  .user-message .message-bubble,
  .ai-message .message-bubble {
    margin: 0;
  }
}
