/* Reset & Base */
* {
  box-sizing: border-box;
}

body {
  background: linear-gradient(135deg, #f0f4f8 0%, #e0e8f0 100%);
  margin: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif;
  color: #1a1a1a;
  overflow: hidden;
}

.chat-container {
  width: 100%;
  height: 100vh;
  display: flex;
  flex-direction: column;
  background: transparent;
}

/* Chat Output Area */
#out {
  flex: 1;
  padding: 32px 80px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 20px;
  scroll-behavior: smooth;
  background: transparent;
}

/* Scrollbar Modern */
#out::-webkit-scrollbar {
  width: 6px;
}
#out::-webkit-scrollbar-track {
  background: transparent;
}
#out::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.15);
  border-radius: 3px;
}
#out::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 0, 0, 0.25);
}

/* Input Area */
.input-area {
  display: flex;
  border-top: 1px solid rgba(0, 0, 0, 0.08);
  padding: 20px 80px;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.05);
}

.input-area input {
  flex: 1;
  padding: 16px 20px;
  font-size: 17px;
  font-weight: 400;
  border: 1.5px solid rgba(0, 0, 0, 0.12);
  border-radius: 16px;
  outline: none;
  background: rgba(255, 255, 255, 0.9);
  transition: all 0.25s ease;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.input-area input:focus {
  border-color: #4f8ef7;
  background: #ffffff;
  box-shadow: 0 0 0 4px rgba(79, 142, 247, 0.15);
  transform: translateY(-1px);
}

.input-area button {
  margin-left: 16px;
  padding: 16px 32px;
  background: linear-gradient(135deg, #4f8ef7, #3b7ce8);
  color: white;
  font-size: 17px;
  font-weight: 500;
  border: none;
  border-radius: 16px;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 2px 8px rgba(79, 142, 247, 0.3);
}

.input-area button:hover {
  background: linear-gradient(135deg, #3b7ce8, #2c6bd7);
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(79, 142, 247, 0.35);
}

.input-area button:active {
  transform: translateY(0);
}

/* Message Bubbles */
.pesan-kamu,
.pesan-ai {
  padding: 14px 18px;
  border-radius: 18px;
  line-height: 1.65;
  max-width: 72%;
  word-wrap: break-word;
  font-size: 16.5px;
  font-weight: 450;
  position: relative;
  animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* User Message (Right) */
.pesan-kamu {
  background: linear-gradient(135deg, #6bbdff, #4f8ef7);
  color: white;
  align-self: flex-end;
  border-bottom-right-radius: 6px;
  box-shadow: 0 3px 10px rgba(79, 142, 247, 0.22);
  margin-left: 20%;
}

/* AI Message (Left) */
.pesan-ai {
  background: #ffffff;
  color: #1a1a1a;
  align-self: flex-start;
  border: 1px solid rgba(0, 0, 0, 0.07);
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.08);
  border-bottom-left-radius: 6px;
  margin-right: 20%;
}

.pesan-ai b {
  color: #202124;
  font-weight: 600;
}

.pesan-ai i {
  color: #555;
  font-style: italic;
}

/* Typing Indicator – Lebih Halus */
.dot-typing {
  display: inline-block;
  width: 56px;
  height: 16px;
  position: relative;
  margin-top: 8px;
}

.dot-typing::before,
.dot-typing::after,
.dot-typing span {
  content: "";
  position: absolute;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #888;
  animation: dotPulse 1.4s infinite ease-in-out;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.dot-typing::before { left: 0; animation-delay: 0s; }
.dot-typing span { left: 18px; animation-delay: 0.2s; }
.dot-typing::after { left: 36px; animation-delay: 0.4s; }

@keyframes dotPulse {
  0%, 60%, 100% {
    transform: translateY(0) scale(0.8);
    opacity: 0.5;
  }
  40% {
    transform: translateY(-6px) scale(1);
    opacity: 1;
  }
}

/* Responsif */
@media (max-width: 768px) {
  #out, .input-area {
    padding: 20px 16px;
  }
  .pesan-kamu, .pesan-ai {
    max-width: 88%;
  }
  .pesan-kamu { margin-left: 8%; }
  .pesan-ai { margin-right: 8%; }
}

/* Chat Header */
.chat-header {
  padding: 20px 80px 20px 40px; /* 减少左侧padding从80px到40px */
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
}

.chat-header h2 {
  margin: 0;
  font-size: 24px;
  font-weight: 700;
  color: #1a1a1a;
  display: flex;
  align-items: center;
}

.chat-header h2::before {
  margin-right: 0px;
  font-size: 28px;
}

/* Responsif untuk header */
@media (max-width: 768px) {
  .chat-header {
    padding: 15px 16px; /* 在移动设备上保持一致的padding */
  }
  .chat-header h2 {
    font-size: 20px;
  }
}

/* Reset & Base */
* {
  box-sizing: border-box;
}

body {
  background: linear-gradient(135deg, #f0f4f8 0%, #e0e8f0 100%);
  margin: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif;
  color: #1a1a1a;
  overflow: hidden;
}

.chat-container {
  width: 100%;
  height: 100vh;
  display: flex;
  flex-direction: column;
  background: transparent;
}

/* Chat Output Area */
#out {
  flex: 1;
  padding: 32px 80px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 20px;
  scroll-behavior: smooth;
  background: transparent;
}

/* Scrollbar Modern */
#out::-webkit-scrollbar {
  width: 6px;
}
#out::-webkit-scrollbar-track {
  background: transparent;
}
#out::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.15);
  border-radius: 3px;
}
#out::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 0, 0, 0.25);
}

/* Input Area */
.input-area {
  display: flex;
  align-items: center;
  border-top: 1px solid rgba(0, 0, 0, 0.08);
  padding: 20px 80px;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.05);
}

.input-wrapper {
  flex: 1;
  position: relative;
  display: flex;
  align-items: center;
  max-height: 56px;
}

.input-area input {
  flex: 1;
  padding: 16px 50px 16px 20px;
  font-size: 17px;
  font-weight: 400;
  border: 1.5px solid rgba(0, 0, 0, 0.12);
  border-radius: 16px;
  outline: none;
  background: rgba(255, 255, 255, 0.9);
  transition: all 0.25s ease;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
  height: 56px;
}

.input-area input:focus {
  border-color: #4f8ef7;
  background: #ffffff;
  box-shadow: 0 0 0 4px rgba(79, 142, 247, 0.15);
  transform: translateY(-1px);
}

.input-area input.has-file {
  padding-right: 120px;
}

.file-button {
  position: absolute;
  right: 15px;
  background: none;
  border: none;
  color: #6b7280;
  cursor: pointer;
  padding: 8px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  z-index: 2;
}

.file-button:hover {
  background: rgba(0, 0, 0, 0.05);
  color: #4f8ef7;
}

.input-area button {
  margin-left: 16px;
  padding: 16px 32px;
  background: linear-gradient(135deg, #4f8ef7, #3b7ce8);
  color: white;
  font-size: 17px;
  font-weight: 500;
  border: none;
  border-radius: 16px;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 2px 8px rgba(79, 142, 247, 0.3);
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.input-area button:hover {
  background: linear-gradient(135deg, #3b7ce8, #2c6bd7);
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(79, 142, 247, 0.35);
}

.input-area button:active {
  transform: translateY(0);
}

/* File Preview Inside Input */
.file-preview-inline {
  position: absolute;
  right: 50px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(79, 142, 247, 0.1);
  border-radius: 20px;
  padding: 4px 8px 4px 12px;
  z-index: 1;
  max-width: 200px;
}

.file-preview-inline img {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  object-fit: cover;
}

.file-preview-inline .file-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
}

.file-preview-inline .file-name {
  font-size: 12px;
  font-weight: 600;
  color: #1a1a1a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.file-preview-inline .file-size {
  font-size: 10px;
  color: #6b7280;
}

.file-preview-inline .remove-file {
  background: none;
  border: none;
  color: #6b7280;
  cursor: pointer;
  padding: 4px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.file-preview-inline .remove-file:hover {
  background: rgba(0, 0, 0, 0.1);
  color: #ef4444;
}

.file-preview-inline .remove-file svg {
  width: 16px;
  height: 16px;
}

/* Message Bubbles */
.pesan-kamu,
.pesan-ai {
  padding: 14px 18px;
  border-radius: 18px;
  line-height: 1.65;
  max-width: 72%;
  word-wrap: break-word;
  font-size: 16.5px;
  font-weight: 450;
  position: relative;
  animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* User Message (Right) */
.pesan-kamu {
  background: linear-gradient(135deg, #6bbdff, #4f8ef7);
  color: white;
  align-self: flex-end;
  border-bottom-right-radius: 6px;
  box-shadow: 0 3px 10px rgba(79, 142, 247, 0.22);
  margin-left: 20%;
}

/* AI Message (Left) */
.pesan-ai {
  background: #ffffff;
  color: #1a1a1a;
  align-self: flex-start;
  border: 1px solid rgba(0, 0, 0, 0.07);
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.08);
  border-bottom-left-radius: 6px;
  margin-right: 20%;
}

.pesan-ai b {
  color: #202124;
  font-weight: 600;
}

.pesan-ai i {
  color: #555;
  font-style: italic;
}

/* File Popup */
.file-popup {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1000;
  animation: fadeIn 0.2s ease-out;
}

.file-popup.active {
  display: block;
}

.popup-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
}

.popup-content {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: white;
  border-radius: 16px;
  width: 90%;
  max-width: 480px;
  max-height: 80vh;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translate(-50%, -40%);
  }
  to {
    opacity: 1;
    transform: translate(-50%, -50%);
  }
}

.popup-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.popup-header h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  color: #1a1a1a;
}

.close-btn {
  background: none;
  border: none;
  color: #6b7280;
  cursor: pointer;
  padding: 8px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.close-btn:hover {
  background: rgba(0, 0, 0, 0.05);
  color: #1a1a1a;
}

.popup-body {
  padding: 16px;
}

.upload-option {
  display: flex;
  align-items: center;
  width: 100%;
  padding: 16px;
  border: none;
  background: rgba(79, 142, 247, 0.05);
  border-radius: 12px;
  margin-bottom: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: left;
}

.upload-option:hover {
  background: rgba(79, 142, 247, 0.1);
  transform: translateY(-1px);
}

.upload-option:last-child {
  margin-bottom: 0;
}

.option-icon {
  width: 48px;
  height: 48px;
  background: rgba(79, 142, 247, 0.1);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 16px;
  color: #4f8ef7;
}

.option-text {
  flex: 1;
}

.option-title {
  font-size: 16px;
  font-weight: 600;
  color: #1a1a1a;
  margin-bottom: 4px;
}

.option-desc {
  font-size: 14px;
  color: #6b7280;
}

/* Typing Indicator – Lebih Halus */
.dot-typing {
  display: inline-block;
  width: 56px;
  height: 16px;
  position: relative;
  margin-top: 8px;
}

.dot-typing::before,
.dot-typing::after,
.dot-typing span {
  content: "";
  position: absolute;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #888;
  animation: dotPulse 1.4s infinite ease-in-out;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.dot-typing::before { left: 0; animation-delay: 0s; }
.dot-typing span { left: 18px; animation-delay: 0.2s; }
.dot-typing::after { left: 36px; animation-delay: 0.4s; }

@keyframes dotPulse {
  0%, 60%, 100% {
    transform: translateY(0) scale(0.8);
    opacity: 0.5;
  }
  40% {
    transform: translateY(-6px) scale(1);
    opacity: 1;
  }
}

/* Responsif */
@media (max-width: 768px) {
  #out, .input-area {
    padding: 20px 16px;
  }
  .pesan-kamu, .pesan-ai {
    max-width: 88%;
  }
  .pesan-kamu { margin-left: 8%; }
  .pesan-ai { margin-right: 8%; }
  
  .popup-content {
    width: 95%;
    max-width: none;
  }
  
  .file-preview-inline {
    max-width: 150px;
  }
}

/* Chat Header */
.chat-header {
  padding: 20px 80px 20px 40px;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
}

.chat-header h2 {
  margin: 0;
  font-size: 24px;
  font-weight: 700;
  color: #1a1a1a;
  display: flex;
  align-items: center;
}

.chat-header h2::before {
  margin-right: 0px;
  font-size: 28px;
}

/* Responsif untuk header */
@media (max-width: 768px) {
  .chat-header {
    padding: 15px 16px;
  }
  .chat-header h2 {
    font-size: 20px;
  }
}


