/* ════════════════════════════════════════════
   LTE AI Tutor — front-end styles
   Palette matches letstalkeducation.com.au
   ════════════════════════════════════════════ */

.lte-tutor-app,
.lte-locked {
  --lte-sage: #7fa688;
  --lte-sage-dark: #5c8264;
  --lte-sage-light: #ddeede;
  --lte-sage-pale: #eef5ef;
  --lte-blue: #5b7fa6;
  --lte-blue-dark: #3d5f82;
  --lte-blue-light: #dde8f2;
  --lte-coral: #e8806a;
  --lte-coral-dark: #c45f48;
  --lte-coral-light: #fde8e2;
  --lte-off: #f9f5f3;
  --lte-text: #1e2d24;
  --lte-muted: #6b7c72;
  --lte-border: #d0dbd2;
  font-family: 'Nunito', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color: var(--lte-text);
  box-sizing: border-box;
}

.lte-tutor-app *,
.lte-locked * { box-sizing: border-box; }

/* ── LAYOUT ── */
.lte-tutor-app {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 20px;
  align-items: start;
  max-width: 1080px;
  margin: 0 auto;
}

/* ── HISTORY SIDEBAR ── */
.lte-history {
  background: #fff;
  border: 1px solid var(--lte-border);
  border-radius: 16px;
  padding: 18px 16px;
  display: flex;
  flex-direction: column;
  max-height: calc(var(--lte-chat-height) + 190px);
}

.lte-history-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--lte-border);
  margin-bottom: 12px;
}

.lte-history-head h3 {
  font-size: 14px;
  font-weight: 800;
  margin: 0;
  color: var(--lte-text);
}

.lte-new-btn {
  background: var(--lte-sage-dark);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 6px 12px;
  font-family: inherit;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
  transition: background .2s;
  white-space: nowrap;
}

.lte-new-btn:hover { background: #4a6b51; }

.lte-history-list {
  overflow-y: auto;
  flex: 1;
  min-height: 80px;
  margin: 0 -4px;
  padding: 0 4px;
}

.lte-history-list::-webkit-scrollbar { width: 4px; }
.lte-history-list::-webkit-scrollbar-thumb { background: var(--lte-border); border-radius: 2px; }

.lte-history-empty {
  font-size: 12px;
  color: var(--lte-muted);
  line-height: 1.6;
  margin: 8px 0;
}

.lte-conv {
  display: block;
  width: 100%;
  text-align: left;
  background: var(--lte-off);
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 6px;
  cursor: pointer;
  transition: all .15s;
  font-family: inherit;
  position: relative;
}

.lte-conv:hover {
  border-color: var(--lte-sage);
  background: var(--lte-sage-pale);
}

.lte-conv.is-active {
  background: var(--lte-sage-light);
  border-color: var(--lte-sage-dark);
}

.lte-conv-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--lte-text);
  line-height: 1.4;
  margin-bottom: 3px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  padding-right: 18px;
}

.lte-conv-meta {
  font-size: 11px;
  color: var(--lte-muted);
}

.lte-conv-actions {
  position: absolute;
  top: 6px;
  right: 6px;
  display: none;
  gap: 2px;
}

.lte-conv:hover .lte-conv-actions,
.lte-conv.is-active .lte-conv-actions { display: flex; }

.lte-conv-action {
  background: rgba(255,255,255,.9);
  border: 1px solid var(--lte-border);
  border-radius: 5px;
  width: 20px;
  height: 20px;
  font-size: 10px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  color: var(--lte-muted);
  display: flex;
  align-items: center;
  justify-content: center;
}

.lte-conv-action:hover { color: var(--lte-coral-dark); border-color: var(--lte-coral); }

.lte-history-note {
  font-size: 11px;
  color: var(--lte-muted);
  line-height: 1.5;
  margin: 12px 0 0;
  padding-top: 12px;
  border-top: 1px solid var(--lte-border);
}

/* ── MOBILE HISTORY TOGGLE ── */
.lte-history-toggle {
  display: none;
  width: 100%;
  background: #fff;
  border: 1px solid var(--lte-border);
  border-radius: 10px;
  padding: 10px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 800;
  color: var(--lte-sage-dark);
  cursor: pointer;
  margin-bottom: 12px;
}

/* ── MODE SELECTOR ── */
.lte-mode-selector {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.lte-mode-btn {
  padding: 7px 14px;
  border-radius: 22px;
  border: 2px solid var(--lte-border);
  background: #fff;
  font-family: inherit;
  font-size: 12px;
  font-weight: 800;
  color: var(--lte-muted);
  cursor: pointer;
  transition: all .2s;
}

.lte-mode-btn:hover { border-color: var(--lte-sage); color: var(--lte-sage-dark); }

.lte-mode-btn.is-active {
  background: var(--lte-sage);
  border-color: var(--lte-sage);
  color: #fff;
}

/* ── CHAT BOX ── */
.lte-chat-box {
  background: #fff;
  border: 1px solid var(--lte-border);
  border-radius: 18px;
  padding: 22px;
  box-shadow: 0 8px 30px rgba(127,166,136,.08);
}

.lte-chat-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--lte-border);
  margin-bottom: 14px;
}

.lte-chat-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--lte-sage-dark), var(--lte-sage));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}

.lte-chat-head-text { min-width: 0; }

.lte-chat-head-text h4 {
  font-size: 15px;
  font-weight: 800;
  margin: 0 0 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lte-chat-head-text p {
  font-size: 11px;
  color: var(--lte-muted);
  margin: 0;
}

.lte-dot-online {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #4ade80;
  display: inline-block;
  margin-right: 5px;
  animation: lte-pulse 2s infinite;
}

@keyframes lte-pulse { 0%,100%{opacity:1} 50%{opacity:.4} }

.lte-mode-bar {
  background: var(--lte-sage-pale);
  border: 1px solid var(--lte-sage-light);
  border-radius: 9px;
  padding: 8px 13px;
  font-size: 12px;
  font-weight: 700;
  color: var(--lte-sage-dark);
  margin-bottom: 14px;
  line-height: 1.5;
}

/* ── SUGGESTIONS ── */
.lte-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 14px;
}

.lte-suggestion {
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  color: var(--lte-sage-dark);
  background: var(--lte-sage-pale);
  border: 1px solid var(--lte-sage-light);
  border-radius: 18px;
  padding: 6px 12px;
  cursor: pointer;
  transition: background .2s;
}

.lte-suggestion:hover { background: var(--lte-sage-light); }

/* ── MESSAGES ── */
.lte-messages {
  height: var(--lte-chat-height, 520px);
  overflow-y: auto;
  padding: 6px 0;
  margin-bottom: 14px;
  scroll-behavior: smooth;
}

.lte-messages::-webkit-scrollbar { width: 4px; }
.lte-messages::-webkit-scrollbar-thumb { background: var(--lte-border); border-radius: 2px; }

.lte-msg {
  display: flex;
  gap: 9px;
  margin-bottom: 14px;
  align-items: flex-start;
  animation: lte-fade .25s ease;
}

@keyframes lte-fade { from{opacity:0;transform:translateY(5px)} to{opacity:1;transform:none} }

.lte-msg.is-user { flex-direction: row-reverse; }

.lte-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 800;
}

.lte-avatar-ai { background: var(--lte-sage-light); color: var(--lte-sage-dark); }
.lte-avatar-user { background: var(--lte-blue-light); color: var(--lte-blue-dark); }

.lte-bubble {
  max-width: 78%;
  padding: 11px 15px;
  border-radius: 15px;
  font-size: 14px;
  line-height: 1.65;
  word-wrap: break-word;
  overflow-wrap: anywhere;
}

.lte-bubble.is-ai {
  background: var(--lte-sage-light);
  border-bottom-left-radius: 4px;
}

.lte-bubble.is-user {
  background: var(--lte-blue-light);
  border-bottom-right-radius: 4px;
}

.lte-bubble.is-error {
  background: var(--lte-coral-light);
  color: var(--lte-coral-dark);
  border-bottom-left-radius: 4px;
  font-size: 13px;
}

.lte-bubble ul, .lte-bubble ol { margin: 8px 0; padding-left: 20px; }
.lte-bubble li { margin-bottom: 4px; }

/* ── TYPING ── */
.lte-typing {
  background: var(--lte-sage-light);
  border-radius: 15px;
  border-bottom-left-radius: 4px;
  padding: 13px 17px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.lte-typing span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--lte-sage-dark);
  opacity: .7;
  animation: lte-bounce 1.4s infinite;
}

.lte-typing span:nth-child(2) { animation-delay: .2s; }
.lte-typing span:nth-child(3) { animation-delay: .4s; }

@keyframes lte-bounce { 0%,60%,100%{transform:none} 30%{transform:translateY(-5px)} }

/* ── INPUT ── */
.lte-input-row {
  display: flex;
  gap: 9px;
  align-items: flex-end;
}

.lte-input {
  flex: 1;
  padding: 12px 15px;
  border: 1.5px solid var(--lte-border);
  border-radius: 11px;
  font-family: inherit;
  font-size: 14px;
  outline: none;
  background: var(--lte-off);
  resize: none;
  max-height: 120px;
  line-height: 1.5;
  transition: all .2s;
  color: var(--lte-text);
}

.lte-input:focus {
  border-color: var(--lte-sage);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(127,166,136,.15);
}

.lte-send {
  padding: 12px 20px;
  background: linear-gradient(135deg, var(--lte-sage-dark), var(--lte-sage));
  color: #fff;
  border: none;
  border-radius: 11px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
  transition: all .2s;
  white-space: nowrap;
  flex-shrink: 0;
}

.lte-send:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 5px 15px rgba(127,166,136,.3);
}

.lte-send:disabled { opacity: .5; cursor: not-allowed; transform: none; }

.lte-chat-foot {
  display: flex;
  justify-content: flex-end;
  margin-top: 6px;
}

.lte-char-count { font-size: 11px; color: var(--lte-muted); }

/* ── LOCKED STATE ── */
.lte-locked {
  background: #fff;
  border: 1px solid var(--lte-border);
  border-radius: 18px;
  padding: 48px 32px;
  text-align: center;
  max-width: 520px;
  margin: 0 auto;
}

.lte-locked-icon { font-size: 40px; margin-bottom: 14px; }

.lte-locked h3 {
  font-size: 20px;
  font-weight: 800;
  margin: 0 0 10px;
  color: var(--lte-text);
}

.lte-locked p {
  font-size: 14px;
  color: var(--lte-muted);
  line-height: 1.7;
  margin: 0 0 22px;
}

.lte-locked-btn {
  display: inline-block;
  padding: 12px 26px;
  background: var(--lte-sage-dark);
  color: #fff !important;
  border-radius: 11px;
  font-size: 14px;
  font-weight: 800;
  text-decoration: none !important;
  transition: background .2s;
}

.lte-locked-btn:hover { background: #4a6b51; }

/* ── RESPONSIVE ── */
@media (max-width: 860px) {
  .lte-tutor-app { grid-template-columns: 1fr; }

  .lte-history {
    display: none;
    max-height: 320px;
    order: -1;
  }

  .lte-history.is-open { display: flex; }

  .lte-history-toggle { display: block; }
}

@media (max-width: 560px) {
  .lte-chat-box { padding: 16px 14px; }
  .lte-bubble { max-width: 86%; }
  .lte-messages { height: 380px; }
  .lte-mode-btn { font-size: 11px; padding: 6px 11px; }
}
