/* ── PAGE HEADER ── */
.chat-header-bg {
  background: linear-gradient(135deg, #1b5e20 0%, #2e7d32 60%, #66bb6a 100%);
}

.page-header {
  padding-top: 64px;
  padding-bottom: 48px;
  text-align: center;
  color: white;
  position: relative;
  overflow: hidden;
}

.page-header::before {
  content: '🌾';
  position: absolute;
  font-size: 180px;
  opacity: 0.06;
  top: -20px;
  right: 60px;
  pointer-events: none;
}

.page-header::after {
  content: '';
  position: absolute;
  bottom: -2px; left: 0; right: 0;
  height: 50px;
  background: var(--cream);
  clip-path: ellipse(55% 100% at 50% 100%);
}

.page-header-content { position: relative; z-index: 2; }
.page-icon { font-size: 48px; margin-bottom: 12px; }

.page-header h1 {
  font-family: 'Baloo 2', cursive;
  font-size: 36px;
  font-weight: 800;
  margin-bottom: 8px;
}

.page-header p { font-size: 16px; opacity: 0.85; }

/* ── CHAT MAIN LAYOUT ── */
.chat-main {
  padding: 32px 24px 60px;
  max-width: 1200px;
  margin: 0 auto;
}

.chat-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 24px;
  align-items: start;
}

/* ── LEFT SIDEBAR ── */
.chat-sidebar {
  display: flex;
  flex-direction: column;
  gap: 20px;
  position: sticky;
  top: 80px;
}

.sidebar-section {
  background: var(--white);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}

.sidebar-section h3 {
  font-size: 14px;
  font-weight: 700;
  color: var(--brown);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 7px;
}

.sidebar-section h3 i { color: var(--green); }

/* QUICK BUTTONS */
.quick-btns {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.quick-btn {
  background: var(--cream);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 9px 12px;
  font-family: 'Poppins', sans-serif;
  font-size: 12.5px;
  color: var(--text);
  text-align: left;
  cursor: pointer;
  transition: all 0.2s;
  line-height: 1.4;
}

.quick-btn:hover {
  background: var(--green-pale);
  border-color: var(--green-light);
  color: var(--green);
  transform: translateX(3px);
}

/* ABOUT BOX */
.about-box {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.about-box p {
  font-size: 13px;
  color: var(--text-light);
  display: flex;
  align-items: center;
  gap: 6px;
}

/* CHAT HISTORY */
.chat-history-list {
  max-height: 150px;
  overflow-y: auto;
  margin-bottom: 10px;
}

.no-history {
  font-size: 13px;
  color: var(--text-light);
  text-align: center;
  padding: 10px 0;
}

.history-item {
  font-size: 12px;
  color: var(--text-light);
  padding: 6px 8px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.2s;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.history-item:hover {
  background: var(--green-pale);
  color: var(--green);
}

.btn-clear {
  width: 100%;
  background: #ffebee;
  border: 1px solid #ffcdd2;
  border-radius: 8px;
  padding: 8px;
  font-family: 'Poppins', sans-serif;
  font-size: 12px;
  color: #c62828;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.2s;
}

.btn-clear:hover { background: #ffcdd2; }

/* ── CHAT BOX ── */
.chat-box-wrapper {
  background: var(--white);
  border-radius: 20px;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  height: 78vh;
  min-height: 520px;
  overflow: hidden;
}

/* CHATBOX HEADER */
.chatbox-header {
  background: linear-gradient(90deg, #1b5e20, #2e7d32);
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.chatbox-header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.bot-avatar {
  width: 40px; height: 40px;
  background: rgba(255,255,255,0.2);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  border: 2px solid rgba(255,255,255,0.3);
}

.chatbox-header-left strong {
  display: block;
  color: white;
  font-size: 15px;
}

.chatbox-header-left span {
  font-size: 12px;
  color: rgba(255,255,255,0.75);
}

.chatbox-header-right {
  display: flex;
  gap: 8px;
}

.icon-btn {
  width: 34px; height: 34px;
  background: rgba(255,255,255,0.15);
  border: 1px solid rgba(255,255,255,0.25);
  border-radius: 8px;
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  transition: background 0.2s;
}

.icon-btn:hover { background: rgba(255,255,255,0.28); }

/* MESSAGES AREA */
.messages-area {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  scroll-behavior: smooth;
}

.messages-area::-webkit-scrollbar { width: 4px; }
.messages-area::-webkit-scrollbar-track { background: transparent; }
.messages-area::-webkit-scrollbar-thumb {
  background: #c8e6c9;
  border-radius: 2px;
}

/* MESSAGES */
.msg {
  display: flex;
  gap: 10px;
  max-width: 85%;
  animation: fadeUp 0.3s ease;
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

.msg.user {
  margin-left: auto;
  flex-direction: row-reverse;
}

.msg-avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
  align-self: flex-end;
  background: var(--green-pale);
}

.msg.user .msg-avatar { background: #fff3e0; }

.msg-content { display: flex; flex-direction: column; gap: 4px; }

.msg-bubble {
  padding: 12px 16px;
  border-radius: 18px;
  font-size: 14px;
  line-height: 1.65;
}

.msg.bot .msg-bubble {
  background: #f1f8f1;
  color: var(--text);
  border-bottom-left-radius: 4px;
}

.msg.user .msg-bubble {
  background: var(--green);
  color: white;
  border-bottom-right-radius: 4px;
}

.msg-bubble p { margin-bottom: 6px; }
.msg-bubble p:last-child { margin-bottom: 0; }
.msg-bubble ul {
  padding-left: 18px;
  margin: 6px 0;
}
.msg-bubble ul li { margin-bottom: 4px; }
.msg-bubble strong { font-weight: 600; }

.msg-time {
  font-size: 10px;
  color: var(--text-light);
  padding: 0 4px;
}

.msg.user .msg-time { text-align: right; }

/* TYPING INDICATOR */
.typing-wrap {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 0 20px 12px;
}

.typing-indicator {
  display: flex;
  gap: 5px;
  padding: 12px 16px;
  background: #f1f8f1;
  border-radius: 18px;
  border-bottom-left-radius: 4px;
}

.typing-indicator span {
  width: 8px; height: 8px;
  background: var(--green-light);
  border-radius: 50%;
  animation: bounce 1.2s ease-in-out infinite;
}

.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }

@keyframes bounce {
  0%,60%,100% { transform: translateY(0); }
  30%          { transform: translateY(-7px); }
}

/* INPUT AREA */
.chat-input-wrapper {
  border-top: 1px solid var(--border);
  padding: 12px 16px;
  background: #fafafa;
  flex-shrink: 0;
}

.language-hint {
  font-size: 11.5px;
  color: var(--text-light);
  margin-bottom: 8px;
  text-align: center;
}

.input-row {
  display: flex;
  align-items: flex-end;
  gap: 10px;
}

.chat-textarea {
  flex: 1;
  border: 1.5px solid var(--border);
  border-radius: 14px;
  padding: 11px 16px;
  font-family: 'Poppins', sans-serif;
  font-size: 14px;
  color: var(--text);
  outline: none;
  resize: none;
  max-height: 120px;
  transition: border-color 0.2s;
  line-height: 1.5;
  background: var(--white);
}

.chat-textarea:focus { border-color: var(--green); }
.chat-textarea::placeholder { color: #aaa; }

.voice-btn {
  width: 42px; height: 42px;
  border-radius: 50%;
  border: 1.5px solid var(--border);
  background: var(--white);
  color: var(--text-light);
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  flex-shrink: 0;
}

.voice-btn:hover { background: var(--green-pale); color: var(--green); border-color: var(--green); }
.voice-btn.listening { background: #ffebee; color: #e53935; border-color: #ef9a9a; animation: pulse 1s infinite; }

@keyframes pulse {
  0%,100% { box-shadow: 0 0 0 0 rgba(229,57,53,0.3); }
  50%      { box-shadow: 0 0 0 8px rgba(229,57,53,0); }
}

.send-btn {
  width: 42px; height: 42px;
  border-radius: 50%;
  border: none;
  background: var(--green);
  color: white;
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  flex-shrink: 0;
}

.send-btn:hover { background: #1b5e20; transform: scale(1.05); }
.send-btn:disabled { background: #ccc; cursor: not-allowed; transform: none; }

.voice-status {
  text-align: center;
  margin-top: 8px;
  font-size: 13px;
  color: #e53935;
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.voice-dot {
  width: 8px; height: 8px;
  background: #e53935;
  border-radius: 50%;
  animation: blink 0.8s infinite;
}

@keyframes blink {
  0%,100% { opacity: 1; }
  50%      { opacity: 0; }
}

/* ── RESPONSIVE ── */
@media (max-width: 900px) {
  .chat-layout {
    grid-template-columns: 1fr;
  }
  .chat-sidebar {
    position: static;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
  }
  .chat-box-wrapper { height: 70vh; }
}

@media (max-width: 600px) {
  .chat-main { padding: 20px 12px 40px; }
  .chat-sidebar { grid-template-columns: 1fr; }
  .chat-box-wrapper { height: 65vh; }
  .msg { max-width: 95%; }
}