/**
 * @file
 * Search results styles for the Melchior Extended Search module.
 *
 * This file contains all styles for the RAG (Retrieval-Augmented Generation) search 
 * functionality, including both simple search results and complex AI-powered 
 * conversation interfaces.
 *
 * The CSS follows BEM (Block, Element, Modifier) methodology:
 * - Block: Standalone entity (e.g., .rag-message)
 * - Element: Part of a block (e.g., .rag-message__content)
 * - Modifier: Flag on block/element (e.g., .rag-message--user)
 */

/* 
 * Custom Properties (Variables)
 * ---------------------------
 * Color schemes, spacing, borders and other reusable values
 */
:root {
  /*
   * Main color scheme
   * These define the primary colors used throughout the interface
   */
  --rag-text-color: rgba(0, 0, 0, 0.7);
  --rag-assistant-bg-color: #F3F3F3;         /* Light gray for assistant messages */
  --rag-assistant-text-color: var(--rag-text-color);       /* Dark text color for readability */
  --rag-user-bg-color: rgba(243, 243, 243, 1);
  --rag-user-text-color: var(--rag-text-color);               /* White text on pink background */
  --rag-system-bg-color: #080058;            /* Dark blue for system messages */
  --rag-system-text-color: #fff;             /* White text on dark blue */
  --rag-page-bg-color: #fff;                 /* White page background */
  --rag-error-color: #e53935;                /* Keep error color for distinction */
  --rag-success-color: #4caf50;              /* Keep success color for distinction */
  --rag-warning-color: #ff9800;              /* Keep warning color for distinction */
  --rag-melchior-pink: rgba(255, 0, 121, 1);
  /*
   * UI elements
   * These define common styling patterns for UI components
   */
  --rag-border-radius: 4px;                  /* More subtle rounded corners */
  --rag-input-border-color: #e9d5e6;         /* Light pink border for inputs */
  --rag-input-focus-border-color: #ff0079;   /* Melchior pink for focus */
  --rag-input-focus-shadow: 0 0 0 3px rgba(255, 0, 121, 0.25); /* Pink shadow */
  --rag-card-shadow: 0 4px 12px rgba(0, 0, 0, 0.08); /* Keep subtle shadow */
  
  /* 
   * Spacing scale
   * Consistent spacing values used throughout the interface
   */
  --rag-spacing-xs: 0.25rem;   /* 4px */
  --rag-spacing-sm: 0.5rem;    /* 8px */
  --rag-spacing-md: 1rem;      /* 16px */
  --rag-spacing-lg: 1.5rem;    /* 24px */
  --rag-spacing-xl: 2rem;      /* 32px */
  
  /* 
   * Transitions
   * Predefined timing functions for animations
   */
  --rag-transition-fast: 0.15s ease;
  --rag-transition-normal: 0.3s ease;

  --rag-icon-size: 35px;
  --rag-icon-size-small: 25px;

  --font-serif: 'Bodoni', serif;
  --font-sans-serif: 'Sofia', sans-serif;
}

/* 
 * Base Styles
 * --------------------
 */
body {
  background-color: var(--rag-page-bg-color);
  color: var(--rag-text-color);
  line-height: 1.6;
}

/* 
 * Main Container
 * --------------------
 */
.melchior-search-results {
  /* Box model */
  max-width: 1200px;
  margin: 0 auto;
  padding: var(--rag-spacing-md);
  
  /* Typography */
  font-family: var(--font-sans-serif);
}

.melchior-search-results h3:after {
  content: '';
  display: none;
}

/* 
 * Header Section
 * --------------------
 */
.rag-search-header {
  /* Box model */
  margin-bottom: var(--rag-spacing-xl);
  
  /* Typography */
  text-align: center;
  font-family: var(--font-sans-serif);
}

.rag-search-header h2 {
  /* Box model */
  margin-bottom: var(--rag-spacing-md);
  
  /* Typography */
  font-size: 2.5rem;
  font-weight: 400;
  color: rgba(255, 0, 121, 1);
  letter-spacing: 0.02em;
  font-family: var(--font-sans-serif);
}

/* Information banner */
.rag-search-header .melchior-search-header__subtitle{
  /* Box model */
  display: block;
  max-width: 800px;
  margin: 0 auto var(--rag-spacing-xl);
  padding: var(--rag-spacing-md) var(--rag-spacing-lg);
  
  /* Typography */
  color: #9c9cf3;
  font-style: normal;
  font-size: 16px;
  font-weight: 400;
  text-align: center;
  font-family: var(--font-sans-serif);
}

/* Query highlight styling */
.query-highlight {
  /* Typography */
  color: var(--rag-user-bg-color);
  font-weight: 400;
}

/* 
 * Reset Button
 * --------------------
 */
.rag-reset-button {
  /* Positioning */
  position: relative;
  
  /* Box model */
  display: inline-block;
  max-width: 200px;
  margin: 15px auto;
  padding: 8px 20px;
  
  /* Visual */
  background-color: transparent;
  border: 1px solid var(--rag-user-bg-color);
  border-radius: var(--rag-border-radius);
  
  /* Typography */
  color: var(--rag-user-bg-color);
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  text-align: center;
  
  /* Misc */
  cursor: pointer;
  transition: all var(--rag-transition-normal);
}

.rag-reset-button__icon {
  /* Box model */
  display: inline-block;
  margin-right: var(--rag-spacing-xs);
  
  /* Typography */
  font-size: 1rem;
}

.rag-reset-button:hover {
  /* Visual */
  background-color: var(--rag-user-bg-color);
  box-shadow: 0 4px 8px rgba(255, 0, 121, 0.3);
  
  /* Typography */
  color: white;
  
  /* Transform */
  transform: translateY(-2px);
}

.rag-reset-button:focus {
  /* Visual */
  outline: none;
  box-shadow: 0 0 0 3px rgba(255, 0, 121, 0.3);
}

/* 
 * Conversation Container
 * --------------------
 */
.rag-conversation-container {
  /* Box model */
  width: 100%;
}

.rag-conversation {
  /* Box model */
  width: 100%;
  max-width: 1000px;
  margin: 0 auto 30px;
  padding: 20px 0;
}

/*
 * Messages Container
 * --------------------
 */
.rag-messages {
  /* Box model */
  display: flex;
  flex-direction: column;
  max-height: 700px;
  margin-bottom: 24px;
  padding: 16px 12px;
  gap: 16px;

  
  /* Misc */
  overflow-y: auto;
}

/* 
 * Message Bubbles
 * --------------------
 */
.rag-message {
  /* Positioning */
  position: relative;
  
  /* Box model */
  max-width: 100%;
  padding: 12px 16px;
  margin-bottom: 16px;
  
  /* Visual */
  border-radius: var(--rag-border-radius);
  box-shadow: var(--rag-card-shadow);
  
  /* Misc */
  animation: messageAppear 0.4s ease-out;
  transition: transform var(--rag-transition-normal), box-shadow var(--rag-transition-normal);

  /* Typography */
  font-family: var(--font-sans-serif);
  font-size: 16px;
  font-weight: 400;
  line-height: 130%;
}

.rag-message a {
  color: rgba(55, 30, 142, 1);
}

.rag-message a:hover {
  /* Typography */
  color: rgba(55, 30, 142, 0.7);
  text-decoration: none;
}

.rag-message p {
  font-size: 16px;
  font-weight: 400;
  line-height: 130%;
}

.rag-message--user {
  /* Box model */
  align-self: flex-end;
  
  /* Visual */
  background-color: var(--rag-user-bg-color);
  border-bottom-right-radius: 2px;
  
  /* Typography */
  color: var(--rag-user-text-color);
}

.rag-message--assistant {
  position: relative;
  /* Box model */
  align-self: flex-start;
  width: 100%;
  
  /* Visual */
  background-color: transparent;
  border-bottom-left-radius: 2px;
  box-shadow: none;
  
  /* Typography */
  color: var(--rag-assistant-text-color);
}

.rag-message--assistant::before {
  content: '';
  display: block;
  position: absolute;
  top: -60px;
  left: 0;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background-image: url("../assets/robo_icon_round.svg");
  background-repeat: no-repeat;
  background-position: center;
  background-color: var(--rag-melchior-pink);
}

.rag-message--system {
  /* Box model */
  align-self: center;
  max-width: 90%;
  
  /* Visual */
  background-color: var(--rag-system-bg-color);
  
  /* Typography */
  color: var(--rag-system-text-color);
  text-align: center;
}

.rag-message__content {
  /* Box model */
  padding: 4px 0;
}

.rag-message--assistant .rag-message__content {
  /* Box model */
  padding: 4px 0;
}

.rag-message__avatar {
  /* Positioning */
  position: absolute;
  bottom: -8px;
  
  /* Box model */
  display: flex;
  width: 28px;
  height: 28px;
  align-items: center;
  justify-content: center;
  
  /* Visual */
  border-radius: 50%;
  
  /* Typography */
  font-size: 14px;
}

.rag-message--user .rag-message__avatar {
  /* Positioning */
  right: -8px;
  
  /* Visual */
  background-color: var(--rag-user-bg-color);
}

.rag-message--assistant .rag-message__avatar {
  /* Positioning */
  left: -8px;
  
  /* Visual */
  background-color: var(--rag-assistant-bg-color);
  border: 1px solid #e9d5e6;
}

/* 
 * Conversation Form
 * --------------------
 */
.rag-conversation-form {
  /* Positioning */
  position: relative;
  
  /* Box model */
  display: flex;
  flex-direction: row;
  max-width: 800px;
  margin: 30px auto 12px;
  padding: 0;
}

@media (max-width: 700px) {
  .rag-conversation-form {
    /* Box model */
    padding: 0;
    position: relative;
    margin-bottom: 1rem;
  }
}

.rag-conversation-form .form-item-message {
  /* Box model */
  margin: 0;
  width: 100%;
}

.rag-conversation-guide {
  /* Box model */
  max-width: 800px;
  margin: 0 auto;
  padding: 0 10px;
  font-size: 1.3rem;
  font-family: var(--font-sans-serif);
  color: #B2B2B2;
  text-align: right;
}

.rag-conversation-guide__text {
  /* Typography */
  color: #B2B2B2;
  text-decoration: none;
  padding: 10px 25px 10px 10px;
  background-image: url("../assets/question.svg");
  background-repeat: no-repeat;
  background-position: right center;
  background-size: 20px 20px;
}

.rag-conversation-input {
  /* Box model */
  width: 100%;
  max-width: 100%;
  min-height: 60px;
  padding: 12px 16px;
  display: block;
  
  /* Visual */
  background-color: white;
  border: 1px solid var(--rag-melchior-pink);
  border-radius: 0;
  
  /* Typography */
  color: var(--rag-text-color);
  font-size: 1.5rem;
  line-height: 1.5;
  
  /* Misc */
  resize: none;
  transition: all var(--rag-transition-normal);
}

.rag-conversation-input:focus {
  /* Visual */
  background-color: white;
  border-color: var(--rag-input-focus-border-color);
  box-shadow: var(--rag-input-focus-shadow);
  outline: none;
}

.rag-conversation-input::placeholder {
  /* Typography */
  color: #999;
  font-style: italic;
}

.rag-conversation-form .form-actions {
  /* Positioning */
  position: relative;
  right: auto;
  bottom: auto;
  transform: none;
  text-align: right;
  position: absolute;
  right: 0;
  bottom: 0;
}

@media (max-width: 700px) {
  .rag-conversation-form .form-actions {
    /* Box model */
    position: absolute;
    right: 0;
    bottom: 0;
  }
}

.rag-conversation-form .rag-conversation-submit#edit-submit {
  border-radius: 0;
  background-color: var(--rag-melchior-pink);
  text-indent: -9999px;
  width: 60px;
}

.rag-conversation-submit {
  /* Positioning */
  position: relative;
  
  /* Box model */
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: auto;
  height: 38px;
  padding: 6px 16px;
  
  /* Visual */
  border: none;
  background-image: url("../assets/arrow.svg");
  background-repeat: no-repeat;
  background-position: center;
  
  /* Typography */
  color: white;
  font-size: 14px;
  font-weight: 500;
  height: 60px;
  
  /* Misc */
  cursor: pointer;
  transition: all var(--rag-transition-normal);
}

.rag-conversation-submit:hover {
  /* Transform */
  transform: translateY(-2px);
}

.rag-conversation-submit:active {
  /* Transform */
  transform: translateY(1px);
}

/* 
 * Search Results
 * --------------------
 */
.rag-results {
  /* Box model */
  max-width: 1100px;
  margin-top: var(--rag-spacing-xl);
  margin-left: auto;
  margin-right: auto;
}

.rag-result-count {
  /* Box model */
  margin-bottom: var(--rag-spacing-lg);
  
  /* Typography */
  color: var(--rag-text-color);
  font-size: 1rem;
  font-weight: 500;
  text-align: center;
}

.rag-result-items {
  /* Box model */
  display: flex;
  flex-wrap: wrap;
  width: 100%;
  padding-top: var(--rag-spacing-lg);
  gap: var(--rag-spacing-lg);
}

.rag-result-item {
  /* Box model */
  flex: 1 1 300px;
  padding: var(--rag-spacing-md);
  
  /* Visual */
  background-color: white;
  border: 1px solid var(--rag-input-border-color);
  border-radius: var(--rag-border-radius);
  box-shadow: var(--rag-card-shadow);
  
  /* Misc */
  transition: all var(--rag-transition-normal);
}

.rag-result-item:hover {
  /* Visual */
  background-color: white;
  border-color: var(--rag-input-focus-border-color);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  
  /* Transform */
  transform: translateY(-4px);
}

.rag-result-item__title {
  /* Box model */
  margin: 0 0 15px 0;
}

.rag-result-item__title a {
  /* Typography */
  color: var(--rag-user-bg-color);
  font-size: 1.2rem;
  font-weight: bold;
  text-decoration: none;
}

.rag-result-item__title a:hover {
  /* Typography */
  text-decoration: underline;
}

.rag-result-item__snippet {
  /* Typography */
  color: var(--rag-text-color);
  line-height: 1.5;
}

/* 
 * Error Handling
 * --------------------
 */
.rag-error, 
.rag-no-query {
  /* Box model */
  max-width: 800px;
  margin-bottom: var(--rag-spacing-lg);
  margin-left: auto;
  margin-right: auto;
  padding: var(--rag-spacing-lg);
  
  /* Visual */
  background-color: rgba(255,77,79,0.1);
  border-left: 4px solid #ff4d4f;
  border-radius: 0 var(--rag-border-radius) var(--rag-border-radius) 0;
  
  /* Typography */
  color: #ff4d4f;
}

.rag-error-message {
  /* Box model */
  display: flex;
  padding: var(--rag-spacing-sm);
  align-items: center;
  justify-content: flex-start;
}

.rag-error-icon {
  /* Box model */
  display: flex;
  width: 28px;
  height: 28px;
  margin-right: var(--rag-spacing-sm);
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  
  /* Visual */
  background-color: var(--rag-error-color);
  border-radius: 50%;
  
  /* Typography */
  color: white;
  font-weight: bold;
}

.rag-error-text {
  /* Box model */
  flex: 1;
}

.rag-error-retry {
  /* Box model */
  margin-left: var(--rag-spacing-sm);
  padding: var(--rag-spacing-xs) var(--rag-spacing-md);
  
  /* Visual */
  background-color: var(--rag-system-bg-color);
  border: none;
  border-radius: var(--rag-border-radius);
  
  /* Typography */
  color: white;
  
  /* Misc */
  cursor: pointer;
  transition: all var(--rag-transition-normal);
}

.rag-error-retry:hover {
  /* Visual */
  background-color: #2c5885;
  
  /* Transform */
  transform: translateY(-1px);
}

/* 
 * Connection Status Indicator
 * --------------------
 */
.rag-connection-status {
  /* Box model */
  display: flex;
  margin-bottom: var(--rag-spacing-md);
  padding: var(--rag-spacing-sm) var(--rag-spacing-md);
  align-items: center;
  
  /* Visual */
  background-color: rgba(0, 0, 0, 0.05);
  border-radius: var(--rag-border-radius);
  
  /* Misc */
  animation: fadeIn 0.3s ease-in-out;
}

.rag-connection-status__icon {
  /* Positioning */
  position: relative;
  
  /* Box model */
  width: 12px;
  height: 12px;
  margin-right: var(--rag-spacing-sm);
  
  /* Visual */
  background-color: #ffcc00;
  border-radius: 50%;
}

.rag-connection-status__icon--connected {
  /* Visual */
  background-color: var(--rag-success-color);
}

.rag-connection-status__icon--retrying {
  /* Visual */
  background-color: var(--rag-warning-color);
}

.rag-connection-status__icon::after {
  /* Positioning */
  content: '';
  position: absolute;
  top: -4px;
  left: -4px;
  right: -4px;
  bottom: -4px;
  
  /* Visual */
  border: 2px solid currentColor;
  border-radius: 50%;
  opacity: 0.3;
  
  /* Misc */
  animation: pulse 2s infinite;
}

.rag-connection-status__text {
  /* Typography */
  color: var(--rag-text-color);
  font-size: 0.9rem;
}

/* 
 * Typing Indicator
 * --------------------
 */
.typing-indicator {
  /* Box model */
  display: none;
  align-self: flex-start;
  padding: var(--rag-spacing-sm) var(--rag-spacing-lg);
  float: left;
  background: transparent;
  position: absolute;
  top: -35px;
  left: 60px;
}

.typing-indicator span {
  /* Box model */
  float: left;
  height: 8px;
  width: 8px;
  margin: 0 1px;
  
  /* Visual */
  background-color: #D9D9D9;
  border-radius: 50%;
  opacity: 0.4;
}

.typing-indicator span:nth-of-type(1) {
  /* Misc */
  animation: 1s blink infinite 0.3333s;
}

.typing-indicator span:nth-of-type(2) {
  /* Misc */
  animation: 1s blink infinite 0.6666s;
}

.typing-indicator span:nth-of-type(3) {
  /* Misc */
  animation: 1s blink infinite 0.9999s;
}

.typing-indicator.is-typing {
  /* Box model */
  display: flex;
}

/* 
 * URL Styling
 * --------------------
 */
.rag-message__content .url {
  /* Box model */
  display: block;
  margin-top: 10px;
  
  /* Typography */
  color: var(--rag-user-bg-color);
  text-decoration: none;
}

.rag-message__content .url:hover {
  /* Typography */
  text-decoration: underline;
}

/* 
 * Assistant Prompt
 * --------------------
 */
.rag-assistant-prompt {
  /* Box model */
  margin-top: var(--rag-spacing-xl);
  padding: var(--rag-spacing-lg);
  
  /* Visual */
  background-color: rgba(26, 68, 101, 0.05);
  border-radius: var(--rag-border-radius);
  box-shadow: var(--rag-card-shadow);
  
  /* Typography */
  text-align: center;
}

.rag-messages-footer {
  /* Box model */
  margin-bottom: var(--rag-spacing-md);
  
  /* Typography */
  color: var(--rag-system-bg-color);
  font-size: 1.1rem;
  font-weight: 500;
}

/* 
 * No Results Message
 * --------------------
 */
.no-results-message {
  /* Box model */
  max-width: 800px;
  margin: var(--rag-spacing-xl) auto;
  padding: var(--rag-spacing-lg);
  
  /* Visual */
  background-color: rgba(0, 0, 0, 0.03);
  border-radius: var(--rag-border-radius);
  
  /* Typography */
  color: #666;
  font-size: 1.1rem;
  text-align: center;
}

/* 
 * Modal Dialog
 * --------------------
 */
.rag-modal {
  /* Positioning */
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 9999;
  
  /* Box model */
  display: flex;
  align-items: center;
  justify-content: center;
  
  /* Visual */
  background-color: rgba(0, 0, 0, 0.5);
  
  /* Misc */
  animation: modalFadeIn 0.3s ease-out;
}

.rag-modal__content {
  /* Box model */
  width: 90%;
  max-width: 500px;
  
  /* Visual */
  background-color: white;
  border-radius: var(--rag-border-radius);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
  overflow: hidden;
  
  /* Misc */
  animation: modalSlideIn 0.3s ease-out;
}

.rag-modal__header {
  /* Box model */
  padding: var(--rag-spacing-md) var(--rag-spacing-lg);
  
  /* Visual */
  background-color: var(--rag-system-bg-color);
  
  /* Typography */
  color: white;
}

.rag-modal__header h3 {
  /* Box model */
  margin: 0;
  
  /* Typography */
  font-size: 1.2rem;
  color: white;
}

.rag-modal__body {
  /* Box model */
  padding: var(--rag-spacing-lg);
  
  /* Typography */
  line-height: 1.5;
}

.rag-modal__footer {
  /* Box model */
  display: flex;
  padding: var(--rag-spacing-md) var(--rag-spacing-lg);
  justify-content: flex-end;
  gap: var(--rag-spacing-md);
  
  /* Visual */
  background-color: #f5f5f5;
}

.rag-modal__button {
  /* Box model */
  padding: var(--rag-spacing-sm) var(--rag-spacing-lg);
  
  /* Visual */
  border: none;
  border-radius: var(--rag-border-radius);
  
  /* Typography */
  font-weight: 500;
  
  /* Misc */
  cursor: pointer;
  transition: all var(--rag-transition-normal);
}

.rag-modal__button--cancel {
  /* Visual */
  background-color: #f5f5f5;
  border: 1px solid #ccc;
  
  /* Typography */
  color: var(--rag-text-color);
}

.rag-modal__button--confirm {
  /* Visual */
  background-color: var(--rag-error-color);
  
  /* Typography */
  color: white;
}

.rag-modal__button:hover {
  /* Visual */
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  
  /* Transform */
  transform: translateY(-2px);
}

.rag-modal__button--cancel:hover {
  /* Visual */
  background-color: #e0e0e0;
}

.rag-modal__button--confirm:hover {
  /* Visual */
  background-color: #d32f2f;
}

/* 
 * Mode Indicator
 * --------------------
 */
.rag-mode-indicator {
  /* Box model */
  display: flex;
  max-width: 800px;
  margin: var(--rag-spacing-md) auto;
  padding: var(--rag-spacing-md);
  align-items: center;
  
  /* Visual */
  background-color: white;
  border-radius: var(--rag-border-radius);
  border-left: 4px solid var(--rag-system-bg-color);
  box-shadow: var(--rag-card-shadow);
  
  /* Misc */
  transition: all var(--rag-transition-normal);
}

.rag-mode-indicator--simple {
  /* Visual */
  border-left-color: var(--rag-system-bg-color);
}

.rag-mode-indicator--complex {
  /* Visual */
  border-left-color: var(--rag-user-bg-color);
}

.rag-mode-indicator__icon {
  /* Box model */
  display: flex;
  width: 40px;
  height: 40px;
  margin-right: var(--rag-spacing-md);
  align-items: center;
  justify-content: center;
  
  /* Visual */
  border-radius: 50%;
  
  /* Typography */
  font-size: 1.5rem;
}

.rag-mode-indicator__icon--simple {
  /* Visual */
  background-color: rgba(26, 68, 101, 0.1);
  
  /* Typography */
  color: var(--rag-system-bg-color);
}

.rag-mode-indicator__icon--complex {
  /* Visual */
  background-color: rgba(249, 193, 58, 0.1);
  
  /* Typography */
  color: var(--rag-user-bg-color);
}

.rag-mode-indicator__label {
  /* Box model */
  display: flex;
  flex-direction: column;
}

.rag-mode-indicator__type {
  /* Box model */
  margin-bottom: var(--rag-spacing-xs);
  
  /* Typography */
  color: var(--rag-text-color);
  font-weight: bold;
}

.rag-mode-indicator__description {
  /* Typography */
  color: #666;
  font-size: 0.9rem;
}

.rag-mode-indicator--animate {
  /* Misc */
  animation: modeIndicatorAppear 0.5s ease-out;
}

/* 
 * Animations
 * --------------------
 */
@keyframes messageAppear {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes pulse {
  0% {
    transform: scale(0.95);
    opacity: 0.5;
  }
  70% {
    transform: scale(1.1);
    opacity: 0.3;
  }
  100% {
    transform: scale(0.95);
    opacity: 0.5;
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes blink {
  50% {
    opacity: 1;
  }
}

@keyframes modalFadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes modalSlideIn {
  from {
    transform: translateY(-50px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

@keyframes modeIndicatorAppear {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* 
 * Media Queries
 * --------------------
 * Responsive design breakpoints for various screen sizes
 */
@media (max-width: 1024px) {
  .rag-result-item {
    /* Box model */
    flex: 1 1 45%;
  }

  .rag-search-header h2 {
    /* Typography */
    font-size: 2rem;
  }
}

@media (max-width: 700px) {
  .rag-conversation-form {
    /* Box model */
    padding: 0;
  }

  .rag-search-header h2 {
    /* Typography */
    font-size: 2.1rem;
  }

  .rag-search-header i {
    /* Box model */
    padding: var(--rag-spacing-md);
  }

  .rag-conversation-input {
    /* Box model */
    min-height: 80px;
    padding: var(--rag-spacing-md);
    padding-right: 60px;
    
    /* Typography */
    font-size: 1rem;
  }

  .rag-conversation-submit {
    /* Box model */
    width: 42px;
    height: 42px;
  }

  .rag-result-items {
    /* Box model */
    gap: var(--rag-spacing-md);
  }

  h3.melchior-source-title {
    text-align: left;
  } 
}

@media (max-width: 480px) {
  .rag-result-item {
    /* Box model */
    flex: 1 1 100%;
  }

  .rag-message {
    /* Box model */
    max-width: 95%;
  }

  .melchior-search-results {
    /* Box model */
    padding: var(--rag-spacing-sm);
  }
}

/*
 * Simple Sources Grid
 * --------------------
 * Styling for the simple search results grid display
 */
.melchior-simple-sources-grid {
  /* Box model */
  max-width: 1100px;
  margin: var(--rag-spacing-xl) auto;
}

.melchior-sources-count {
  /* Box model */
  margin-bottom: var(--rag-spacing-md);
  
  /* Typography */
  color: var(--rag-text-color);
  font-size: 1rem;
  font-weight: 500;
  text-align: center;
}

.melchior-sources-container {
  /* Box model */
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: var(--rag-spacing-md);
  width: 100%;
}

.melchior-source-item {
  /* Box model */
  position: relative;
  padding: var(--rag-spacing-md);
  
  /* Visual */
  background-color: white;
  border: 1px solid #D9D9D9;
  
  /* Misc */
  transition: all var(--rag-transition-normal);
}

.melchior-source-item:hover {
  /* Visual */
  border-color: var(--rag-input-focus-border-color);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  
  /* Transform */
  transform: translateY(-4px);
}

.melchior-source-content {
  /* Box model */
  display: flex;
  flex-direction: column;
  height: 100%;
  justify-content: space-between;
}

.melchior-source-content-header {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.melchior-source-icon {
  /* Box model */
  width: 60px;
  height: 60px;
  min-width: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  
  /* Visual */
  border: 1px solid #371E8E;
  border-radius: 50%;
}

.type-icon {
  /* Box model */
  width: var(--rag-icon-size);
  height: var(--rag-icon-size);

  /* Default icon */
  background-image: url("../assets/divers.svg");
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
}

.melchior-source-icon .type-icon::before {
  content: "";
}

/* Default icon for any type */
.icon-default {  
  /* Visual */
  background-image: url("../assets/divers.svg");
}

/* Node type specific icons - first group (already have SVGs) */
.icon-actualite {
  /* Visual */
  background-image: url("../assets/actualite.svg");
}

.icon-auteur {
  /* Visual */
  background-image: url("../assets/divers.svg");
}

.icon-boite-a-outils {
  /* Visual */
  background-image: url("../assets/boite_a_outils.svg");
}

.icon-chiffre-du-jour {
  /* Visual */
  background-image: url("../assets/divers.svg");
}

.icon-contact {
  /* Visual */
  background-image: url("../assets/divers.svg");
}

.icon-cours {
  /* Visual */
  background-image: url("../assets/Picto_Cours.svg");
}

.icon-page {
  /* Visual */
  background-image: url("../assets/divers.svg");
}

/* Node type specific icons - second group (need to download SVGs) */
.icon-dossier-thematique {
  /* Visual */
  background-image: url("../assets/Picto_Dossier_Thematique.svg");
}

.icon-eee {
  /* Visual */
  background-image: url("../assets/divers.svg");
}

.icon-intervenant {
  /* Visual */
  background-image: url("../assets/Picto_Entretien-Intervenant.svg");
}

.icon-partenaire {
  /* Visual */
  background-image: url("../assets/Picto_Entretien-Partenaire.svg");
}

.icon-programme-eee {
  /* Visual */
  background-image: url("../assets/Picto_Entretien-Programme.svg");
}

.icon-eee-sous-page {
  /* Visual */
  background-image: url("../assets/divers.svg");
}

.icon-etude-de-cas {
  /* Visual */
  background-image: url("../assets/Picto_Etude_de_cas.svg");
}

.icon-evenement {
  /* Visual */
  background-image: url("../assets/divers.svg");
}

.icon-exercice {
  /* Visual */
  background-image: url("../assets/Picto_Exercice.svg");
}

.icon-focus-entreprise {
  /* Visual */
  background-image: url("../assets/Picto_Focus_entreprise.svg");
}

.icon-homepage {
  /* Visual */
  background-image: url("../assets/divers.svg");
}

.icon-landing_home {
  /* Visual */
  background-image: url("../assets/divers.svg");
}

.icon-mise-en-activite {
  /* Visual */
  background-image: url("../assets/Picto_Mise_en_activite.svg");
}

.icon-note-de-lecture {
  /* Visual */
  background-image: url("../assets/Picto_Note_de_lecture.svg");
}

.icon-notion {
  /* Visual */
  background-image: url("../assets/Picto_Notion.svg");
}

.type-icon.icon-orientation {
  /* Visual */
  background-image: url("../assets/divers.svg");
}

.icon-prepa-colles-dissertations {
  /* Visual */
  background-image: url("../assets/colles_disertations.svg");
}

.icon-prepa-dossier-documentaire {
  /* Visual */
  background-image: url("../assets/Picto_Dossier_documentaire.svg");
}

.icon-prepa-definitions {
  /* Visual */
  background-image: url("../assets/Picto_Definitions.svg");
}

.icon-prepa-grands-auteurs {
  /* Visual */
  background-image: url("../assets/Picto_Grands_auteurs.svg");
}

.icon-prepa-mecanismes-concepts {
  /* Visual */
  background-image: url("../assets/Picto_Mecanismes_concepts.svg");
}

.icon-prepa-pour-aller-plus-loin {
  /* Visual */
  background-image: url("../assets/Picto_Pour_aller.svg");
}


.icon-quizz {
  /* Visual */
  background-image: url("../assets/divers.svg");
}

.icon-resultats-du-quizz {
  /* Visual */
  background-image: url("../assets/divers.svg");
}

.icon-synthese {
  /* Visual */
  background-image: url("../assets/Picto_Synthese.svg");
}

.icon-video {
  /* Visual */
  background-image: url("../assets/Picto_Video.svg");
}

.melchior-source-type {  
  /* Typography */
  color: var(--rag-system-bg-color);
  font-family: var(--font-sans-serif);
  font-size: 16px;
  font-weight: 400;
  flex: 2;
}

.melchior-source-level {
  /* Box model */
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 70px;
  height: 24px;
  

  
  /* Typography */
  color: var(--rag-melchior-pink);
  font-family: var(--font-sans-serif);
  font-size: 13px;
  font-weight: 400;
  text-align: center;
}

.melchior-source-level span {
  padding: 0px 10px;

  /* Visual */
  border-radius: 50px;
  background-color: #F3F3F3;
}

.melchior-source-title {
  /* Box model */
  margin: 15px;
  
  /* Typography */
  color: #000;
  font-family: var(--font-sans-serif);
  font-size: 16px;
  font-weight: 400;
  line-height: 1.3;

  flex-grow: 2;
}

.melchior-source-link {
  /* Typography */
  color: #000;
  text-decoration: none;
  transition: color var(--rag-transition-normal);
}

.melchior-source-link:hover {
  /* Typography */
  color: var(--rag-melchior-pink);
}

.melchior-simple-sources-empty {
  /* Box model */
  max-width: 800px;
  margin: var(--rag-spacing-xl) auto;
  padding: var(--rag-spacing-lg);
  
  /* Visual */
  background-color: rgba(0, 0, 0, 0.03);
  border-radius: var(--rag-border-radius);
  
  /* Typography */
  color: #666;
  font-size: 1.1rem;
  text-align: center;
}

/* Media Queries for Simple Sources Grid */
@media (max-width: 768px) {
  .melchior-sources-container {
    /* Box model */
    grid-template-columns: 1fr;
  }
}

/* Media Queries for Responsive Design */
/* Empty media query removed - moved styles above */

/*
 * Complex Sources Simplified List
 * --------------------
 * Styling for the simplified complex sources list display
 */
.melchior-resources {
  /* Box model */
  max-width: 800px;
  margin: 0 auto;
  padding: var(--rag-spacing-md);
  
  /* Visual */
  background-color: white;
}

.melchior-resources__title {
  /* Box model */
  margin-top: 0;
  margin-bottom: 0;
  padding-bottom: 0;

  font-style: italic;
  
  /* Typography */
  color: var(--rag-text-color);
  font-size: 14px;
  font-weight: 400;
}

.melchior-resources__list {
  /* Box model */
  margin: 0;
  padding-left: var(--rag-spacing-lg);
  
  /* Typography */
  line-height: 1.6;
}

#block-melchior-content ul.melchior-resources__list:not(.contextual-links) li:before {
  color: rgba(55, 30, 142, 1);
}

.melchior-resource-item {
  /* Box model */
  margin-bottom: 0;
  padding: 0;
}

.melchior-resource-item a {
  /* Typography */
  color: rgba(55, 30, 142, 1);
  text-decoration: none;
  font-weight: 400;
  font-size: 14px;
  transition: color var(--rag-transition-normal);
  text-decoration: underline;
}

.melchior-resource-item a:hover {
  /* Typography */
  color: rgba(55, 30, 142, 0.7);
  text-decoration: none;
}

/* Media Queries for Complex Sources */
@media (max-width: 768px) {
  .melchior-resources {
    /* Box model */
    padding: var(--rag-spacing-sm);
  }
  
  .melchior-resources__list {
    /* Box model */
    padding-left: var(--rag-spacing-md);
  }
}

.melchior-search-results__tablet-toggle {
  display: none;
}

@media (max-width: 768px) {
  .melchior-search-results__tablet-toggle {
    position: fixed;
    z-index: 100;
    border: none;
    top: 90px;
    background-color: white;
    display: block;
    padding: 2rem;
    border-radius: 50%;
  }
}