/* ══════════════════════════════════════════════════
 *  Tumbuh Bermakna — Chat Styles
 * ══════════════════════════════════════════════════ */

/* Reset & Base */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: #f8faf9;
  color: #1a1a1a;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  font-size: 15px;
  line-height: 1.5;
  overflow: hidden;
}

/* Layout */
.wrap {
  width: 100%;
  height: 100%;
  max-width: 600px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  background: #FEFEFE;
  box-shadow: 0 0 40px rgba(0, 0, 0, 0.05);
  position: relative;
}

/* ── Auth Overlay ── */
.auth-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, #00684F 0%, #004d3a 40%, #003d2e 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: safe center;
  z-index: 50;
  padding: 20px 20px 40px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.auth-overlay.hidden {
  display: none;
}

.auth-brand {
  text-align: center;
  margin-bottom: 20px;
  flex-shrink: 0;
}

.auth-brand img {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.3);
  margin-bottom: 10px;
  background: #fff;
  padding: 4px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

.auth-brand h1 {
  color: #fff;
  font-size: 20px;
  font-weight: 700;
}

.auth-brand p {
  color: rgba(255, 255, 255, 0.6);
  font-size: 12px;
  margin-top: 3px;
}

.auth-card {
  background: #fff;
  border-radius: 20px;
  padding: 24px 20px;
  width: 100%;
  max-width: 380px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  flex-shrink: 0;
}

.auth-tabs {
  display: flex;
  background: #f2f2f2;
  border-radius: 12px;
  padding: 4px;
  margin-bottom: 18px;
}

.auth-tab {
  flex: 1;
  text-align: center;
  padding: 10px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  color: #888;
  border: none;
  background: transparent;
  transition: all .2s;
  box-shadow: none;
}

.auth-tab.active {
  background: #fff;
  color: #00684F;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.auth-form {
  display: none;
}

.auth-form.active {
  display: block;
}

.auth-field {
  margin-bottom: 12px;
}

.auth-field label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: #555;
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: .3px;
  cursor: default;
  padding: 0;
  gap: 0;
  align-items: unset;
}

.auth-field input {
  width: 100%;
  padding: 11px 14px;
  border: 1.5px solid #ddd;
  border-radius: 12px;
  font-size: 15px;
  font-family: inherit;
  outline: none;
  transition: border-color .2s, box-shadow .2s;
  background: #fafafa;
  flex: unset;
}

.auth-field input:focus {
  border-color: #00684F;
  box-shadow: 0 0 0 3px rgba(0, 104, 79, .1);
  background: #fff;
}

.auth-field .hint {
  font-size: 11px;
  color: #aaa;
  margin-top: 4px;
}

.btn-auth {
  width: 100%;
  padding: 14px;
  border: none;
  border-radius: 12px;
  background: #00684F;
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  margin-top: 8px;
  transition: background .2s, transform .1s;
  box-shadow: 0 4px 12px rgba(0, 104, 79, .25);
  letter-spacing: .3px;
}

.btn-auth:hover {
  background: #005541;
}

.btn-auth:active {
  transform: scale(.98);
}

.btn-auth:disabled {
  background: #ccc;
  box-shadow: none;
  cursor: default;
}

.auth-error {
  color: #D14043;
  font-size: 13px;
  text-align: center;
  margin-top: 12px;
  min-height: 20px;
  font-weight: 500;
}

.auth-info {
  color: #00684F;
  font-size: 13px;
  text-align: center;
  margin-top: 12px;
  min-height: 20px;
  font-weight: 500;
}

/* ── Top Bar (setelah login) ── */
.topbar {
  background: #00684F;
  color: #fff;
  padding: 12px 18px;
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  z-index: 20;
}

.topbar.show {
  display: flex;
}

.topbar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
}

.topbar-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 15px;
  flex-shrink: 0;
  border: 2px solid rgba(255, 255, 255, 0.3);
}

.topbar-info {
  min-width: 0;
}

.topbar-name {
  font-weight: 600;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar-wa {
  font-size: 11px;
  opacity: 0.7;
}

.btn-logout {
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff;
  padding: 7px 14px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: none;
  transition: background .2s;
  flex-shrink: 0;
}

.btn-logout:hover {
  background: rgba(255, 255, 255, 0.25);
}

/* ── Chat Area ── */
.chat {
  flex: 1;
  overflow-y: auto;
  padding: 24px 20px;
  display: none;
  flex-direction: column;
  gap: 18px;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
}

.chat.show {
  display: flex;
}

.chat::-webkit-scrollbar {
  width: 6px;
}

.chat::-webkit-scrollbar-thumb {
  background: #ccc;
  border-radius: 3px;
}

/* Messages */
.row {
  display: flex;
  gap: 12px;
  align-items: flex-end;
  opacity: 0;
  animation: slideUp .4s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}

.row.user {
  justify-content: flex-end;
}

.avatar {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  border-radius: 50%;
  background: #FEFEFE;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0, 104, 79, 0.2);
  overflow: hidden;
  border: 2px solid #00684F;
}

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.bubble {
  max-width: 85%;
  padding: 14px 18px;
  border-radius: 20px;
  font-size: 15px;
  position: relative;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
  line-height: 1.45;
}

.bot .bubble {
  background: #00684F;
  color: #fff;
  border-top-left-radius: 4px;
}

.user .bubble {
  background: #eef5f2;
  color: #00684F;
  border-bottom-right-radius: 4px;
  border: 1px solid #d8ede6;
}

/* Typing indicator */
.typing-dots {
  display: flex;
  gap: 5px;
  padding: 4px 0;
}

.typing-dots span {
  width: 8px;
  height: 8px;
  background: rgba(255, 255, 255, 0.6);
  border-radius: 50%;
  animation: typingBounce 1.4s infinite ease-in-out;
}

.typing-dots span:nth-child(2) {
  animation-delay: 0.2s;
}

.typing-dots span:nth-child(3) {
  animation-delay: 0.4s;
}

/* Input Bar */
.inputBar {
  padding: 16px 20px 24px;
  background: #FEFEFE;
  border-top: 1px solid #f0f0f0;
  display: none;
  gap: 12px;
  align-items: center;
  z-index: 10;
}

input:not(.auth-field input) {
  flex: 1;
  padding: 14px 18px;
  border-radius: 26px;
  border: 1.5px solid #85B8AC;
  font-size: 15px;
  font-family: inherit;
  outline: none;
  transition: all .2s;
  background: #fcfcfc;
  color: #1a1a1a;
}

input:not(.auth-field input):focus {
  border-color: #00684F;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(0, 104, 79, 0.1);
}

button:not(.auth-tab):not(.btn-auth):not(.btn-logout) {
  padding: 14px 24px;
  border-radius: 26px;
  border: none;
  background: #D14043;
  color: #fff;
  font-weight: 600;
  font-size: 15px;
  cursor: pointer;
  transition: transform .1s, background .2s, opacity .2s;
  flex-shrink: 0;
  letter-spacing: 0.3px;
  box-shadow: 0 2px 8px rgba(209, 64, 67, 0.3);
}

button:not(.auth-tab):not(.btn-auth):not(.btn-logout):active {
  transform: scale(0.96);
}

button:not(.auth-tab):not(.btn-auth):not(.btn-logout):disabled {
  background: #ccc;
  box-shadow: none;
  cursor: default;
}

button:not(.auth-tab):not(.btn-auth):not(.btn-logout):hover:not(:disabled) {
  background: #b8343a;
}

/* Checklist Card */
.card {
  margin: 8px 0;
  background: #fff;
  border: 1.5px solid #85B8AC;
  border-radius: 18px;
  overflow: hidden;
  width: 100%;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.06);
  animation: popIn .4s cubic-bezier(0.34, 1.56, 0.64, 1);
  transition: opacity .3s, transform .3s;
}

.card h3 {
  background: #eef5f2;
  color: #00684F;
  padding: 18px 24px;
  font-size: 16px;
  font-weight: 700;
  border-bottom: 1px solid #d8ede6;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.check {
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.check label {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  cursor: pointer;
  padding: 4px 0;
  transition: opacity .2s;
}

.check label span {
  flex: 1;
  line-height: 1.4;
}

input[type="checkbox"] {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  margin-top: 0;
  appearance: none;
  -webkit-appearance: none;
  border: 2px solid #85B8AC;
  border-radius: 6px;
  background: #fff;
  cursor: pointer;
  position: relative;
  transition: all .2s;
  padding: 0;
  flex: unset;
}

input[type="checkbox"]:checked {
  background: #00684F;
  border-color: #00684F;
}

input[type="checkbox"]:checked::after {
  content: '';
  position: absolute;
  left: 6px;
  top: 2px;
  width: 6px;
  height: 10px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.card button {
  width: calc(100% - 48px);
  margin: 0 24px 24px;
  background: #00684F;
  box-shadow: 0 4px 12px rgba(0, 104, 79, 0.25);
}

.card button:hover:not(:disabled) {
  background: #005541;
}

/* Loading */
.loading {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: #85B8AC;
  font-weight: 600;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.spinner {
  width: 36px;
  height: 36px;
  border: 3px solid #eef5f2;
  border-top-color: #00684F;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

/* Animations */
@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(16px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes popIn {
  from {
    opacity: 0;
    transform: scale(0.95);
  }

  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes typingBounce {

  0%,
  80%,
  100% {
    transform: scale(0.5);
    opacity: 0.4;
  }

  40% {
    transform: scale(1);
    opacity: 1;
  }
}