:root {
  --primary-color: #333333;
  --secondary-color: #666666;
  --accent-color: #FCF2E2;
  --background-color: #252A2D;
  --app-background-color: #252A2D;
  --text-color: #FCF2E2;
  --light-gray: #e0e0e0;
  --dark-gray: #757575;
  --white: #ffffff;
  --border-radius: 8px;
  --box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  --header-color: #FCF2E2;
  --code-bg: #f1f1f1;
  --blockquote-color: #7f8c8d;
  --sidebar-width: 260px;
  --history-item-hover-bg: #3a3f43;
  --history-item-active-bg: #3a3f43;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: 'Roboto', Arial, sans-serif;
}

[dir="rtl"] * {
  font-family: 'Vazirmatn', Arial, sans-serif;
}

body {
  background-color: var(--background-color);
  color: var(--text-color);
  line-height: 1.6;
  position: relative;
  overflow-x: hidden;
}

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

header {
  margin-bottom: 30px;
  padding: 30px 0;
  border-bottom: 1px solid var(--light-gray);
}

.header-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: relative;
  padding: 0 20px;
}

.logo-container {
  position: relative;
  order: 3;
  margin-left: 20px;
}

[dir="rtl"] .logo-container {
  order: 1;
  margin-left: 0;
  margin-right: 20px;
}

.logo {
  max-height: 100px;
  width: auto;
  transition: transform 0.3s ease;
}

.logo:hover {
  transform: scale(1.05);
}

.header-text {
  text-align: center;
  flex: 1;
  order: 2;
}

header h1 {
  color: var(--text-color);
  font-size: 2.5rem;
  margin-bottom: 10px;
}

header p {
  color: var(--text-color);
  font-size: 1.1rem;
}

header .trademark {
  color: var(--secondary-color);
  font-size: 0.9rem;
  margin-top: 8px;
  font-style: normal;
}

.chat-container {
  display: flex;
  height: calc(100vh - 200px);
  min-height: 500px;
  margin-bottom: 20px;
}

.chat-box {
  flex: 2;
  background-color: var(--app-background-color);
  border-radius: var(--border-radius);
  box-shadow: var(--box-shadow);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
}

.message {
  padding: 12px 18px;
  margin-bottom: 15px;
  border-radius: 18px;
  max-width: 75%;
  position: relative;
  line-height: 1.5;
}

.user-message {
  background-color: var(--primary-color);
  color: var(--white);
  align-self: flex-end;
  margin-left: auto;
  border-bottom-right-radius: 4px;
}

.ai-message {
  background-color: #FCF2E2;
  color: #252A2D;
  align-self: flex-start;
  border-bottom-left-radius: 4px;
}

.sources-container {
  margin-top: 10px;
  font-size: 0.85rem;
  color: var(--dark-gray);
}

.show-sources {
  color: var(--accent-color);
  cursor: pointer;
  text-decoration: underline;
  margin-top: 5px;
  display: inline-block;
}

.message-sources {
  padding: 10px;
  margin-top: 5px;
  background-color: #f9f9f9;
  border-radius: 5px;
  display: none;
  font-size: 0.85rem;
}

.message-meta {
  font-size: 0.75rem;
  margin-top: 5px;
  text-align: right;
  color: rgba(255, 255, 255, 0.8);
}

.ai-message .message-meta {
  color: var(--dark-gray);
}

.chat-input {
  padding: 15px;
  border-top: 1px solid var(--light-gray);
  display: flex;
  flex-direction: column;
}

.input-area {
  display: flex;
  width: 100%;
}

.chat-input input[type="text"] {
  flex: 1;
  padding: 12px 15px;
  border: 1px solid var(--light-gray);
  border-radius: 20px;
  font-size: 1rem;
  outline: none;
  transition: border-color 0.3s;
  background-color: var(--white);
}

.chat-input input[type="text"]:focus {
  border-color: var(--accent-color);
}

.chat-input button {
  background-color: var(--primary-color);
  color: var(--white);
  border: none;
  border-radius: 20px;
  padding: 12px 20px;
  margin-left: 10px;
  cursor: pointer;
  font-size: 1rem;
  transition: background-color 0.3s;
}

.chat-input button:hover {
  background-color: var(--accent-color);
}

.upload-button {
  background: none;
  border: none;
  padding: 5px;
  margin-right: 5px;
  cursor: pointer;
  color: #486ccf;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s ease;
  border-radius: 4px;
}

.upload-button:hover {
  background-color: rgba(72, 108, 207, 0.1);
  color: #3652a3;
}

.hidden {
  display: none !important;
}

.upload-preview-container {
  background-color: #f8f9fa;
  border-radius: 8px;
  margin-top: 10px;
  padding: 10px;
  border: 1px solid #ddd;
}

.preview-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.cancel-button {
  background: none;
  border: none;
  cursor: pointer;
  color: #8c8c8c;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px;
}

.image-preview {
  width: 100%;
  max-height: 200px;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
  border-radius: 6px;
}

.image-preview img {
  max-width: 100%;
  max-height: 200px;
  object-fit: contain;
}

.side-panel {
  flex: 1;
  margin-left: 20px;
  padding: 20px;
  background-color: var(--app-background-color);
  border-radius: var(--border-radius);
  box-shadow: var(--box-shadow);
  overflow-y: auto;
  max-width: 350px;
}

[dir="rtl"] .side-panel {
  margin-left: 0;
  margin-right: 20px;
}

.context-display {
  height: 100%;
  display: flex;
  flex-direction: column;
}

.context-display h3 {
  margin-bottom: 15px;
  font-size: 1.3rem;
  font-weight: 500;
  color: var(--text-color);
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
  padding-bottom: 10px;
  text-align: center;
}

.context-display p {
  color: #252A2D;
}

.context-item {
  margin-bottom: 15px;
  padding-bottom: 15px;
  border-bottom: 1px solid var(--light-gray);
  color: #252A2D;
}

.context-item p {
  margin-bottom: 5px;
  color: #252A2D;
}

.context-meta {
  font-size: 0.8rem;
  color: #252A2D;
}

.context-meta a {
  color: #b73225;
  text-decoration: none;
  font-weight: 500;
}

#no-context-message {
  color: #252A2D;
}

.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 15px;
}

.loading-dots {
  display: flex;
}

.loading-dots span {
  width: 8px;
  height: 8px;
  margin: 0 4px;
  background-color: var(--accent-color);
  border-radius: 50%;
  animation: loading 1.4s infinite ease-in-out both;
}

.loading-dots span:nth-child(1) {
  animation-delay: -0.32s;
}

.loading-dots span:nth-child(2) {
  animation-delay: -0.16s;
}

@keyframes loading {
  0%, 80%, 100% { 
    transform: scale(0);
  } 
  40% { 
    transform: scale(1.0);
  }
}

.typing-indicator {
  display: flex;
  align-items: center;
  margin: 10px 0;
}

.typing-dot {
  width: 8px;
  height: 8px;
  margin: 0 1px;
  background-color: var(--dark-gray);
  border-radius: 50%;
  animation: typing 1s infinite ease-in-out both;
}

.typing-dot:nth-child(1) {
  animation-delay: -0.32s;
}

.typing-dot:nth-child(2) {
  animation-delay: -0.16s;
}

@keyframes typing {
  0%, 80%, 100% { 
    transform: scale(0.7);
  } 
  40% { 
    transform: scale(1.0);
  }
}

.image-message {
  text-align: center;
  margin: 10px 0;
}

.image-message img {
  max-width: 100%;
  max-height: 300px;
  border-radius: 5px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.image-message .image-caption {
  font-size: 0.85rem;
  color: var(--dark-gray);
  margin-top: 5px;
}

/* Improved Markdown styling */
.ai-message .message-content h1, 
.ai-message .message-content h2, 
.ai-message .message-content h3, 
.ai-message .message-content h4, 
.ai-message .message-content h5, 
.ai-message .message-content h6 {
  color: #b73225;
  margin-top: 20px;
  margin-bottom: 10px;
  font-weight: 600;
  line-height: 1.25;
}

.ai-message .message-content h1 {
  font-size: 1.8em;
  border-bottom: 1px solid var(--light-gray);
  padding-bottom: 0.3em;
}

.ai-message .message-content h2 {
  font-size: 1.5em;
  border-bottom: 1px solid var(--light-gray);
  padding-bottom: 0.3em;
}

.ai-message .message-content h3 {
  font-size: 1.3em;
}

.ai-message .message-content h4 {
  font-size: 1.1em;
}

.ai-message .message-content p {
  margin-bottom: 16px;
}

.ai-message .message-content ul, 
.ai-message .message-content ol {
  margin-bottom: 16px;
  padding-left: 2em;
}

.ai-message .message-content li {
  margin-bottom: 4px;
}

.ai-message .message-content pre {
  background-color: var(--code-bg);
  padding: 16px;
  border-radius: 5px;
  overflow-x: auto;
  margin: 16px 0;
}

.ai-message .message-content code {
  font-family: 'Courier New', Courier, monospace;
  padding: 0.2em 0.4em;
  background-color: var(--code-bg);
  border-radius: 3px;
  font-size: 0.9em;
}

.ai-message .message-content pre code {
  padding: 0;
  background-color: transparent;
}

.ai-message .message-content blockquote {
  border-left: 4px solid var(--blockquote-color);
  padding-left: 16px;
  margin: 16px 0;
  color: var(--blockquote-color);
}

.ai-message .message-content a {
  color: var(--accent-color);
  text-decoration: none;
}

.ai-message .message-content a:hover {
  text-decoration: underline;
}

.ai-message .message-content table {
  border-collapse: collapse;
  width: 100%;
  margin: 16px 0;
}

.ai-message .message-content table th,
.ai-message .message-content table td {
  border: 1px solid var(--light-gray);
  padding: 8px 12px;
  text-align: left;
}

.ai-message .message-content table th {
  background-color: #f1f1f1;
}

.ai-message .message-content hr {
  height: 0.25em;
  padding: 0;
  margin: 24px 0;
  background-color: var(--light-gray);
  border: 0;
}

@media (max-width: 900px) {
  .chat-container {
    flex-direction: column;
    height: auto;
  }
  
  .side-panel {
    max-width: none;
    margin-left: 0;
    margin-top: 20px;
  }
  
  .history-sidebar {
    width: 100%;
    max-width: 100%;
  }
  
  body.show-history .container {
    margin-left: 0;
    width: 100%;
    max-width: 1000px;
    margin-top: var(--sidebar-width);
  }
  
  [dir="rtl"] body.show-history .container {
    margin-right: 0;
  }
  
  body.show-history .history-sidebar {
    height: auto;
    max-height: 300px;
    position: absolute;
    width: 100%;
  }
}

/* Language Dialog Styles */
.language-dialog {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(37, 42, 45, 0.9);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    backdrop-filter: blur(8px);
}

.language-dialog-content {
    background-color: #FCF2E2;
    border-radius: 20px;
    padding: 40px;
    width: 500px;
    max-width: 90%;
    text-align: center;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.1);
    animation: fadeIn 0.5s ease-out;
}

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

.language-dialog h2 {
    margin-top: 0;
    color: #252A2D;
    font-size: 32px;
    margin-bottom: 40px;
    font-weight: 700;
    font-family: 'Vazirmatn', 'Roboto', sans-serif;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.1);
}

.language-options {
    display: flex;
    justify-content: center;
    gap: 40px;
}

.lang-btn {
    padding: 20px 40px;
    font-size: 24px;
    background-color: #252A2D;
    color: #FCF2E2;
    border: none;
    border-radius: 16px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 8px 15px rgba(0, 0, 0, 0.2);
    min-width: 180px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    font-family: 'Vazirmatn', 'Roboto', sans-serif;
    font-weight: 500;
}

.lang-btn .flag-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
    border: 2px solid rgba(255, 255, 255, 0.5);
}

.lang-btn:hover {
    background-color: #b73225;
    transform: translateY(-5px);
    box-shadow: 0 12px 20px rgba(0, 0, 0, 0.3);
}

.lang-btn.active {
    background-color: #b73225;
    transform: translateY(-5px);
    box-shadow: 0 12px 20px rgba(0, 0, 0, 0.3);
}

/* Hide dialog when language is selected */
.hidden {
    display: none !important;
}

/* Context relevance indicator */
.context-relevance {
    font-size: 0.8rem;
    color: var(--accent-color);
    margin-top: 5px;
}

footer {
  text-align: center;
  margin-top: 20px;
  padding: 15px 0;
  border-top: 1px solid var(--light-gray);
}

footer .trademark {
  color: var(--text-color);
  font-size: 0.9rem;
}

.help-button-container {
  position: relative;
  display: flex;
  align-items: center;
}

.help-button, .logout-button {
  background-color: #FCF2E2;
  color: #252A2D;
  border: none;
  border-radius: 5px;
  padding: 8px 15px;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.3s ease;
  white-space: nowrap;
}

.help-button:hover, .logout-button:hover {
  background-color: #E7DFD0;
  transform: translateY(-2px);
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.help-text-en, .help-text-fa, .help-title-en, .help-title-fa, .help-content-en, .help-content-fa {
  display: none;
}

[lang="en"] .help-text-en, [lang="en"] .help-title-en, [lang="en"] .help-content-en {
  display: block;
}

[lang="fa"] .help-text-fa, [lang="fa"] .help-title-fa, [lang="fa"] .help-content-fa {
  display: block;
}

/* Modal styles */
.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: auto;
  background-color: rgba(0, 0, 0, 0.7);
}

.modal-content {
  background-color: #FCF2E2;
  margin: 5% auto;
  padding: 20px;
  border-radius: 10px;
  width: 80%;
  max-width: 800px;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
  color: #252A2D;
}

.modal-header {
  position: relative;
  padding-bottom: 15px;
  border-bottom: 1px solid var(--light-gray);
}

.modal-header h2 {
  color: #b73225;
  margin: 0;
}

.close {
  position: absolute;
  right: 0;
  top: 0;
  color: #252A2D;
  font-size: 28px;
  font-weight: bold;
  cursor: pointer;
}

.close:hover {
  color: #b73225;
}

.modal-body {
  padding: 15px 0;
}

.modal-body h3 {
  color: #b73225;
  margin-bottom: 15px;
}

.modal-body h4 {
  color: #b73225;
  margin: 20px 0 10px;
}

.modal-body ul, .modal-body ol {
  margin-left: 20px;
  margin-bottom: 15px;
}

.modal-body li {
  margin-bottom: 8px;
}

[dir="rtl"] .close {
  right: auto;
  left: 0;
}

[dir="rtl"] .modal-body ul, [dir="rtl"] .modal-body ol {
  margin-left: 0;
  margin-right: 20px;
}

/* Login Form Styles */
.login-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
  width: 100%;
}

.email-input-container {
  margin-bottom: 10px;
}

.email-label-en, .email-label-fa {
  display: none;
  font-size: 16px;
  margin-bottom: 8px;
  color: #252A2D;
  font-weight: 500;
}

[lang="en"] .email-label-en {
  display: block;
}

[lang="fa"] .email-label-fa {
  display: block;
}

#email-input {
  width: 100%;
  padding: 12px 15px;
  font-size: 16px;
  border: 1px solid var(--light-gray);
  border-radius: 8px;
  background-color: white;
  color: #252A2D;
  transition: border-color 0.3s;
}

#email-input:focus {
  outline: none;
  border-color: #b73225;
  box-shadow: 0 0 0 2px rgba(183, 50, 37, 0.2);
}

#email-input::placeholder {
  color: #999;
}

/* Logout Button Styles */
.logout-button-container {
  position: relative;
  display: flex;
  align-items: center;
}

.logout-text-en, .logout-text-fa {
  display: none;
}

[lang="en"] .logout-text-en {
  display: block;
}

[lang="fa"] .logout-text-fa {
  display: block;
}

/* Hide logout button by default, will be shown after login */
.logout-button-container {
  display: none;
}

/* Chat history sidebar */
.history-hover-trigger {
  position: fixed;
  top: 0;
  width: 15px;
  height: 100vh;
  z-index: 899;
  opacity: 0;
  transition: background-color 0.3s ease;
}

/* Position trigger area on appropriate side based on language direction */
.history-hover-trigger.left-side {
  left: 0;
}

.history-hover-trigger.right-side {
  right: 0;
}

/* Add subtle visual indicator on hover */
.history-hover-trigger:hover::after {
  content: '';
  position: absolute;
  top: 0;
  height: 100%;
  width: 3px;
  background-color: var(--accent-color);
  transition: opacity 0.3s ease;
  opacity: 0.7;
}

.history-hover-trigger.left-side:hover::after {
  right: 0;
}

.history-hover-trigger.right-side:hover::after {
  left: 0;
}

/* Chat history sidebar */
.history-sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-width);
  height: 100vh;
  background-color: #1e2123;
  border-right: 1px solid #444;
  z-index: 900;
  transform: translateX(-100%);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  box-shadow: 2px 0 10px rgba(0, 0, 0, 0.2);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* RTL support for sidebar */
[dir="rtl"] .history-sidebar {
  left: auto;
  right: 0;
  transform: translateX(100%);
  border-right: none;
  border-left: 1px solid #444;
  box-shadow: -2px 0 10px rgba(0, 0, 0, 0.2);
}

/* Show history sidebar when active or hovering */
body.show-history .history-sidebar,
.history-hover-trigger:hover + .history-sidebar,
.history-sidebar:hover {
  transform: translateX(0);
  box-shadow: 3px 0 15px rgba(0, 0, 0, 0.3);
}

[dir="rtl"] body.show-history .history-sidebar,
[dir="rtl"] .history-hover-trigger:hover + .history-sidebar,
[dir="rtl"] .history-sidebar:hover {
  box-shadow: -3px 0 15px rgba(0, 0, 0, 0.3);
}

/* Apply shift to container only when button clicked, not on hover */
body.show-history .container {
  margin-left: var(--sidebar-width);
  width: calc(100% - var(--sidebar-width));
  max-width: none;
  transition: margin-left 0.3s ease, width 0.3s ease;
}

[dir="rtl"] body.show-history .container {
  margin-left: 0;
  margin-right: var(--sidebar-width);
  transition: margin-right 0.3s ease, width 0.3s ease;
}

.history-header {
  padding: 15px;
  display: flex;
  justify-content: center;
  border-bottom: 1px solid #444;
}

.new-chat-btn {
  width: 100%;
  padding: 10px 15px;
  background-color: #333;
  color: var(--white);
  border: 1px solid #555;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.9rem;
  transition: background-color 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.new-chat-btn svg {
  margin-right: 4px;
}

[dir="rtl"] .new-chat-btn svg {
  margin-right: 0;
  margin-left: 4px;
}

.new-chat-btn:hover {
  background-color: #444;
}

.new-chat-text-en, .today-text-en, .yesterday-text-en, .previous-text-en, .older-text-en {
  display: inline;
}

.new-chat-text-fa, .today-text-fa, .yesterday-text-fa, .previous-text-fa, .older-text-fa {
  display: none;
}

[dir="rtl"] .new-chat-text-en, [dir="rtl"] .today-text-en, [dir="rtl"] .yesterday-text-en, [dir="rtl"] .previous-text-en, [dir="rtl"] .older-text-en {
  display: none;
}

[dir="rtl"] .new-chat-text-fa, [dir="rtl"] .today-text-fa, [dir="rtl"] .yesterday-text-fa, [dir="rtl"] .previous-text-fa, [dir="rtl"] .older-text-fa {
  display: inline;
}

.history-sections {
  flex: 1;
  overflow-y: auto;
  padding: 0 8px;
}

.history-section {
  margin-bottom: 15px;
}

.history-section-header {
  padding: 8px 10px 5px;
  color: var(--light-gray);
  font-size: 0.85rem;
  font-weight: 600;
  margin-top: 10px;
  border-bottom: 1px solid #444;
  opacity: 0.8;
}

.history-items-list {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-top: 5px;
}

.history-item {
  padding: 12px 14px;
  border-radius: 6px;
  cursor: pointer;
  transition: background-color 0.2s;
  overflow: hidden;
  position: relative;
}

.history-item:hover {
  background-color: #333;
}

.history-item.active {
  background-color: #3a3f43;
  border-left: 3px solid var(--accent-color);
}

[dir="rtl"] .history-item.active {
  border-left: none;
  border-right: 3px solid var(--accent-color);
}

.history-item-title {
  font-size: 0.9rem;
  color: var(--text-color);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 4px;
}

.history-item-time {
  font-size: 0.75rem;
  color: #888;
  position: absolute;
  right: 12px;
  top: 12px;
}

[dir="rtl"] .history-item-time {
  right: auto;
  left: 12px;
}

.empty-history-message {
  text-align: center;
  color: #888;
  padding: 30px 15px;
  font-style: italic;
  font-size: 0.9rem;
}

/* History toggle button */
.history-toggle-container {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  top: auto;
  left: auto;
  transform: none;
}

[dir="rtl"] .history-toggle-container {
  left: auto;
  right: auto;
}

.history-toggle-btn {
  background-color: rgba(252, 242, 226, 0.1);
  border: 1px solid rgba(252, 242, 226, 0.3);
  color: var(--text-color);
  cursor: pointer;
  width: 32px;
  height: 32px;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: all 0.3s ease;
}

.history-toggle-label {
  font-size: 0.75rem;
  margin-top: 4px;
  color: var(--text-color);
  white-space: nowrap;
  text-align: center;
}

.history-toggle-label-en, .history-toggle-label-fa {
  display: none;
}

[lang="en"] .history-toggle-label-en {
  display: block;
}

[lang="fa"] .history-toggle-label-fa {
  display: block;
}

.history-toggle-btn:hover {
  background-color: rgba(252, 242, 226, 0.2);
  transform: translateY(-2px);
}

.history-toggle-btn.active {
  background-color: rgba(255, 255, 255, 0.2);
  box-shadow: 0 0 0 2px rgba(252, 242, 226, 0.3);
}

body.show-history .history-toggle-btn {
  background-color: rgba(255, 255, 255, 0.1);
}

/* Improve header controls container */
.header-controls {
  display: flex;
  align-items: center;
  gap: 15px;
  order: 1;
  position: relative;
}

[dir="rtl"] .header-controls {
  order: 3;
}

/* Adjust mobile view */
@media (max-width: 768px) {
  .header-content {
    flex-direction: column;
    gap: 15px;
  }
  
  .header-controls {
    order: 3;
    width: 100%;
    justify-content: center;
    margin-top: 10px;
  }
  
  .logo-container {
    order: 1;
    margin: 0 auto;
  }
  
  .header-text {
    order: 2;
    margin: 10px 0;
  }
  
  [dir="rtl"] .header-controls {
    order: 3;
  }
  
  [dir="rtl"] .logo-container {
    order: 1;
    margin: 0 auto;
  }
}

/* Even smaller screens */
@media (max-width: 480px) {
  .header-controls {
    flex-wrap: wrap;
    justify-content: center;
  }
  
  header h1 {
    font-size: 1.8rem;
  }
  
  header p {
    font-size: 0.9rem;
  }
}

/* استایل برای نمایش ایمیل کاربر */
.user-email-container {
  position: relative;
  display: flex;
  align-items: center;
  margin-right: 10px;
  margin-left: 10px;
}

.user-email {
  color: var(--text-color);
  font-size: 0.9rem;
  max-width: 180px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  opacity: 0.85;
  padding: 2px 8px;
  background-color: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
}

/* Update header controls */
.header-controls {
  display: flex;
  align-items: center;
  gap: 15px;
  order: 1;
  position: relative;
}

[dir="rtl"] .header-controls {
  order: 3;
}

.references-title-en, .references-title-fa {
    display: none;
}

[lang="en"] .references-title-en {
    display: block;
}

[lang="fa"] .references-title-fa {
    display: block;
}

#references-tabs {
    display: none;
}

.books-container {
    display: flex;
    flex-direction: column;
    padding: 8px;
    gap: 10px;
    width: 100%;
    overflow-y: auto;
    max-height: calc(100vh - 200px);
}

.book-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
}

.book-item {
    border-radius: 5px;
    padding: 10px;
    background-color: #f5f5f5;
    transition: all 0.2s ease;
    cursor: pointer;
    width: 100%;
    display: block;
    border-left: 3px solid #486ccf;
}

[dir="rtl"] .book-item {
    border-left: none;
    border-right: 3px solid #486ccf;
}

.book-item:hover {
    background-color: #e8e8f9;
    transform: translateY(-2px);
    box-shadow: 0 3px 5px rgba(0, 0, 0, 0.1);
}

.book-link {
    text-decoration: none;
    color: inherit;
    display: block;
    width: 100%;
}

.book-title {
    font-weight: 500;
    font-size: 0.95rem;
    color: #333;
    margin-bottom: 4px;
    line-height: 1.3;
}

.book-meta {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.7);
    display: flex;
    align-items: center;
}

.book-meta::before {
    content: "";
    display: inline-block;
    width: 16px;
    height: 16px;
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="rgba(255,255,255,0.7)" stroke-width="2"><path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z" /><path d="M14 2v6h6" /><path d="M16 13H8" /><path d="M16 17H8" /><path d="M10 9H8" /></svg>');
    margin-right: 5px;
    background-size: contain;
    background-repeat: no-repeat;
}

[dir="rtl"] .book-meta::before {
    margin-right: 0;
    margin-left: 5px;
}

#loading-books-message {
    text-align: center;
    padding: 20px;
    color: rgba(255, 255, 255, 0.7);
    font-style: italic;
} 