/* ==========================
   IFHE Assistant UI Styling
========================== */

/* --- Google Fonts --- */
@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@500;600;700&family=Poppins:wght@400;500;600&display=swap');

/* --- Global Variables --- */
:root {
  --primary: #1b3a7a;
  --accent: #274b9f;
  --highlight: #ffcc00;
  --card-bg: #ffffff;
  --light-bg: #f4f8fc;
  --text-dark: #0c1c3a;
  --radius: 12px;
  --shadow: 0 4px 14px rgba(0, 0, 0, 0.1);
}

/* --- Global Reset --- */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  height: 100%;
  width: 100%;
  font-family: "Poppins", "Segoe UI", Arial, sans-serif;
  background: var(--light-bg);
  color: var(--text-dark);
  line-height: 1.6;
  overflow: hidden;
}

/* ==========================
   HEADER - HIDDEN
========================== */
header, .site-header, #header {
  display: none !important;
}

/* ==========================
   MAIN LAYOUT
========================== */
main.content {
  display: flex;
  flex-direction: column;
  height: 100vh;
  width: 100%;
  max-width: 900px;
  margin: 0 auto;
  padding: 10px;
}

/* ==========================
   CHAT SECTION - FULL HEIGHT
========================== */
.chat-section {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: #ffffff;
  border-radius: 0;
  box-shadow: none;
  padding: 0;
  overflow: hidden;
}

/* ==========================
   CHAT CONTAINER - PROPER FLEX
========================== */
.chat-container {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: #f9fbff;
  border-radius: 0;
  box-shadow: none;
  padding: 20px;
  gap: 15px;
}

/* ==========================
   CHAT BOX - SCROLLABLE AREA
========================== */
.chat-box {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 15px;
  scroll-behavior: smooth;
  min-height: 0;
}

/* Welcome message styling */
.chat-box:empty::before {
  content: "👋 Welcome! How can I help you?";
  display: block;
  padding: 15px 20px;
  background: linear-gradient(135deg, #eaf0ff, #f8faff);
  color: #1b3a7a;
  border-radius: 12px;
  font-size: 15px;
  text-align: center;
  align-self: flex-start;
  max-width: 80%;
}

/* Custom scrollbar */
.chat-box::-webkit-scrollbar {
  width: 8px;
}

.chat-box::-webkit-scrollbar-track {
  background: transparent;
}

.chat-box::-webkit-scrollbar-thumb {
  background: rgba(27, 58, 122, 0.2);
  border-radius: 4px;
}

.chat-box::-webkit-scrollbar-thumb:hover {
  background: rgba(27, 58, 122, 0.3);
}

/* ==========================
   CHAT MESSAGES
========================== */
.chat-message {
  animation: fadeIn 0.3s ease-in-out;
  max-width: 75%;
  padding: 10px 14px;
  border-radius: 12px;
  line-height: 1.5;
  font-size: 14px;
  word-wrap: break-word;
}

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

.user-message {
  align-self: flex-end;
  background: linear-gradient(135deg, #1b3a7a, #274b9f);
  color: #fff;
  border-radius: 16px 16px 0 16px;
  box-shadow: 0 2px 8px rgba(27, 58, 122, 0.25);
}

.bot-message {
  align-self: flex-start;
  background: linear-gradient(135deg, #eaf0ff, #f8faff);
  color: #1b3a7a;
  border-radius: 16px 16px 16px 0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.typing::after {
  content: " ";
  display: inline-block;
  width: 0.7em;
  animation: dots 1s steps(3, end) infinite;
}

@keyframes dots {
  0%, 20% { content: ""; }
  40% { content: "."; }
  60% { content: ".."; }
  80%, 100% { content: "..."; }
}

/* ==========================
   CHAT FORM - WRAPPER WITH BUTTON INSIDE
========================== */
#chat-form,
form#chat-form,
.chat-form {
  position: relative !important;
  display: block !important;
  width: 100% !important;
  padding: 0 !important;
  margin: 0 !important;
  flex-shrink: 0 !important;
}

/* ==========================
   TEXTAREA STYLING - WITH PADDING FOR BUTTON
========================== */
#chat-input,
textarea#chat-input,
.chat-form textarea {
  width: 100% !important;
  min-height: 50px !important;
  max-height: 120px !important;
  padding: 12px 60px 12px 15px !important; /* Extra padding on right for button */
  font-size: 14px !important;
  line-height: 1.5 !important;
  border-radius: 25px !important; /* Rounded pill shape */
  border: 1px solid #d0d7de !important;
  background: #fff !important;
  font-family: inherit !important;
  resize: none !important;
  overflow-y: auto !important;
  transition: border-color 0.2s ease, box-shadow 0.2s ease !important;
  box-sizing: border-box !important;
}

.chat-form textarea::placeholder {
  color: rgba(12, 28, 58, 0.45);
}

.chat-form textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 8px rgba(39, 75, 159, 0.2);
  outline: none;
}

.chat-form textarea::-webkit-scrollbar {
  width: 6px;
}

.chat-form textarea::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.2);
  border-radius: 3px;
}

/* ==========================
   BUTTON STYLING - POSITIONED INSIDE TEXTAREA
========================== */
#chat-form button,
form#chat-form button,
.chat-form button {
  position: absolute !important;
  right: 8px !important;
  bottom: 8px !important;
  height: 36px !important;
  width: 36px !important;
  min-width: 36px !important;
  max-width: 36px !important;
  padding: 0 !important;
  margin: 0 !important;
  background: var(--primary) !important;
  color: white !important;
  border: none !important;
  border-radius: 50% !important; /* Circular button */
  cursor: pointer !important;
  font-weight: 600 !important;
  font-size: 16px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  transition: all 0.25s ease !important;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15) !important;
  z-index: 10 !important;
}

.chat-form button:hover {
  background: var(--accent) !important;
  transform: scale(1.1);
  box-shadow: 0 3px 10px rgba(27, 58, 122, 0.3) !important;
}

.chat-form button:active {
  transform: scale(0.95);
}

/* ==========================
   RESPONSIVE
========================== */
@media (max-width: 768px) {
  main.content {
    padding: 5px;
  }
  
  .chat-section {
    padding: 10px;
  }
  
  .chat-container {
    padding: 10px;
  }
  
  .chat-message {
    font-size: 13px;
    max-width: 85%;
  }
  
  .chat-form {
    padding: 0;
  }
  
  .chat-form textarea {
    font-size: 14px;
  }
  
  .chat-form button {
    padding: 0;
    font-size: 14px;
  }
}

@media (max-width: 480px) {
  main.content {
    max-width: 100%;
    padding: 3px;
  }
  
  .chat-section {
    border-radius: 0;
  }
}

/* ==========================
   FOOTER
========================== */
footer {
  display: none;
}

/* ==========================
   FORM SECTIONS (if used elsewhere)
========================== */
.form-section {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 2rem;
  max-width: 850px;
  margin: 0 auto;
  max-height: calc(100vh - 180px);
  overflow-y: auto;
}

.results {
  margin-top: 1.5rem;
  background: #f1f5ff;
  border-radius: var(--radius);
  padding: 1rem;
  box-shadow: var(--shadow);
  max-height: calc(100vh - 180px);
  overflow-y: auto;
}