/* HDAIR Client v0.1 - mobile-first, sederhana & cepat */

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  margin: 0;
  padding: 0;
}

body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: #e9edf5;
  color: #1c2333;
  font-size: 16px;
}

.app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  background: #f6f8fc;
}

/* Header */
.app-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  background: #10213f;
  color: #fff;
  flex-shrink: 0;
}

.app-logo {
  font-size: 18px;
  opacity: 0.85;
}

.app-title {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.12em;
  margin: 0;
  flex: 1;
}

.status {
  font-size: 12px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 999px;
  white-space: nowrap;
}

.status--online {
  background: #d9f7e6;
  color: #0d7a3f;
}

.status--offline {
  background: #ffe0e0;
  color: #b32020;
}

.status--checking {
  background: #e4e8f0;
  color: #55607a;
}

/* Bar provider & mode (v0.2 → v0.3) */
.provider-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px 12px;
  padding: 6px 16px;
  background: #eef2f9;
  border-bottom: 1px solid #e2e7f0;
  color: #55607a;
  font-size: 12px;
  flex-shrink: 0;
}

.provider-bar strong {
  color: #10213f;
  font-weight: 700;
}

.provider-bar__info {
  white-space: nowrap;
}

.mode-picker {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
}

.mode-picker__select {
  font-size: 12px;
  font-weight: 600;
  font-family: inherit;
  color: #10213f;
  background: #fff;
  border: 1px solid #cfd6e4;
  border-radius: 999px;
  padding: 4px 8px;
  min-height: 28px;
  cursor: pointer;
}

.mode-picker__select:focus {
  outline: none;
  border-color: #2f6fed;
}

/* Area percakapan */
.chat {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.message {
  display: flex;
  flex-direction: column;
  max-width: 85%;
}

.message--user {
  align-self: flex-end;
  align-items: flex-end;
}

.message--ai,
.message--error {
  align-self: flex-start;
  align-items: flex-start;
}

.message__meta {
  font-size: 11px;
  font-weight: 600;
  color: #7a8499;
  margin: 0 0 4px 4px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.message__bubble {
  padding: 10px 14px;
  border-radius: 16px;
  line-height: 1.45;
  word-wrap: break-word;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.message--user .message__bubble {
  background: #2f6fed;
  color: #fff;
  border-bottom-right-radius: 4px;
}

.message--ai .message__bubble {
  background: #fff;
  color: #1c2333;
  border: 1px solid #e2e7f0;
  border-bottom-left-radius: 4px;
}

.message--error .message__meta {
  color: #b32020;
}

.message--error .message__bubble {
  background: #fff1f1;
  color: #a11b1b;
  border: 1px solid #ffc9c9;
  border-bottom-left-radius: 4px;
}

/* Loading */
.loading {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px;
  color: #55607a;
  font-size: 13px;
  flex-shrink: 0;
}

.loading[hidden] {
  display: none;
}

.loading__dots {
  display: inline-flex;
  gap: 4px;
}

.loading__dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #2f6fed;
  animation: hdair-bounce 1.2s infinite ease-in-out;
}

.loading__dot:nth-child(2) {
  animation-delay: 0.15s;
}

.loading__dot:nth-child(3) {
  animation-delay: 0.3s;
}

@keyframes hdair-bounce {
  0%,
  80%,
  100% {
    transform: translateY(0);
    opacity: 0.4;
  }
  40% {
    transform: translateY(-5px);
    opacity: 1;
  }
}

/* Input pesan */
.composer {
  display: flex;
  gap: 8px;
  padding: 12px 16px;
  background: #fff;
  border-top: 1px solid #e2e7f0;
  flex-shrink: 0;
}

.composer__input {
  flex: 1;
  min-width: 0;
  font-size: 16px;
  padding: 12px 16px;
  border: 1px solid #cfd6e4;
  border-radius: 999px;
  outline: none;
  background: #f6f8fc;
  color: #1c2333;
}

.composer__input:focus {
  border-color: #2f6fed;
  background: #fff;
}

.composer__input:disabled {
  opacity: 0.6;
}

.composer__send {
  font-size: 15px;
  font-weight: 700;
  padding: 12px 20px;
  border: none;
  border-radius: 999px;
  background: #2f6fed;
  color: #fff;
  cursor: pointer;
  flex-shrink: 0;
}

.composer__send:hover:not(:disabled) {
  background: #245cd1;
}

.composer__send:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Desktop */
@media (min-width: 768px) {
  .app {
    max-width: 860px;
    margin: 0 auto;
    border-left: 1px solid #d8deea;
    border-right: 1px solid #d8deea;
    box-shadow: 0 0 32px rgba(16, 33, 63, 0.08);
  }

  .message {
    max-width: 70%;
  }
}
