@import url('https://fonts.googleapis.com/css2?family=Vazirmatn:wght@300;400;500;600;700&display=swap');

:root {
  --primary-color: #0f172a;
  --secondary-color: #1e293b;
  --accent-color: #4361ee;
  --text-color: #edf2f4;
  --text-secondary: #adb5bd;
  --error-color: #e5383b;
  --success-color: #38e55a;
  --border-radius: 8px;
  --box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  --transition: all 0.3s ease;
  --sidebar-width: 300px;
  --header-height: 70px;
  --footer-height: 60px;
  --card-border-radius: 12px;
  --accent-gradient: linear-gradient(135deg, #4361ee, #3a0ca3);
  --card-bg: rgba(30, 41, 59, 0.5);
  --dark-color: #1e293b;
  --light-color: #edf2f4;
  --user-msg-bg: rgba(67, 97, 238, 0.8);
  --user-msg-color: #fff;
  --assistant-msg-bg: rgba(30, 41, 59, 0.7);
  --assistant-msg-color: #edf2f4;
  --border-color: rgba(255, 255, 255, 0.1);
  --history-user-msg-bg: rgba(67, 97, 238, 0.8);
  --history-user-msg-color: #fff;
  --history-assistant-msg-bg: rgba(30, 41, 59, 0.7);
  --history-assistant-msg-color: #edf2f4;
}

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

html, body {
  height: 100%;
}

body {
  font-family: "Vazirmatn", "Tahoma", sans-serif;
  background-color: var(--primary-color);
  color: var(--text-color);
  direction: rtl;
  line-height: 1.6;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
}

body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: radial-gradient(at top right, rgba(66, 153, 225, 0.08), transparent 60%),
              radial-gradient(at bottom left, rgba(109, 40, 217, 0.08), transparent 60%);
  z-index: -1;
  pointer-events: none;
}

/* استایل‌های مشترک */
.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 20px;
}

.btn {
  display: inline-block;
  background-color: var(--accent-color);
  color: white;
  padding: 8px 16px;
  border: none;
  border-radius: var(--border-radius);
  cursor: pointer;
  transition: var(--transition);
  font-family: inherit;
  font-weight: 500;
}

.btn:hover {
  background-color: #3a49e0;
  transform: translateY(-2px);
}

.btn-secondary {
  background-color: rgba(74, 78, 105, 0.8);
}

.btn-secondary:hover {
  background-color: rgba(61, 64, 91, 0.9);
}

.card {
  background-color: var(--secondary-color);
  border-radius: var(--card-border-radius);
  padding: 20px;
  margin-bottom: 20px;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

/* Header Styles */
.header, .app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 2rem;
  background-color: rgba(15, 23, 42, 0.8);
  color: white;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.08);
  z-index: 1000;
  height: var(--header-height);
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.header-left, .header-right {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.header-center {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  text-align: center;
}

.header-logo h1, .app-title {
  font-size: 20px;
  font-weight: 700;
  margin: 0;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.header-center p, .app-subtitle {
  font-size: 16px;
  font-weight: 500;
  opacity: 0.9;
  margin: 0;
}

.back-button, .history-button, .help-button, .logout-button, .logout-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 16px;
  border: none;
  border-radius: 100px;
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.9);
  cursor: pointer;
  transition: all 0.3s;
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  font-family: inherit;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.back-button:hover, .history-button:hover, .help-button:hover, .logout-button:hover, .logout-btn:hover {
  background-color: var(--accent-color);
  color: white;
  transform: translateY(-2px);
}

.logout-btn:hover, .logout-button:hover {
  background-color: var(--error-color);
}

.user-info, .user-name {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--accent-color);
  font-weight: 600;
  font-size: 14px;
  background: rgba(255, 255, 255, 0.05);
  padding: 6px 14px;
  border-radius: 100px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.user-name::before {
  content: '\f007';
  font-family: 'Font Awesome 6 Free';
  font-weight: 900;
}

/* Content Styles for Devices Page */
.content {
  flex: 1;
  padding: 40px;
  overflow-y: auto;
  margin-top: 80px;
  min-height: calc(100vh - var(--header-height) - var(--footer-height));
  padding-bottom: calc(var(--footer-height) + 20px);
}

.page-title {
  text-align: center;
  margin-bottom: 50px;
  position: relative;
}

.page-title h2 {
  font-size: 28px;
  margin: 0;
  padding-bottom: 15px;
  display: inline-block;
  position: relative;
  color: white;
}

.page-title h2::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100px;
  height: 3px;
  background: var(--accent-gradient);
  border-radius: 50px;
}

/* Devices Grid Layout */
.devices-container {
  max-width: 1400px;
  margin: 0 auto;
  width: 100%;
  padding: 0 20px;
  flex: 1;
}

.devices-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-template-rows: repeat(3, auto);
  gap: 30px;
  margin-bottom: 40px;
}

/* Device Card Styles for devices.html */
.device-card {
  display: flex;
  flex-direction: column;
  background: var(--card-bg);
  border-radius: var(--card-border-radius);
  overflow: hidden;
  text-decoration: none;
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease;
  height: 100%;
  position: relative;
  animation: fadeIn 0.5s ease-out forwards;
  opacity: 0;
  transform: translateY(15px);
}

.device-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.2);
  border-color: var(--accent-color);
}

.device-card .device-image {
  height: 180px;
  background: rgba(255, 255, 255, 0.05);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
}

.device-card .device-image img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  transition: transform 0.4s ease;
}

.device-card:hover .device-image img {
  transform: scale(1.07);
}

.device-card .device-info {
  padding: 16px 20px;
  text-align: center;
  background: linear-gradient(to bottom, rgba(30, 41, 59, 0.6), rgba(30, 41, 59, 0.9));
}

.device-card .device-info h3 {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 8px;
  transition: transform 0.3s;
  color: var(--text-color);
}

.device-card:hover .device-info h3 {
  transform: translateY(-3px);
  color: var(--accent-color);
}

.device-card .device-brand {
  color: var(--accent-color);
  font-size: 14px;
  font-weight: 500;
  opacity: 0.9;
  display: block;
}

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

/* Animation delays for devices grid */
.devices-grid .device-card:nth-child(1) { animation-delay: 0.05s; }
.devices-grid .device-card:nth-child(2) { animation-delay: 0.1s; }
.devices-grid .device-card:nth-child(3) { animation-delay: 0.15s; }
.devices-grid .device-card:nth-child(4) { animation-delay: 0.2s; }
.devices-grid .device-card:nth-child(5) { animation-delay: 0.25s; }
.devices-grid .device-card:nth-child(6) { animation-delay: 0.3s; }
.devices-grid .device-card:nth-child(7) { animation-delay: 0.35s; }
.devices-grid .device-card:nth-child(8) { animation-delay: 0.4s; }
.devices-grid .device-card:nth-child(9) { animation-delay: 0.45s; }
.devices-grid .device-card:nth-child(10) { animation-delay: 0.5s; }
.devices-grid .device-card:nth-child(11) { animation-delay: 0.55s; }
.devices-grid .device-card:nth-child(12) { animation-delay: 0.6s; }

/* Footer Styles */
.footer, .app-footer {
  background: rgba(15, 23, 42, 0.95);
  padding: 20px;
  text-align: center;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  height: var(--footer-height);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  position: fixed;
  bottom: 0;
  left: 0;
  z-index: 100;
}

.footer p, .app-footer p {
  color: rgba(255, 255, 255, 0.6);
  font-size: 14px;
  margin: 0;
  text-align: center;
  width: 100%;
}

/* Responsive styles */
@media screen and (max-width: 1200px) {
  .devices-grid {
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(4, auto);
    gap: 25px;
  }
  
  .content, .main-content {
    padding: 30px;
  }
}

@media screen and (max-width: 900px) {
  .devices-grid {
    grid-template-columns: repeat(2, 1fr);
    grid-template-rows: repeat(6, auto);
    gap: 20px;
  }
  
  .header, .app-header {
    padding: 0 20px;
    height: auto;
    flex-direction: column;
    padding-top: 10px;
    padding-bottom: 10px;
  }
  
  .header-center {
    position: static;
    transform: none;
    margin: 10px 0;
  }
  
  .content, .main-content {
    margin-top: 120px;
    padding: 20px;
  }
  
  .page-title {
    margin-bottom: 30px;
  }
}

@media screen and (max-width: 500px) {
  .devices-grid {
    grid-template-columns: 1fr;
    grid-template-rows: repeat(12, auto);
  }
  
  .content, .main-content {
    padding: 15px;
  }
  
  .page-title h2 {
    font-size: 24px;
  }
}

/* استایل‌های پنل دستگاه در سمت چپ */
.machine-panel {
  width: 300px;
  flex-shrink: 0;
  background-color: var(--dark-color);
  border-right: 1px solid rgba(255, 255, 255, 0.05);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  padding-top: 10px;
}

.machine-brand {
  padding: 1rem;
  font-size: 1.3rem;
  font-weight: bold;
  text-align: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  color: var(--light-color);
  margin-bottom: 10px;
}

.resources-list {
  padding: 0;
}

.resource-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  color: rgba(255, 255, 255, 0.8);
  text-decoration: none;
  transition: background-color 0.2s;
  font-size: 0.9rem;
  text-align: right;
}

.resource-item:hover {
  background-color: rgba(255, 255, 255, 0.05);
  color: var(--primary-color);
}

.pdf-resource i {
  color: #e74c3c;
}

/* استایل‌های ریسپانسیو */
@media (max-width: 1100px) {
  .machine-panel {
    width: 140px;
    padding: 15px;
  }
}

@media (max-width: 900px) {
  .main-content {
    flex-direction: column;
  }
  
  .sidebar {
    width: 100%;
    height: 200px;
    border-left: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    order: 3;
  }
  
  .chat-container {
    order: 2;
  }
  
  .machine-panel {
    width: 100%;
    height: 120px;
    flex-direction: row;
    padding: 10px;
    border-right: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    order: 1;
  }
  
  .machine-image-container {
    width: 80px;
    margin-bottom: 0;
    margin-left: 15px;
  }
  
  .message {
    max-width: 90%;
  }
}

@media (max-width: 600px) {
  .header-center {
    display: none;
  }
  
  .app-header {
    justify-content: space-between;
  }
  
  .header-left, .header-right {
    gap: 10px;
  }
  
  .history-button span, .help-button span, .logout-button span {
    display: none;
  }
  
  .machine-panel {
    height: 100px;
  }
  
  .machine-image-container {
    width: 60px;
  }
  
  .machine-brand {
    font-size: 1.2rem;
  }
  
  .machine-model {
    font-size: 1rem;
  }
}

/* Sidebar Styles */
.sidebar {
  width: 300px;
  padding: 1rem;
  background-color: var(--dark-color);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
}

.device-image-container {
  width: 100%;
  height: 250px;
  margin-bottom: 1rem;
  display: flex;
  justify-content: center;
  align-items: center;
  background-color: rgba(15, 23, 42, 0.5);
  padding: 1rem;
  border-radius: var(--border-radius);
  overflow: hidden;
}

.device-image {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.device-info {
  text-align: center;
  color: var(--light-color);
}

.device-brand {
  font-size: 1.2rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: var(--primary-color);
}

.device-model {
  font-size: 1.5rem;
  margin-top: 0;
}

/* استایل‌های کلی صفحه */
.main-content {
  display: flex;
  height: calc(100vh - var(--header-height) - var(--footer-height));
  background-color: var(--dark-color);
  overflow: hidden;
  margin-top: var(--header-height);
}

/* Chat Container Styles */
.chat-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  background-color: var(--dark-color);
  border-right: 1px solid rgba(255, 255, 255, 0.05);
  max-width: calc(100% - 600px);
}

.chat-messages {
  flex: 1;
  padding: 1rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  background-color: rgba(15, 23, 42, 0.95);
}

/* User and Assistant Message Styles */
.message {
  max-width: 80%;
  padding: 12px 16px;
  border-radius: var(--border-radius);
  position: relative;
  word-wrap: break-word;
}

.user-message {
  align-self: flex-end;
  background-color: var(--accent-color);
}

.assistant-message {
  align-self: flex-start;
  background-color: rgba(255, 255, 255, 0.05);
}

.message-timestamp {
  font-size: 0.7rem;
  color: var(--text-secondary);
  margin-top: 5px;
  text-align: left;
}

/* File Content Styles */
.message-file {
  margin-top: 10px;
  max-width: 100%;
}

.message-file img {
  max-width: 100%;
  border-radius: 4px;
}

.message-file audio {
  width: 100%;
}

/* Input Area Styles */
.input-area {
  padding: 1rem;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  background-color: rgba(15, 23, 42, 0.98);
}

.message-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

#message-input {
  width: 100%;
  padding: 12px 15px;
  border-radius: var(--border-radius);
  border: 1px solid rgba(255, 255, 255, 0.1);
  background-color: rgba(255, 255, 255, 0.05);
  color: var(--text-color);
  font-family: inherit;
  font-size: 1rem;
  resize: none;
}

#message-input:focus {
  outline: none;
  border-color: var(--accent-color);
}

.form-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.file-upload-btn, .voice-record-btn {
  background-color: transparent;
  border: none;
  color: var(--text-color);
  font-size: 1.2rem;
  cursor: pointer;
  padding: 8px;
  border-radius: 50%;
  transition: background-color 0.2s;
}

.file-upload-btn:hover, .voice-record-btn:hover {
  background-color: rgba(255, 255, 255, 0.1);
}

.send-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  background-color: var(--accent-color);
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: var(--border-radius);
  font-family: inherit;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.2s;
}

.send-btn:hover {
  background-color: #3a49e0;
}

.recording {
  animation: pulse 1.5s infinite;
  background-color: var(--error-color) !important;
}

@keyframes pulse {
  0% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
  100% {
    opacity: 1;
  }
}

/* Modal Styles */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.7);
  z-index: 1000;
  justify-content: center;
  align-items: center;
  opacity: 0;
  transition: opacity 0.3s;
}

.modal.show {
  display: flex;
  opacity: 1;
}

.modal-content {
  background-color: var(--secondary-color);
  border-radius: var(--border-radius);
  width: 80%;
  max-width: 700px;
  max-height: 80vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
  animation: modalFadeIn 0.3s;
}

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

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.modal-header h2 {
  margin: 0;
  font-size: 1.2rem;
  color: var(--text-color);
}

.close-modal {
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--text-secondary);
  transition: color 0.2s;
}

.close-modal:hover {
  color: var(--text-color);
}

.modal-body {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
}

/* تاریخچه چت */
.history-date-container {
  margin-bottom: 20px;
}

.history-date-select {
  width: 100%;
  padding: 12px 15px;
  margin-bottom: 15px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background-color: rgba(255, 255, 255, 0.05);
  color: var(--text-color);
  font-family: var(--font-family);
  font-size: 16px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.history-date-select:hover {
  border-color: var(--accent-color);
}

.history-date-select:focus {
  outline: none;
  border-color: var(--accent-color);
  box-shadow: 0 0 0 2px rgba(67, 97, 238, 0.3);
}

.history-messages-container {
  max-height: 500px;
  overflow-y: auto;
  padding: 10px;
  background-color: rgba(0, 0, 0, 0.1);
  border-radius: 8px;
}

.history-device-heading, 
.history-device-info {
  margin-bottom: 15px;
  padding: 12px;
  background-color: rgba(67, 97, 238, 0.1);
  border-radius: 8px;
  text-align: center;
  border-right: 3px solid var(--accent-color);
}

.history-device-heading h3,
.history-device-info h3 {
  margin: 0;
  font-size: 18px;
  color: var(--accent-color);
  font-weight: 600;
}

.history-message {
  margin-bottom: 15px;
  padding: 10px 15px;
  border-radius: 10px;
  position: relative;
  max-width: 85%;
}

.history-user-message {
  background-color: var(--history-user-msg-bg);
  margin-left: auto;
  color: var(--history-user-msg-color);
}

.history-assistant-message {
  background-color: var(--history-assistant-msg-bg);
  margin-right: auto;
  color: var(--history-assistant-msg-color);
}

.history-message-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 5px;
  font-size: 12px;
  opacity: 0.8;
}

.history-message-content {
  word-break: break-word;
  line-height: 1.5;
}

.empty-history, 
.loading-history, 
.error-history {
  text-align: center;
  padding: 20px;
  color: var(--text-color-secondary);
  font-style: italic;
}

.loading-history {
  color: var(--primary-color);
  animation: pulse 1.5s infinite;
}

.error-history {
  color: var(--error-color);
}

/* انیمیشن چشمک‌زن برای لودینگ */
@keyframes pulse {
  0% { opacity: 0.5; }
  50% { opacity: 1; }
  100% { opacity: 0.5; }
}

/* استایل پیام در حال انتظار */
.waiting-message {
  background-color: rgba(0, 0, 0, 0.1);
  margin: 10px auto;
  padding: 15px;
  border-right: 3px solid var(--error-color);
  width: max-content; /* اندازه محتوا به جای کل عرض */
  max-width: 80%; /* حداکثر عرض */
  align-self: center; /* قرار گرفتن در وسط */
}

.waiting-message .message-content {
  color: var(--error-color);
  font-weight: 500;
}

/* انیمیشن چشمک زن */
@keyframes blink {
  0% { opacity: 0.5; }
  50% { opacity: 1; }
  100% { opacity: 0.5; }
}

.blinking {
  animation: blink 0.8s infinite;
}

/* استایل محتوای Markdown */
.markdown-content {
  line-height: 1.6;
  font-size: 0.95rem;
}

.markdown-content h1,
.markdown-content h2,
.markdown-content h3 {
  margin: 1em 0 0.5em;
  color: var(--accent-color);
  font-weight: 600;
  line-height: 1.3;
}

.markdown-content h1 { font-size: 1.5em; margin-top: 0.5em; }
.markdown-content h2 { font-size: 1.3em; }
.markdown-content h3 { font-size: 1.1em; }

.markdown-content p {
  margin: 0.7em 0;
}

.markdown-content strong {
  font-weight: 600;
  color: #fff;
}

.markdown-content em {
  font-style: italic;
  color: var(--text-color);
}

.markdown-content ul,
.markdown-content ol {
  padding-right: 1.5em;
  margin: 0.8em 0;
}

.markdown-content li {
  margin-bottom: 0.4em;
}

.markdown-content ul ul,
.markdown-content ol ol,
.markdown-content ul ol,
.markdown-content ol ul {
  margin: 0.4em 0;
}

.markdown-content pre.code-block {
  background-color: rgba(0, 0, 0, 0.3);
  padding: 12px;
  border-radius: 6px;
  overflow-x: auto;
  font-family: monospace;
  white-space: pre-wrap;
  margin: 1em 0;
  direction: ltr;
  text-align: left;
  font-size: 0.9em;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.markdown-content hr {
  border: none;
  border-bottom: 1px solid var(--border-color);
  margin: 1.5em 0;
}

.history-message-content.markdown-content {
  padding: 5px 0;
}

/* استایل‌های بخش منابع در سایدبار */
.resources-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 20px;
}

.resource-item {
  display: flex;
  align-items: center;
  padding: 10px;
  background-color: rgba(255, 255, 255, 0.05);
  border-radius: var(--border-radius);
  color: var(--text-color);
  text-decoration: none;
  transition: background-color 0.2s;
  gap: 10px;
}

.resource-item:hover {
  background-color: rgba(255, 255, 255, 0.1);
}

.pdf-resource {
  border-right: 3px solid #e53935;
}

.pdf-resource i {
  color: #e53935;
  font-size: 1.2rem;
}

/* استایل فوتر */
.app-footer {
  background-color: var(--secondary-color);
  padding: 10px 20px;
  text-align: center;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-secondary);
  font-size: 0.8rem;
}

.app-footer p {
  margin: 0;
}

/* استایل دکمه بازگشت */
.back-button {
  display: flex;
  align-items: center;
  background-color: rgba(255, 255, 255, 0.1);
  color: var(--text-color);
  border: none;
  padding: 8px 12px;
  border-radius: var(--border-radius);
  cursor: pointer;
  font-family: inherit;
  font-size: 0.9rem;
  gap: 8px;
  transition: background-color 0.2s;
  text-decoration: none;
}

.back-button:hover {
  background-color: rgba(255, 255, 255, 0.2);
}

/* User Info Container in Devices Page */
.user-info-container {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  margin-top: 1rem;
}

.user-name {
  color: var(--accent-color);
  font-weight: bold;
}

.logout-btn {
  background-color: rgba(255, 255, 255, 0.1);
  color: var(--text-color);
  border: none;
  border-radius: var(--border-radius);
  padding: 0.5rem 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: background-color 0.2s;
}

.logout-btn:hover {
  background-color: var(--error-color);
  color: white;
}

/* Content Styles for Device Detail Pages */
.main-content {
  display: flex;
  height: calc(100vh - var(--header-height) - var(--footer-height));
  background-color: var(--dark-color);
  overflow: hidden;
  margin-top: var(--header-height);
}

/* Device detail page sidebar */
.sidebar {
  width: 300px;
  padding: 1rem;
  background-color: var(--dark-color);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
}

.device-image-container {
  width: 100%;
  height: 250px;
  margin-bottom: 1rem;
  display: flex;
  justify-content: center;
  align-items: center;
  background-color: rgba(15, 23, 42, 0.5);
  padding: 1rem;
  border-radius: var(--border-radius);
  overflow: hidden;
}

.device-image {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

/* Device info in detail page */
.sidebar .device-info {
  text-align: center;
  color: var(--light-color);
  width: 100%;
}

.sidebar .device-brand {
  font-size: 1.2rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: var(--accent-color);
}

.sidebar .device-model {
  font-size: 1.5rem;
  font-weight: 700;
  margin: 0.5rem 0 0 0;
  color: var(--light-color);
}

/* Chat History Modal Styles */
.history-message-content.markdown-content {
  white-space: normal;
  max-height: none;
  overflow-y: auto;
}

.history-message {
  margin-bottom: 15px;
  padding: 10px 15px;
  border-radius: 10px;
  white-space: pre-wrap;
}

.history-user-message {
  background-color: var(--history-user-msg-bg);
  color: var(--history-user-msg-color);
  align-self: flex-end;
  border-bottom-right-radius: 0;
  margin-left: 20%;
}

.history-assistant-message {
  background-color: var(--history-assistant-msg-bg);
  color: var(--history-assistant-msg-color);
  align-self: flex-start;
  border-bottom-left-radius: 0;
  margin-right: 20%;
}

/* استایل‌های مربوط به منابع دستگاه */
.loading-resources {
  padding: 15px;
  text-align: center;
  color: #888;
  font-size: 0.9rem;
}

.error-resources {
  padding: 15px;
  text-align: center;
  color: #e74c3c;
  font-size: 0.9rem;
}

.no-resources {
  padding: 15px;
  text-align: center;
  color: #888;
  font-size: 0.9rem;
  font-style: italic;
}

.resource-link {
  display: flex;
  align-items: center;
  padding: 10px 15px;
  margin: 5px 0;
  border-radius: 6px;
  background-color: rgba(255, 255, 255, 0.05);
  color: #fff;
  text-decoration: none;
  transition: all 0.2s ease;
}

.resource-link:hover {
  background-color: rgba(255, 255, 255, 0.1);
  transform: translateY(-2px);
}

.resource-link i {
  color: #e74c3c;
  font-size: 1.2rem;
  margin-left: 10px;
}

.resource-name {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.resource-size {
  color: #bbb;
  font-size: 0.8rem;
  margin-right: 5px;
}

/* استایل‌های مربوط به تاریخچه چت */
.history-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.7);
  z-index: 2000;
  display: flex;
  justify-content: center;
  align-items: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s, visibility 0.3s;
}

.history-modal.show {
  opacity: 1;
  visibility: visible;
}

.history-content {
  width: 90%;
  max-width: 800px;
  max-height: 85vh;
  background-color: var(--primary-color);
  border-radius: 12px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 15px 25px rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border-color);
  animation: modalFadeIn 0.3s forwards;
}

.history-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  background-color: var(--secondary-color);
  border-bottom: 1px solid var(--border-color);
}

.history-header h2 {
  margin: 0;
  font-size: 20px;
  color: var(--text-color);
}

.history-selector {
  background-color: var(--primary-color);
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
}

.history-selector select {
  width: 100%;
  padding: 10px 12px;
  border-radius: 8px;
  background-color: var(--secondary-color);
  color: var(--text-color);
  border: 1px solid var(--border-color);
  outline: none;
  font-family: inherit;
  cursor: pointer;
  font-size: 14px;
}

.history-messages {
  flex: 1;
  padding: 16px 20px;
  overflow-y: auto;
  background-color: var(--primary-color);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.history-time-header {
  text-align: center;
  color: var(--text-secondary);
  font-size: 14px;
  margin: 12px 0;
  position: relative;
  font-weight: 500;
}

.history-time-header::before,
.history-time-header::after {
  content: '';
  position: absolute;
  top: 50%;
  width: 30%;
  height: 1px;
  background-color: rgba(255, 255, 255, 0.1);
}

.history-time-header::before {
  right: 0;
}

.history-time-header::after {
  left: 0;
}

.history-message {
  padding: 10px 15px;
  border-radius: 12px;
  max-width: 85%;
  position: relative;
  margin-bottom: 4px;
  animation: fadeIn 0.3s forwards;
}

.history-message .message-content {
  word-break: break-word;
}

.history-user {
  background-color: var(--history-user-msg-bg);
  color: var(--history-user-msg-color);
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}

.history-assistant {
  background-color: var(--history-assistant-msg-bg);
  color: var(--history-assistant-msg-color);
  align-self: flex-start;
  border-bottom-left-radius: 4px;
}

.device-badge {
  background-color: rgba(0, 0, 0, 0.15);
  padding: 3px 8px;
  border-radius: 12px;
  font-size: 12px;
  display: inline-block;
  margin-bottom: 6px;
  color: rgba(255, 255, 255, 0.85);
}

.empty-history,
.error-history,
.loading-history {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-secondary);
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
}

.loading-history {
  animation: pulse 1.5s infinite;
}

.error-history {
  color: var(--error-color);
}

/* استایل‌های اضافی برای تاریخچه چت */
.history-summary {
  background-color: rgba(30, 41, 59, 0.5);
  padding: 12px 16px;
  margin-bottom: 20px;
  border-radius: 8px;
  font-size: 14px;
  color: var(--text-secondary);
  text-align: center;
  display: flex;
  justify-content: space-around;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.history-summary div {
  padding: 4px 8px;
  border-radius: 4px;
}

.message-sender {
  font-size: 12px;
  margin-bottom: 5px;
  opacity: 0.8;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.9);
}

.history-user .message-sender {
  text-align: right;
}

.history-assistant .message-sender {
  text-align: left;
}

/* تقویت استایل‌های پیام‌های تاریخچه */
.history-user {
  background-color: var(--history-user-msg-bg);
  color: var(--history-user-msg-color);
  align-self: flex-end;
  border-bottom-right-radius: 4px;
  margin-left: auto;
  margin-right: 10px;
  position: relative;
}

.history-assistant {
  background-color: var(--history-assistant-msg-bg);
  color: var(--history-assistant-msg-color);
  align-self: flex-start;
  border-bottom-left-radius: 4px;
  margin-right: auto;
  margin-left: 10px;
  position: relative;
}

.history-user:after {
  content: '';
  position: absolute;
  bottom: 0;
  right: -8px;
  width: 0;
  height: 0;
  border: 8px solid transparent;
  border-left-color: var(--history-user-msg-bg);
  border-right: 0;
  border-bottom: 0;
  margin-bottom: 0;
} 