/* Lanka Guide – Tourist Chatbot Stylesheet */

/* Reset & Variables */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:          #F7F9F8;
  --surface:     #FFFFFF;
  --surface2:    #F1F4F2;
  --border:      #DDE5DF;
  --primary:     #256D45;
  --primary-h:   #1A5534;
  --primary-lt:  #EAF3EE;
  --text:        #101D15;
  --text-muted:  #4E6B5E;
  --text-light:  #8FAAA0;
  --user-bg:     #256D45;
  --user-text:   #FFFFFF;
  --bot-bg:      #FFFFFF;
  --bot-border:  #DDE5DF;
  --shadow-sm:   0 1px 3px rgba(0,0,0,.05);
  --shadow-md:   0 4px 16px rgba(0,0,0,.07);
  --shadow-lg:   0 8px 32px rgba(0,0,0,.09);
  --radius:      12px;
  --radius-sm:   8px;
  --font:        'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --header-h:    72px;
  --input-h:     76px;
  --sidebar-w:   240px;
  --transition:  0.18s ease;
}

[data-theme="dark"] {
  --bg:          #0D1A13;
  --surface:     #162018;
  --surface2:    #1C2A20;
  --border:      #2A3D30;
  --primary:     #38A868;
  --primary-h:   #2D8F57;
  --primary-lt:  #0E2519;
  --text:        #DDE8E2;
  --text-muted:  #7FA693;
  --text-light:  #4D6B5C;
  --user-bg:     #1D5C37;
  --user-text:   #FFFFFF;
  --bot-bg:      #162018;
  --bot-border:  #2A3D30;
  --shadow-sm:   0 1px 3px rgba(0,0,0,.30);
  --shadow-md:   0 4px 16px rgba(0,0,0,.40);
  --shadow-lg:   0 8px 32px rgba(0,0,0,.50);
}

html, body {
  height: 100%;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  overflow: hidden;
}

/* Scrollbar */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-light); }

/* Header */
.header {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  height: var(--header-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.header-inner {
  display: flex; align-items: center; justify-content: space-between;
  height: 100%; padding: 0 20px;
}
.brand { display: flex; align-items: center; gap: 11px; }

.brand-logo {
  width: 52px; height: 64px;
  flex-shrink: 0;
  display: block;
  object-fit: contain;
}

.brand-text { display: flex; flex-direction: column; }
.brand-name { font-size: 17px; font-weight: 700; color: var(--text); line-height: 1.2; letter-spacing: -0.01em; }
.brand-dot { color: var(--primary); font-weight: 600; }
.brand-sub { font-size: 11px; color: var(--text-muted); font-weight: 500; letter-spacing: 0.06em; text-transform: uppercase; }

.header-actions { display: flex; align-items: center; gap: 8px; }
.status-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--border);
  transition: background var(--transition);
}
.status-dot.online { background: #22c55e; box-shadow: 0 0 0 3px rgba(34,197,94,.18); }
.status-dot.offline { background: #ef4444; }

.btn-icon {
  width: 34px; height: 34px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: transparent;
  color: var(--text-muted); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all var(--transition);
}
.btn-icon svg { width: 15px; height: 15px; }
.btn-icon:hover { background: var(--primary-lt); border-color: var(--primary); color: var(--primary); }

/* Layout */
.main {
  display: flex;
  height: 100vh;
  padding-top: var(--header-h);
  padding-bottom: calc(var(--input-h) + 20px);
}

/* Sidebar */
.sidebar {
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  background: var(--surface);
  border-right: 1.5px solid var(--border);
  overflow-y: auto;
  padding: 20px 12px;
  transition: transform var(--transition), width var(--transition);
  flex-shrink: 0;
}
.sidebar.hidden { transform: translateX(calc(-1 * var(--sidebar-w))); width: 0; min-width: 0; padding: 0; overflow: hidden; }

.sidebar-section { margin-bottom: 24px; }
.sidebar-title {
  font-size: 10.5px; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.07em; color: var(--text-light);
  margin-bottom: 8px; padding: 0 6px;
}
.quick-actions { display: flex; flex-direction: column; gap: 2px; }
.quick-btn {
  display: block;
  padding: 9px 12px; border-radius: var(--radius-sm);
  border: 1px solid transparent; background: transparent;
  color: var(--text-muted); font-size: 13px; font-weight: 500;
  cursor: pointer; text-align: left; width: 100%;
  transition: all var(--transition);
}
.quick-btn:hover { background: var(--primary-lt); color: var(--primary); }

.sidebar-about { font-size: 12px; color: var(--text-light); line-height: 1.65; padding: 0 6px; }

/* Chat area */
.chat-area {
  flex: 1; overflow-y: auto;
  display: flex; flex-direction: column;
  padding: 24px 0;
  scroll-behavior: smooth;
}

/* Hero */
.chat-hero {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; text-align: center;
  flex: 1; padding: 48px 24px 40px;
  animation: fadeIn 0.4s ease;
}
.chat-hero.hidden { display: none; }
.hero-title {
  font-size: 28px; font-weight: 700;
  color: var(--text);
  margin-bottom: 12px; letter-spacing: -0.02em;
  max-width: 480px;
  line-height: 1.25;
}
.hero-subtitle {
  font-size: 15px; color: var(--text-muted);
  line-height: 1.65; max-width: 440px; margin-bottom: 32px;
}
.hero-suggestions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; max-width: 520px; }
.suggestion-chip {
  padding: 9px 18px; border-radius: 99px;
  border: 1.5px solid var(--border); background: var(--surface);
  color: var(--text-muted); font-size: 13.5px; font-weight: 500;
  cursor: pointer; transition: all var(--transition);
}
.suggestion-chip:hover { border-color: var(--primary); background: var(--primary-lt); color: var(--primary); }

/* Messages */
.messages { display: flex; flex-direction: column; gap: 6px; padding: 0 20px; }

.message-row {
  display: flex; align-items: flex-end; gap: 10px;
  animation: messageIn 0.22s ease;
}
.message-row.user { justify-content: flex-end; }
.message-row.assistant { justify-content: flex-start; }

.msg-avatar {
  width: 44px; height: 54px; flex-shrink: 0;
  display: block; object-fit: contain;
}

.msg-col {
  max-width: min(72%, 640px);
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.msg-bubble {
  max-width: 100%;
  min-width: fit-content;
  width: fit-content;
  padding: 11px 15px;
  border-radius: var(--radius);
  line-height: 1.65;
  font-size: 14.5px;
  word-break: break-word;
  white-space: normal;
  position: relative;
}

.message-row.user .msg-bubble {
  background: var(--user-bg);
  color: var(--user-text);
  border-bottom-right-radius: 3px;
  box-shadow: var(--shadow-sm);
}
.message-row.assistant .msg-bubble {
  background: var(--bot-bg);
  color: var(--text);
  border: 1px solid var(--bot-border);
  border-bottom-left-radius: 3px;
  box-shadow: var(--shadow-sm);
}

/* Markdown inside bubbles */
.msg-bubble h1, .msg-bubble h2, .msg-bubble h3 {
  font-weight: 600; margin: 12px 0 6px; line-height: 1.3;
  color: var(--primary);
}
.msg-bubble h1 { font-size: 17px; }
.msg-bubble h2 { font-size: 16px; }
.msg-bubble h3 { font-size: 15px; }
.msg-bubble p { margin-bottom: 8px; }
.msg-bubble p:last-child { margin-bottom: 0; }
.msg-bubble ul { list-style: none; padding-left: 0; margin-bottom: 8px; }
.msg-bubble ol { padding-left: 18px; margin-bottom: 8px; }
.msg-bubble ul li {
  position: relative; padding-left: 22px; margin-bottom: 5px;
}
.msg-bubble ul li::before {
  content: '';
  position: absolute; left: 2px; top: 6px;
  width: 10px; height: 6px;
  border-left: 2px solid var(--primary);
  border-bottom: 2px solid var(--primary);
  transform: rotate(-45deg);
  border-radius: 0 0 1px 1px;
}
.msg-bubble ol li { margin-bottom: 5px; }
.msg-bubble strong { font-weight: 600; }
.msg-bubble em { font-style: italic; color: var(--text-muted); }
.msg-bubble code {
  font-family: 'Courier New', monospace; font-size: 13px;
  background: var(--surface2); padding: 2px 6px; border-radius: 4px;
  border: 1px solid var(--border);
}
.msg-bubble pre {
  background: var(--surface2); padding: 12px; border-radius: var(--radius-sm);
  overflow-x: auto; margin: 8px 0; border: 1px solid var(--border);
}
.msg-bubble pre code { background: none; border: none; padding: 0; }
.msg-bubble hr { border: none; border-top: 1px solid var(--border); margin: 12px 0; }
.msg-bubble blockquote {
  border-left: 3px solid var(--primary); padding-left: 12px;
  color: var(--text-muted); margin: 8px 0;
}
.msg-bubble table {
  width: 100%; border-collapse: collapse; font-size: 13px; margin: 8px 0;
}
.msg-bubble th, .msg-bubble td {
  padding: 7px 10px; border: 1px solid var(--border); text-align: left;
}
.msg-bubble th { background: var(--surface2); font-weight: 600; }
.msg-bubble a { color: var(--primary); text-decoration: underline; }

/* Quotation box */
.msg-bubble .quotation-block {
  background: var(--surface2); border: 1px solid var(--border);
  border-left: 3px solid var(--primary);
  border-radius: var(--radius-sm); padding: 12px; margin: 8px 0;
  font-family: monospace; font-size: 13px; white-space: pre-wrap;
}

/* Message timestamp */
.msg-time {
  font-size: 10px; color: var(--text-light);
  margin-top: 4px; text-align: right;
  padding: 0 2px;
}
.message-row.user .msg-time { text-align: right; }
.message-row.assistant .msg-time { text-align: left; padding-left: 38px; }

/* Escalation banner */
.escalation-banner {
  background: var(--primary-lt);
  border: 1px solid rgba(37, 109, 69, 0.25);
  border-radius: var(--radius);
  padding: 14px 18px;
  margin: 8px 0;
  font-size: 14px;
  color: var(--primary);
  display: flex; gap: 10px; align-items: flex-start;
}
.escalation-banner .esc-icon { font-size: 16px; flex-shrink: 0; }
[data-theme="dark"] .escalation-banner {
  background: var(--primary-lt);
  border-color: rgba(56, 168, 104, .20);
  color: var(--primary);
}

/* Initial trip planning form */
.trip-form-row {
  margin-top: 10px;
  align-items: flex-start;
}

.trip-form-col {
  width: min(720px, calc(100vw - 330px));
  max-width: min(88%, 720px);
}

.trip-form {
  background: var(--bot-bg);
  border: 1px solid var(--bot-border);
  border-radius: var(--radius);
  border-bottom-left-radius: 3px;
  box-shadow: var(--shadow-md);
  padding: 18px;
}

.trip-form-header {
  margin-bottom: 16px;
}

.trip-form-header h3 {
  color: var(--primary);
  font-size: 17px;
  font-weight: 600;
  margin-bottom: 5px;
}

.trip-form-header p {
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.5;
}

.trip-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(190px, 1fr));
  gap: 13px;
  margin-bottom: 13px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group.full-width {
  width: 100%;
  margin-bottom: 13px;
}

.form-group label {
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
}

.form-group label span {
  color: #dc2626;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface2);
  color: var(--text);
  font-family: var(--font);
  font-size: 13.5px;
  padding: 10px 11px;
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 109, 69, .10);
  background: var(--surface);
}

.form-group textarea {
  resize: vertical;
  min-height: 64px;
}

.interest-options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 2px;
}

.interest-chip {
  display: inline-flex !important;
  align-items: center;
  cursor: pointer;
}

.interest-chip input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.interest-chip span {
  display: inline-block;
  padding: 8px 13px;
  border-radius: 99px;
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--text-muted);
  font-size: 12.5px;
  font-weight: 500;
  transition: all var(--transition);
}

.interest-chip input:checked + span {
  background: var(--primary-lt);
  border-color: var(--primary);
  color: var(--primary);
}

.interest-chip:hover span {
  border-color: var(--primary);
  color: var(--primary);
}

.trip-form-submit {
  width: 100%;
  margin-top: 5px;
  padding: 12px 16px;
  border: none;
  border-radius: var(--radius-sm);
  background: var(--primary);
  color: #fff;
  font-family: var(--font);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--transition);
}

.trip-form-submit:hover {
  background: var(--primary-h);
}

@media (max-width: 700px) {
  .trip-form-col {
    width: calc(100vw - 72px);
    max-width: calc(100vw - 72px);
  }

  .trip-form-grid {
    grid-template-columns: 1fr;
  }

  .trip-form {
    padding: 14px;
  }
}


/* Typing indicator */
.typing-indicator {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 20px;
  animation: fadeIn 0.2s ease;
}
.typing-indicator.hidden { display: none; }
.typing-avatar {
  width: 44px; height: 54px; flex-shrink: 0;
  display: block; object-fit: contain;
}
.typing-dots { display: flex; gap: 4px; align-items: center; }
.typing-dots span {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--text-light);
  animation: bounce 1.2s infinite;
}
.typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.typing-dots span:nth-child(3) { animation-delay: 0.4s; }
.typing-label { font-size: 12px; color: var(--text-light); }

/* Input bar */
.input-bar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 100;
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 12px 16px 8px;
}
.input-inner {
  display: flex; align-items: flex-end; gap: 8px;
  max-width: 860px; margin: 0 auto;
}
.sidebar-toggle { flex-shrink: 0; align-self: flex-end; margin-bottom: 2px; }

.input-wrapper {
  flex: 1; background: var(--surface2);
  border: 1.5px solid var(--border); border-radius: var(--radius);
  transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
  display: flex; align-items: flex-end;
}
.input-wrapper:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 109, 69, .10);
  background: var(--surface);
}

.message-input {
  flex: 1; border: none; outline: none; resize: none;
  background: transparent; color: var(--text);
  font-family: var(--font); font-size: 14.5px; line-height: 1.55;
  padding: 11px 14px; max-height: 180px; overflow-y: auto;
}
.message-input::placeholder { color: var(--text-light); }

.send-btn {
  width: 40px; height: 40px; border-radius: var(--radius-sm);
  border: none; background: var(--primary);
  color: #fff; cursor: pointer; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  transition: all var(--transition);
  align-self: flex-end; margin-bottom: 2px;
}
.send-btn:hover:not(:disabled) { background: var(--primary-h); }
.send-btn:disabled { background: var(--border); color: var(--text-light); cursor: not-allowed; }
.send-btn svg { width: 16px; height: 16px; }

.input-footer {
  text-align: center; font-size: 11px;
  color: var(--text-light); margin-top: 6px;
}

/* Animations */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes messageIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes bounce {
  0%, 60%, 100% { transform: translateY(0); }
  30%           { transform: translateY(-5px); }
}

/* Responsive */
@media (max-width: 700px) {
  :root { --sidebar-w: 220px; }
  .sidebar { position: fixed; top: var(--header-h); bottom: 0; left: 0; z-index: 90; }
  .sidebar.hidden { transform: translateX(-100%); }
  .brand-sub { display: none; }
  .hero-title { font-size: 22px; }
  .hero-subtitle { font-size: 14px; }
  .msg-col { max-width: 88%; }
  .msg-bubble { font-size: 14px; }
}
