:root {
    --bg: #0b2941; /* Primary dark blue for background */
    --panel: #193653; /* Medium gray for panels, good contrast with bg */
    --muted: #879fac; /* Muted green-gray for subtle elements */
    --accent: #8B9D8D; /* Using muted green-gray as accent for cohesion */
    --fg: #FFFFFF; /* White for foreground text, high contrast on dark bg */
    --bubble: #7eac9a; /* Muted green-gray for chat bubbles, consistent with theme */
    --user: #FFFFFF; /* White for user elements, ensuring readability */
    --assistant: #2d3e4a;
    --question-box: #435a69
}

@font-face {
  font-family: 'Heiti SC';
  src: url('/static/fonts/heiti-sc-medium.ttf') format('truetype');
  font-weight: 400;
  font-style: normal;
}

@font-face {
  font-family: 'Heiti SC';
  src: url('/static/fonts/heiti-sc-light.ttf') format('truetype');
  font-weight: 300;
  font-style: normal;
}

@font-face {
  font-family: 'Heiti SC';
  src: url('/static/fonts/heiti-sc-medium.ttf') format('truetype');
  font-weight: 500;
  font-style: normal;
}

* {
    box-sizing: border-box
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--fg); 
}

body, p, li {
  font-family: 'Heiti SC', sans-serif;
  font-weight: 400;   /* Regular */
  letter-spacing: 0;  /* Kerning = 0pt */
  text-transform: none; /* Sentence case */
  line-height: 1.6;   /* readability */
}

h1, h2, h3, h4, h5, h6 {
  font-family: 'Heiti SC', sans-serif;
  font-weight: 400;   /* Regular */
  letter-spacing: 0;  /* matches "Kerning: 0pt" */
  text-transform: none; /* keep sentence case */
}

button{
  font-family: 'Heiti SC', sans-serif;
  font-weight: 500;   /* Medium ≈ 500 */
  letter-spacing: 0.05em; /* 50pt is too huge for web, ~0.05em works well */
  text-transform: uppercase; /* Force uppercase */
}

.container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 16px 16px 0 16px
}

.topbar {
    display: flex;
    gap: 12px;
    align-items: center;
    justify-content: space-between;
    background: var(--panel);
    padding: 12px 16px;
    position: sticky;
    top: 0;
    z-index: 10;
    border-bottom: 1px solid #222
}

.brand {
    font-weight: 700;
    background: url("../images/logo.png") no-repeat;
    background-size: 50px;
    height: 50px;
    padding-left: 70px;
    display: flex;
    align-items: center; /* Centers text vertically */
    line-height: 1;
}

.btn {
    border: none;
    padding: 10px 14px;
    border-radius: 12px;
    cursor: pointer
}

.btn.primary {
    background: var(--accent);
    color: #062
}

.btn.secondary {
    background: #334155;
    color: #cbd5e1
}

.chatwrap {
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-height: 80vh
}

.messages {
    flex: 1;
    padding: 14px;
    scroll-behavior: smooth;
    height: 80vh;
    overflow-y: auto;
}

.bubble {
    max-width: 80%;
    padding: 12px 14px;
    border-radius: 16px;
    margin: 8px 0;
    /*box-shadow: 0 2px 12px rgba(0, 0, 0, .25)*/
}

.bubble .role {
    font-size: 14px;
    color: var(--muted);
    margin-bottom: 6px;
    font-weight: bold;
}

.bubble .content {
    white-space: pre-wrap
}

.bubble.bot {
    background: #273549;
}

.bubble.user {
    background: var(--bubble);
    margin-left: auto
}

.bubble.user .role {
    color: var(--user);
}

.empty {
    color: var(--muted);
    text-align: center;   
    display: flex;
    flex-direction: column;   /* stack items vertically */
    justify-content: center;  /* vertical alignment */
    align-items: center;      /* horizontal alignment */
    min-height: 70vh;        /* take full screen height */
}

.composer {
    display: flex;
    flex-direction: column; /* Stack vertically */
    gap: 8px;
}

.textarea-container {
    position: relative;
    flex: 1;
}

.textarea {
    padding-right: 50px;
    width: 100%;
    background: var(--question-box);
    border: 0px solid #1e293b;
    color: var(--user);
    padding: 20px 100px 20px 30px;
    border-radius: 30px;
    resize: none;
    font-size: 16px;
    font-family: 'Heiti SC', sans-serif;
}

.composer-note {
  font-size: 12px;
  color: var(--muted);
  text-align: center;
  margin-top: 0px;
}

.btn-inside {
    position: absolute;
    right: 30px;
    bottom: 26px;
    width: 50px;
    height: 50px;
    border: none;
    border-radius: 50%;
    background: var(--accent);
    color: var(--bg);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    transition: background-color 0.2s;
}

.btn-inside:hover:not(:disabled) {
    background: var(--user);
}

.btn-inside:disabled {
    background: var(--muted);
    cursor: not-allowed;
}

/* Remove the old input-row styles since we're not using it anymore */
.input-row {
    display: none;
}

.textarea:focus {
  outline: none !important;
  border: 0px solid transparent !important;
  box-shadow: none !important;
}

.textarea::placeholder {
    color: var(--muted); /* Uses your brand gray */
    opacity: 1; /* Ensures full opacity across browsers */
    font-family: 'Heiti SC', sans-serif;
}

/* For older browsers */
.textarea::-webkit-input-placeholder {
    color: var(--muted);
}

.textarea::-moz-placeholder {
    color: var(--muted);
    opacity: 1;
}

.textarea:-ms-input-placeholder {
    color: var(--muted);
}

.foot {
    color: #94a3b8;
    text-align: center;
    padding: 16px;
    display: flex;
}

/* Minimal CSS additions to enhance your existing dark theme */

/* Enable proper scrolling for messages container */
.messages {
  overflow-y: auto !important;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: var(--muted) transparent;

}

/* Custom scrollbar that matches your dark theme */
.messages::-webkit-scrollbar {
  width: 6px;
}

.messages::-webkit-scrollbar-track {
  background: transparent;
}

.messages::-webkit-scrollbar-thumb {
  background: var(--muted);
  border-radius: 3px;
  opacity: 0.7;
}

.messages::-webkit-scrollbar-thumb:hover {
  background: var(--accent);
  opacity: 1;
}

/* Smooth animation for new messages */
.bubble {
  animation: fadeInUp 0.3s ease-out;
}

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

/* Ensure composer stays accessible at bottom */
.composer {
  position: sticky;
  bottom: 0px;
  background: var(--bg);
  padding-top: 10px;
  z-index: 5;
  padding-bottom: 10px;
  /*border-top: 1px solid #222;*/
}

/* Loading state styling that matches your theme */
.btn.primary:disabled {
  background: var(--muted) !important;
  color: var(--bg) !important;
  cursor: not-allowed;
}

/* Mobile optimizations */
@media (max-width: 768px) {
  .chatwrap {
    min-height: calc(100vh - 140px); /* Account for header + footer */
  }
  
  .messages {
    height: calc(100vh - 220px); /* Account for all UI elements */
  }
  
  /* Prevent iOS zoom on input focus */
  .textarea {
    font-size: 16px !important;
  }
}

#send-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  padding: 12px;
}

#send-icon, #stop-icon {
  font-size: 16px;
  line-height: 1;
}

#page-loader {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
}

.loader-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(15, 23, 42, 0.8); /* Semi-transparent dark overlay */
  backdrop-filter: blur(1px);
}

.loader-spinner {
    width: 50px;
    height: 50px;
    background: url("../images/logo.png") no-repeat center;
    background-size: contain;
    border: none; /* Remove the rotating border */
    border-radius: 0; /* Remove border radius */
    animation: none; /* Remove rotation animation */
}

/* Optional: Add a subtle pulsing effect instead of rotation */
.loader-spinner {
    width: 50px;
    height: 50px;
    background: url("../images/logo.png") no-repeat center;
    background-size: contain;
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { 
        opacity: 1; 
        transform: scale(1);
    }
    50% { 
        opacity: 0.7; 
        transform: scale(1.05);
    }
}