* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  /** background-image: linear-gradient(
    90deg,
    rgba(150, 214, 239, 0.6) 0%,
    rgba(143, 121, 255, 0.6) 100%
  );
  background-color: #f0f4f8;
  min-height: 100vh;**/
  margin: 0;
  font-family: "Roboto", "museo-slab", Helvetica, Arial, san-serif !important;
  margin-top: 172px;
}

.login-container {
  max-width: 732px;
  margin: 60px auto;
  background: #cbdef3ff;
  border-radius: 12px;
  border: 1px solid #9bb5eeff;
  box-shadow: 8px 8px 16px rgba(0, 0, 0, 0.3);
  padding: 32px 24px;
  display: flex;
  flex-direction: column;
  height: 625px;
}

.chat-container {
  margin-top: auto;
  margin-bottom: 0;
}

.login-header {
  background: #f8f9fa;
  color: black;
  padding: 20px;
  text-align: center;
  position: relative;
}

.chat-header {
  color: black;
  padding: 20px;
  text-align: center;
  position: relative;
  flex-shrink: 0;
  /* background: rgba(255, 255, 255, 0.95); */
  z-index: 10;
}

.login-header h2,
.chat-header h2 {
  font-size: 1.8em;
  font-weight: 600;
  margin-bottom: 5px;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.chat-body {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  position: relative;
}

.login-form {
  padding: 40px 30px;
}

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  margin-bottom: 8px;
  font-weight: 500;
  color: #333;
}

.form-group input {
  width: 100%;
  padding: 16px 20px;
  border: 2px solid rgba(0, 0, 0, 0.08);
  border-radius: 12px;
  font-family: inherit;
  font-size: 15px;
  transition: all 0.3s ease;
  background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
  box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.05);
}

.form-group input:focus {
  outline: none;
  border-color: #72bfdb;
  background: #ffffff;
  box-shadow:
    inset 0 2px 10px rgba(0, 0, 0, 0.05),
    0 0 0 4px rgba(114, 191, 219, 0.1);
}

.login-button {
  width: 100%;
  background: linear-gradient(135deg, #72bfdb 0%, #5ca7c7 100%);
  color: white;
  border: none;
  border-radius: 12px;
  padding: 16px 24px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 6px 20px rgba(114, 191, 219, 0.3);
}

.login-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(114, 191, 219, 0.4);
}

.error-message {
  background: #fee;
  border: 1px solid #fcc;
  color: #c66;
  padding: 12px 16px;
  border-radius: 8px;
  margin-bottom: 20px;
  font-size: 14px;
}

.chat-messages {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 15px;
  min-height: 100%;
}

.message {
  max-width: 80%;
  padding: 15px 20px;
  border-radius: 20px;
  word-wrap: break-word;
  line-height: 1.4;
  position: relative;
  animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.user-message {
  background-color: lavender !important;
  color: #333;
  align-self: flex-end;
  margin-left: auto;
  margin-bottom: 8px !important;
  border: 1px solid #e0e0e0;
  border-bottom-right-radius: 5px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
  font-weight: 300;
}

.user-message div {
  color: #0171b9;
}

.bot-message {
  background: aliceblue !important;
  color: #333;
  align-self: flex-start;
  margin-bottom: 8px !important;
  border: 1px solid #e0e0e0;
  border-bottom-left-radius: 5px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
  font-weight: 300;
}

.typing-indicator {
  background-color: white;
  color: #666;
  align-self: flex-start;
  font-style: italic;
  border: 1px solid #e0e0e0;
  animation: typing 1.5s infinite;
}

@keyframes typing {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

.citations {
  margin-top: 15px;
  padding: 12px;
  background: #e8f4f8;
  border-left: 4px solid #007dbb;
  border-radius: 8px;
  font-size: 0.85em;
  color: #555;
}

.citations-title {
  font-weight: bold;
  margin-bottom: 8px;
  color: #007dbb;
  cursor: pointer;
  user-select: none;
}

.citations-content {
  display: none;
  margin-top: 8px;
}

.citations-content.expanded {
  display: block;
}

.citation-item {
  margin-bottom: 8px;
  padding: 8px;
  background: rgba(0, 125, 187, 0.1);
  border-radius: 4px;
}

.iblock-cards-wrapper {
  position: relative;
  margin-top: 15px;
}

.iblock-scroll-arrows {
  position: relative;
  margin-bottom: 8px;
  height: 24px;
}

.iblock-scroll-arrow {
  background: #bedcf6;
  color: white;
  border: none;
  border-radius: 4px;
  width: 32px;
  height: 24px;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  transition: background 0.2s;
  position: absolute;
  top: 0;
}

.iblock-scroll-arrow.left-arrow {
  right: 2.5rem;
  left: auto;
}

.iblock-scroll-arrow.right-arrow {
  right: 0;
}

.iblock-scroll-arrow:hover {
  background: #0056b3;
}

.iblock-scroll-arrow.visible {
  display: flex;
}

.iblock-cards {
  display: flex;
  gap: 15px;
  overflow-x: auto;
  padding-bottom: 10px;
  cursor: grab;
  user-select: none;
}

.iblock-cards::-webkit-scrollbar {
  height: 6px;
}

.iblock-cards::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 3px;
}

.iblock-cards::-webkit-scrollbar-thumb {
  background: #c1c1c1;
  border-radius: 3px;
}

.iblock-card {
  display: flex;
  flex-direction: column;
  color: inherit;
  border: 1px solid #ddd;
  border-radius: 6px;
  padding: 10px;
  background: #fff;
  width: 250px;
  flex-shrink: 0;
}

.iblock-image-wrapper {
  position: relative;
  margin-bottom: 8px;
}

.iblock-card img {
  width: 100%;
  border-radius: 4px;
  display: block;
  object-fit: cover;
}

.iblock-details-btn {
  position: absolute;
  bottom: 8px;
  right: 8px;
  background: #bedcf6;
  color: white;
  padding: 6px 12px;
  border-radius: 4px;
  text-decoration: none;
  font-size: 0.75em;
  font-weight: 600;
  transition: background 0.2s;
  cursor: pointer;
}

.iblock-details-btn:hover {
  background: #bdb0ff;
}

.iblock-card h4 {
  margin: 0 0 6px 0;
  color: #333;
  font-size: 0.9em;
}

.iblock-excerpt {
  color: #555;
  font-size: 0.75em;
  margin-bottom: 8px;
}

.iblock-grades {
  color: #333;
  font-size: 0.75em;
  margin-bottom: 6px;
  margin-top: auto;
  padding-top: 8px;
  text-align: center;
}

.iblock-grades strong {
  font-weight: 700;
}

.iblock-tags {
  margin-top: 10px;
}

.iblock-card .tag {
  display: inline-block;
  padding: 2px 6px;
  margin: 2px;
  background: #333;
  color: white;
  border-radius: 3px;
  font-size: 0.7em;
}

.chat-input-container {
  padding: 20px;
  flex-shrink: 0;
  /* background: rgba(255, 255, 255, 0.95); */
  border-top: 1px solid rgba(0, 0, 0, 0.1);
  position: relative;
  z-index: 10;
}

.input-row {
  display: flex;
  gap: 15px;
  align-items: center;
  margin-bottom: 10px;
}

.button-group {
  display: flex;
  gap: 4px;
  justify-content: space-between;
  align-items: center;
}

.action-btn {
  background: #007dbb !important;
  color: white !important;
  border: none !important;
  padding: 8px 16px !important;
  border-radius: 6px !important;
  cursor: pointer !important;
  font-size: 14px !important;
  transition: background 0.3s;
  white-space: nowrap;
  height: auto !important;
  line-height: 1.4 !important;
  text-decoration: none !important;
  display: inline-block !important;
  font-family: "Segoe UI", Arial, sans-serif !important;
  font-weight: 500 !important;
  text-indent: 0 !important;
  overflow: visible !important;
  text-overflow: clip !important;
  vertical-align: middle !important;
}

.action-btn:hover:not([style*="pointer-events: none"]) {
  background: #0056b3;
}

.action-btn.new-chat {
  background: #6c757d !important;
}

.action-btn.new-chat:hover {
  background: #5a6268 !important;
}

.input-wrapper {
  flex: 1;
  position: relative;
}

.chat-input {
  width: 100%;
  padding: 15px 20px;
  border: 2px solid #e0e0e0;
  border-radius: 25px;
  resize: none;
  max-height: 120px;
  font-family: inherit;
  font-size: 14px;
  transition: border-color 0.3s ease;
  scrollbar-width: none; /* Firefox */
  -ms-overflow-style: none; /* IE and Edge */
}

.chat-input:focus {
  outline: none;
  border-color: #007dbb;
  background: white;
}

.chat-input::-webkit-scrollbar {
  display: none;
}

.send-button {
  background: linear-gradient(135deg, #007dbb 0%, #0056b3 100%);
  color: white;
  border: none;
  border-radius: 50%;
  width: 50px;
  height: 50px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(0, 125, 187, 0.3);
}

.send-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 125, 187, 0.4);
}

.send-button:disabled {
  background: #ccc;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.message-time {
  display: none;
}

.chat-body::-webkit-scrollbar {
  width: 6px;
}

.chat-body::-webkit-scrollbar-track {
  background: #f1f1f1;
}

.chat-body::-webkit-scrollbar-thumb {
  background: #c1c1c1;
  border-radius: 3px;
}

.chat-messages::-webkit-scrollbar {
  width: 6px;
}

.chat-messages::-webkit-scrollbar-track {
  background: #f1f1f1;
}

.chat-messages::-webkit-scrollbar-thumb {
  background: #c1c1c1;
  border-radius: 3px;
}

@media (max-width: 768px) {
  body {
    padding: 10px;
  }
  .chat-container {
    height: 100vh;
    border-radius: 0;
  }
  .message {
    max-width: 85%;
  }
}
.PeBL-logo {
  width: 400px;
  height: auto;
  padding: 1rem;
}
@media (max-height: 875px) {
  .PeBL-logo {
    width: 250px;
    height: auto;
    padding: 1rem;
  }
}
/* ================================
   AI INTRO EXIT
================================ */

.ai-intro {
  transition:
    opacity 0.45s ease,
    transform 0.45s ease,
    height 0.45s ease;
}

.ai-intro.hidden {
  opacity: 0;
  transform: translateY(-30px);
  height: 0;
  overflow: hidden;
  margin: 0 !important;
  padding: 0 !important;
  pointer-events: none;
}

/* ================================
   APP MODE – PIN INPUT
================================ */

.chat-container.app-mode {
  position: relative;
  width: 75%;
  margin: 0 auto;
  height: calc(100vh - 350px) !important;
  display: flex;
  flex-direction: column;
}

/* Chat body animates upward */
.chat-container.app-mode .chat-body {
  flex: 1;
  overflow-y: auto;
  animation: slideIntoIntro 0.45s ease forwards;
}

/* Input is FIXED inside container, not animated */
.chat-container.app-mode .chat-input-container {
  position: sticky;
  bottom: 0;
  flex-shrink: 0;
  background: #ffffff;
  border-top: 1px solid rgba(0, 0, 0, 0.1);
  animation: none !important;
  transform: none !important;
}

/* ================================
   ANIMATIONS
================================ */

@keyframes slideIntoIntro {
  from {
    transform: translateY(40px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

@keyframes fadeUp {
  from {
    transform: translateY(16px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

/* ================================
   RESPONSIVE
================================ */

@media (max-width: 992px) {
  .chat-container.app-mode {
    width: 90%;
  }
}

@media (max-width: 576px) {
  .chat-container.app-mode {
    width: 100%;
  }
}

.chat-body {
  overflow-y: auto;
  scroll-behavior: smooth;
}

/* ================================
   SAMPLE QUESTIONS
================================ */

.sample-questions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.sample-question-btn {
  background: #ffffff;
  border: 2px solid #4e73a3;
  color: #4e73a3;
  padding: 10px 18px;
  border-radius: 25px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s ease;
  font-family: inherit;
  white-space: nowrap;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.sample-question-btn:hover {
  background: #4e73a3;
  color: #ffffff;
  border-color: #4e73a3;
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.sample-question-btn:active {
  transform: translateY(0);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}
