.md-typeset h1 {
/*  color: #000; */
  font-weight: 800;
}

.md-typeset h2 {
/*  color: #000; */
  font-weight: 800;
}

.md-typeset h3 {
  font-size: 1.5em;
  font-weight: 600;
}

.md-typeset table:not([class]) {
  font-size: 0.7rem;
}

.md-typeset .admonition, .md-typeset details {
    font-size: 0.7rem; 
}

.md-typeset table:not([class]) th {
  font-weight: 700;
  font-size: 0.7rem;
  min-width: 3rem;
}

del {
  text-decoration: none;
  background-color: var(--md-primary-fg-color);
  color: var(--md-default-fg-color--light);
  padding: 4px 4px;
  border: solid var(--md-default-fg-color--light) 1px;
  white-space: nowrap;
  border-radius: 5pt;
}

.md-typeset {
  font-size: 0.7rem;
}


.md-tabs__list {
  flex-direction: row;
  flex-wrap: wrap;
  justify-content: center;
}

.md-tabs {
  border-bottom: 1px solid var(--md-default-fg-color--lightest);
}

.md-tabs__item {
  height: 3rem;
  padding-left: 1rem;
  padding-right: 1rem;
  white-space: normal;
  width: min-content;
}

.md-grid {
  max-width: 90%;
}

@media (min-width: 1220px) {
  .md-main__inner {
    margin-top: 0;
  }

  .md-sidebar {
    height: auto;
  }

  .md-sidebar--primary {
    border-right: 1px solid var(--md-default-fg-color--lightest);
  }

  .md-nav .md-nav__title {
    display: none;
  }

  .md-nav__icon {
    width: 1.2rem;
    height: 1.2rem;
    margin-top: -.1rem;
  }
}

  .md-typeset blockquote {
    font-size: 0.65rem;
    ul { list-style-type: none;}
  }


[data-md-color-scheme=default] {
  --md-default-fg-color--light: 000;
  --md-primary-fg-color: #ff6e42;
}

[data-md-color-scheme=slate] {
  --md-default-fg-color--light: hsla(var(--md-hue), 15%, 100%, 0.8);
  --md-primary-fg-color: #121215;
}

.md-header {
  background-color: var(--md-primary-fg-color);
}

.md-typeset code {
  font-size: 0.95em;
}


.md-social__link {
  display: contents;
}

.md-social {
  display: flex;
  justify-content: center;
  margin-left: auto;
  margin-right: auto;
}

.social-table {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
  width: auto;
  margin: 0 auto;
}

.social-item {
  padding: 0.1rem;
  display: flex;
  gap: 0.3rem;
}

.custom-link {
  color: var(--md-typeset-a-color);
  word-break: break-word;
  transition: color 125ms;
  cursor: pointer;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}

.custom-link:hover, .custom-link:focus {
    color: var(--md-accent-fg-color);
}

@media (max-width: 768px) {
  .md-typeset__table table {
    animation: shake-horizontal 1.2s ease-in-out;
  }

  @keyframes shake-horizontal {
    0% { transform: translateX(0); }
    25% { transform: translateX(-10px); }
    50% { transform: translateX(0); }
    75% { transform: translateX(-5px); }
    100% { transform: translateX(0); }
  }
}

#chat-widget {
  position: fixed;
  bottom: 90px;
  right: 20px;
  width: 450px;
  max-height: 0;
  overflow: hidden;
  background-color: var(--md-default-bg-color);
  border-radius: 8px;
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.3), 0 4px 6px rgba(0, 0, 0, 0.2);
  transition: max-height 0.3s ease-out;
  z-index: 9998;
  display: flex;
  flex-direction: column;
  resize: both;
  overflow: auto;
  border: none;
}

#chat-widget.expanded {
  max-height: 700px;
  transform: scaleY(1);
}

#chat-widget.collapsed {
  max-height: 0;
  transform: scaleY(0);
}

.resize-handle {
  position: absolute;
  top: 0;
  left: 0;
  width: 10px;
  height: 10px;
  cursor: nwse-resize;
  z-index: 10000;
  background-color: var(--md-typeset-a-color);
  border-radius: 50%;
  opacity: 0.7;
}

.resize-handle:hover {
  opacity: 1;
  background-color: var(--md-primary-fg-color);
}

#chat-header {
  background-color: var(--md-typeset-a-color);
  color: white;
  padding: 10px;
  font-weight: bold;
  font-size: 0.7rem;
  text-align: center;
  position: relative;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  border-top-left-radius: 8px;
  border-top-right-radius: 8px;
}

#chat-close {
  position: absolute;
  top: 8px;
  right: 10px;
  font-size: 20px;
  cursor: pointer;
  color: rgba(255, 255, 255, 0.8);
  transition: color 0.2s ease;
}

#chat-close:hover {
  color: white;
}

#chat-messages {
  flex-grow: 1;
  padding: 10px;
  overflow-y: auto;
  min-height: 200px;
  font-size: 0.6rem;
  background-color: var(--md-default-bg-color);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

#chat-messages::-webkit-scrollbar {
  width: 8px;
}

#chat-messages::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 4px;
}

#chat-messages::-webkit-scrollbar-thumb {
  background: var(--md-typeset-a-color);
  border-radius: 4px;
  transition: background 0.2s ease;
}

#chat-messages::-webkit-scrollbar-thumb:hover {
  background: #ff7e00;
}

.message {
  margin: 5px 0;
  padding: 10px;
  border-radius: 5px;
  max-width: 80%;
  clear: both;
  word-wrap: break-word;
  background-color: var(--md-default-fg-color--lightest);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.user-message {
  background-color: var(--md-default-fg-color--lightest);
  float: right;
  text-align: right;
  border-bottom-right-radius: 3px;
}

.bot-message {
  background-color: var(--md-default-fg-color--lightest);
  float: left;
  text-align: left;
  border-bottom-left-radius: 3px;
}

#chat-input-container {
  display: flex;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  background-color: var(--md-default-bg-color);
  padding: 10px;
  border-bottom-left-radius: 8px;
  border-bottom-right-radius: 8px;
}

#chat-input {
  flex-grow: 1;
  padding: 10px;
  border: none;
  outline: none;
  font-size: 14px;
  background-color: var(--md-default-fg-color--lightest);
  border-radius: 4px;
}

#chat-input:focus {
  background-color: var(--md-default-fg-color--lightest);
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.2);
}

#chat-send {
  padding: 10px;
  background-color: #28a745;
  color: white;
  border: none;
  cursor: pointer;
  border-radius: 4px;
  margin-left: 10px;
  transition: background-color 0.2s ease;
}

#chat-send:hover {
  background-color: #218838;
}

#chat-new {
  margin: 15px auto;
  padding: 12px 24px;
  background-color: var(--md-primary-fg-color);
  border: none;
  cursor: pointer;
  font-size: 0.6rem;
  color: white;
  border-radius: 24px;
  transition: all 0.2s ease;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
  min-width: 120px;
  text-align: center;
  font-weight: 500;
}

#chat-new:hover {
  background-color: #1c3d2f;
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

#chat-new:active {
  transform: translateY(0);
}

.loading {
  display: inline-block;
  height: 8px;
  width: 24px;
  background: transparent;
  vertical-align: middle;
  margin-left: 5px;
  font-size: 10px;
}

.loading::after {
  content: '';
  display: block;
  height: 8px;
  width: 8px;
  background: var(--md-typeset-a-color);
  border-radius: 50%;
  animation: typing 1.2s infinite ease-in-out;
}

@keyframes typing {
  0%   { transform: translateX(0) scale(1); opacity: 1; }
  25%  { transform: translateX(6px) scale(1.3); opacity: 0.8; }
  50%  { transform: translateX(12px) scale(1); opacity: 1; }
  75%  { transform: translateX(18px) scale(1.3); opacity: 0.8; }
  100% { transform: translateX(0); opacity: 1; }
}

/* Улучшенные стили для Markdown */
.bot-message ol,
.bot-message ul {
  padding-left: 20px;
  margin: 5px 0;
  list-style-position: outside;
}

.bot-message pre {
  background-color: var(--md-code-bg-color);
  padding: 10px;
  border-radius: 4px;
  overflow-x: auto;
  margin: 10px 0;
  border: 1px solid rgba(255, 255, 255, 0.1);
  font-family: 'Courier New', monospace;
}

.bot-message code {
  background-color: var(--md-code-bg-color);
  padding: 2px 4px;
  border-radius: 3px;
  font-family: 'Courier New', monospace;
}

.bot-message strong {
  font-weight: bold;
}

.bot-message em {
  font-style: italic;
}

.bot-message a {
  color: var(--md-typeset-a-color);
  text-decoration: underline;
  transition: color 0.2s ease;
}

.bot-message a:hover {
  color: #ff6b00;
}

.bot-message blockquote {
  border-left: 4px solid #ccc;
  margin: 10px 0;
  padding-left: 10px;
  color: #555;
  font-style: italic;
}

.bot-message img {
  max-width: 100%;
  height: auto;
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.bot-message table {
  border-collapse: collapse;
  width: 100%;
  margin: 10px 0;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.bot-message th,
.bot-message td {
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 8px;
  text-align: left;
}

.bot-message th {
  background-color: var(--md-code-bg-color);
  font-weight: bold;
}

#chat-collapsed {
  position: fixed;
  bottom: 20px;
  right: 20px;
  max-width: 350px;
  width: 100%;
  height: 60px;
  background-color: var(--md-default-bg-color);
  color: white;
  border: 2px solid var(--md-typeset-a-color);
  border-radius: 30px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 20px;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.3);
  z-index: 9997;
  cursor: pointer;
  font-size: 0.7rem;
  overflow: hidden;
  transition: all 0.3s ease;
  white-space: nowrap;
}

#chat-collapsed .collapsed-text {
  flex-grow: 1;
  text-align: left;
  color: var(--md-typeset-color, #ff6e42);
  font-weight: 500;
  text-overflow: ellipsis;
  overflow: hidden;
}

#chat-collapsed:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4);
}

#chat-button {
      position: fixed;
      bottom: 20px;
      right: 20px;
      width: 60px;
      height: 60px;
      background-color: var(--md-typeset-a-color);
      color: white;
      border-radius: 50%;
      text-align: center;
      font-size: 36px;
      line-height: 60px;
      cursor: pointer;
      box-shadow: 0 0 10px rgba(0,0,0,0.3);
      z-index: 9999;
}

#chat-button .material-symbols-outlined {
      font-size: 36px;
      line-height: 60px;
    }

.my_custom_modal_overlay {
  position: fixed;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.8); 
  display: flex; 
  justify-content: center; 
  align-items: center; 
  z-index: 10000; 


.my_custom_modal_image {
  max-width: 90%; 
  max-height: 90vh; 
  object-fit: contain; 
  border: 2px solid white; 
  box-shadow: 0 4px 8px rgba(0,0,0,0.5); 
}

.my_custom_modal_close {
  position: absolute; 
  top: 20px; 
  right: 20px; 
  font-size: 40px; 
  color: white;
  cursor: pointer;
  z-index: 10001;
  line-height: 1; 
}