/* ========================= */
/* Ask Rifqi AI */
/* ========================= */

.ai-chat-btn {
  position: fixed;
  right: 20px;
  bottom: 20px;
  width: 65px;
  height: 65px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(135deg, #149ddd, #0d6efd);
  color: white;
  font-size: 28px;
  z-index: 9999;
  box-shadow: 0 10px 30px rgba(0,0,0,0.2);
  transition: 0.3s;
}

.ai-chat-btn:hover {
  transform: scale(1.08);
}

.ai-chatbox {
  position: fixed;
  right: 20px;
  bottom: 100px;
  width: 360px;
  height: 550px;
  background: white;
  border-radius: 20px;
  overflow: hidden;
  z-index: 9999;
  box-shadow: 0 20px 50px rgba(0,0,0,0.2);
  display: flex;
  flex-direction: column;
}

.ai-header {
  background: linear-gradient(135deg, #149ddd, #0d6efd);
  color: white;
  padding: 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.ai-subtitle {
  margin: 0;
  font-size: 12px;
  opacity: 0.8;
}

/* .close-ai-btn {
  background: transparent;
  border: none;
  color: white;
  font-size: 18px;
} */

.ai-messages {
  flex: 1;
  overflow-y: auto;
  padding: 15px;
  background: #f7f9fc;
}

.ai-message {
  padding: 12px 15px;
  border-radius: 15px;
  margin-bottom: 15px;
  max-width: 85%;
  line-height: 1.5;
  margin-top: 15px;
}

.ai-message {
  white-space: pre-line;
}

.ai-message.bot {
  background: white;
  box-shadow: 0 5px 15px rgba(0,0,0,0.05);
}

.ai-message.user {
  background: #149ddd;
  color: white;
  margin-left: auto;
}

.ai-input-area {
  display: flex;
  border-top: 1px solid #ddd;
  background: white;
}

.ai-input-area input {
  flex: 1;
  border: none;
  padding: 15px;
  outline: none;
}

.ai-input-area button {
  width: 60px;
  border: none;
  background: #149ddd;
  color: white;
}

.suggested-questions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.suggest-btn {
  border: none;
  padding: 8px 12px;
  border-radius: 20px;
  background: white;
  font-size: 13px;
  box-shadow: 0 3px 10px rgba(0,0,0,0.08);
  transition: 0.3s;
}

.suggest-btn:hover {
  background: #149ddd;
  color: white;
}

.typing {
  display: inline-block;
}

.typing::after {
  content: '...';
  animation: dots 1s infinite;
}

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

@media (max-width: 768px) {

  .ai-chatbox {
    width: calc(100% - 20px);
    right: 10px;
    left: 10px;
    bottom: 90px;
    height: 80vh;
  }

}

.welcome-message {
  white-space: normal;
}

.welcome-message ul {
  margin: 6px 0 0;
  padding-left: 20px;
}

.welcome-message li {
  margin-bottom: 4px;
}

.welcome-message br {
  line-height: 1;
}

.ai-message.bot ul {
  margin: 6px 0 0;
  padding-left: 20px;
}

.ai-message.bot li {
  margin-bottom: 4px;
}

.ai-message.bot br {
  line-height: 1;
}

/* ========================= */
/* AI Window Controls */
/* ========================= */

.ai-window-controls {
  display: flex;
  align-items: center;
  gap: 4px;
}

.ai-control-btn {
  width: 32px;
  height: 32px;
  padding: 0;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: white;
  font-size: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition:
    background 0.2s ease,
    transform 0.2s ease;
}

.ai-control-btn:hover {
  background: rgba(255, 255, 255, 0.18);
}

.ai-control-btn:active {
  transform: scale(0.92);
}

/* ========================= */
/* Minimized State */
/* ========================= */

.ai-chatbox.ai-minimized {
  height: 72px;
}

.ai-chatbox.ai-minimized .ai-messages,
.ai-chatbox.ai-minimized .ai-input-area {
  display: none;
}

.ai-chatbox.ai-minimized .ai-header {
  flex: 1;
}

/* ========================= */
/* Maximized State */
/* ========================= */

.ai-chatbox.ai-maximized {
  top: 20px;
  right: 20px;
  bottom: 20px;
  left: 20px;

  width: auto;
  height: auto;
  max-width: none;
  border-radius: 18px;
}

.ai-chatbox.ai-maximized .ai-message {
  max-width: 75%;
}

/* Transisi ukuran */
.ai-chatbox {
  transition:
    width 0.25s ease,
    height 0.25s ease,
    top 0.25s ease,
    right 0.25s ease,
    bottom 0.25s ease,
    left 0.25s ease,
    border-radius 0.25s ease;
}

/* Mobile */
@media (max-width: 768px) {
  .ai-chatbox.ai-maximized {
    top: 8px;
    right: 8px;
    bottom: 8px;
    left: 8px;

    width: auto;
    height: auto;
    border-radius: 14px;
  }

  .ai-chatbox.ai-minimized {
    top: auto;
    right: 10px;
    bottom: 90px;
    left: 10px;

    width: auto;
    height: 70px;
  }

  .ai-chatbox.ai-maximized .ai-message {
    max-width: 88%;
  }
}

.ai-chatbox.ai-maximized .ai-messages {
  padding: 24px 40px;
}

.ai-chatbox.ai-maximized .ai-message {
  width: fit-content;
  max-width: min(760px, 75%);
  margin-bottom: 16px;
}

.ai-chatbox.ai-maximized .ai-message.bot {
  margin-left: 0;
  margin-right: auto;
}

.ai-chatbox.ai-maximized .ai-message.user {
  margin-left: auto;
  margin-right: 0;
}

.ai-chatbox.ai-maximized .suggested-questions {
  max-width: 760px;
  margin-left: 0;
  margin-right: auto;
}

.ai-chatbox.ai-maximized .ai-input-area {
  padding: 0 24px;
}

.ai-chatbox.ai-maximized .ai-input-area input {
  padding: 16px;
}

@media (max-width: 768px) {
  .ai-chatbox.ai-maximized .ai-messages {
    padding: 16px;
  }

  .ai-chatbox.ai-maximized .ai-message {
    max-width: 90%;
  }

  .ai-chatbox.ai-maximized .ai-input-area {
    padding: 0;
  }
}