/* ============================================================
   clinic-features.css — дополнительные функции (раунд 3)
   - Индикатор "Сейчас открыто/закрыто"
   - Тёмная тема (prefers-color-scheme)
   - Кнопка "Поделиться" в шапке
   - Хлебные крошки (на подстраницах)
   - Улучшенные детали интерфейса
   ============================================================ */

/* --- 1. Индикатор "Открыто/Закрыто" --- */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  margin-left: 8px;
  white-space: nowrap;
  transition: background 0.3s, color 0.3s;
}
.status-badge::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
  animation: statusPulse 2s ease-in-out infinite;
}
@keyframes statusPulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.6; transform: scale(1.2); }
}
.status-badge.is-open {
  background: #e3eee5;
  color: #17616b;
}
.status-badge.is-closed {
  background: #fde8e8;
  color: #a04848;
}
.status-badge.is-urgent {
  background: #fff3cd;
  color: #856404;
}
@media (max-width: 650px) {
  .status-badge {
    margin-left: 0;
    margin-top: 4px;
    font-size: 11px;
    padding: 3px 9px;
  }
}

/* --- 2. Тёмная тема (по системной настройке) --- */
@media (prefers-color-scheme: dark) {
  :root {
    --white: #1a2826;
    --paper: #14201e;
    --ink: #e3ede9;
    --teal: #4db5be;
    --muted: #9bb0ad;
    --line: #2a3a37;
    --sage: #1f2d2b;
    --night: #1f2d2b;
  }
  body {
    background: var(--white);
    color: var(--ink);
  }
  .header, .card, .service, .background-panel, .form {
    background: var(--paper);
  }
  .hero-panel {
    background: rgba(20, 32, 30, 0.94);
  }
  .entrance {
    background: rgba(20, 32, 30, 0.94);
  }
  .footer {
    background: linear-gradient(180deg, var(--paper) 0%, #0e1816 100%);
  }
  img {
    /* Чуть приглушить для тёмной темы */
    filter: brightness(0.92);
  }
  .status-badge.is-open {
    background: rgba(77, 181, 190, 0.15);
  }
  .status-badge.is-closed {
    background: rgba(160, 72, 72, 0.18);
  }
  input, select, textarea {
    background: #1a2826;
    color: var(--ink);
  }
  .cookie-banner {
    background: var(--paper);
    color: var(--ink);
  }
  .top {
    background: var(--paper);
  }
  .scroll-progress {
    background: linear-gradient(90deg, var(--teal), #7ad6df);
  }
}

/* --- 3. Кнопка "Поделиться" --- */
.share-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 20px;
  color: var(--teal);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.2s, border-color 0.2s;
}
.share-button:hover {
  background: var(--paper);
  border-color: var(--teal);
}
.share-button svg {
  width: 14px;
  height: 14px;
}

/* --- 4. Хлебные крошки --- */
.breadcrumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 13px;
  color: var(--muted);
  margin: 12px 0 18px;
  padding: 0;
  list-style: none;
}
.breadcrumbs li {
  display: flex;
  align-items: center;
  gap: 6px;
}
.breadcrumbs li::after {
  content: '/';
  color: var(--line);
}
.breadcrumbs li:last-child::after {
  display: none;
}
.breadcrumbs a {
  color: var(--teal);
  text-decoration: none;
  transition: color 0.2s;
}
.breadcrumbs a:hover {
  color: #103f46;
  text-decoration: underline;
}
.breadcrumbs [aria-current] {
  color: var(--ink);
  font-weight: 500;
}

/* --- 5. Кнопка "Печать" на странице политики --- */
.print-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 20px;
  color: var(--teal);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.2s;
}
.print-button:hover {
  background: var(--paper);
}

/* --- 6. Улучшенная форма чата: "печатает..." индикатор --- */
.chat-typing {
  display: flex;
  gap: 4px;
  align-items: center;
  padding: 10px 0;
}
.chat-typing span {
  width: 7px;
  height: 7px;
  background: var(--muted);
  border-radius: 50%;
  animation: typingDot 1.2s ease-in-out infinite;
}
.chat-typing span:nth-child(2) { animation-delay: 0.2s; }
.chat-typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes typingDot {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.5; }
  30% { transform: translateY(-6px); opacity: 1; }
}

/* --- 7. Улучшенные schedule rows с иконками --- */
.schedule-row {
  position: relative;
  padding-left: 28px;
}
.schedule-row::before {
  content: '';
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--teal);
  opacity: 0.6;
}

/* --- 8. Внешние ссылки: добавление target="_blank" визуально --- */
.content a[target="_blank"] {
  display: inline-flex;
  align-items: baseline;
  gap: 3px;
}
.content a[target="_blank"] svg {
  width: 12px;
  height: 12px;
  opacity: 0.6;
}

/* --- 9. Стилизация details/summary --- */
details {
  position: relative;
  padding-left: 28px;
}
details > summary {
  list-style: none;
  position: relative;
  cursor: pointer;
  transition: color 0.2s;
}
details > summary::-webkit-details-marker {
  display: none;
}
details > summary::before {
  content: '+';
  position: absolute;
  left: -22px;
  top: 2px;
  width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 4px;
  font-size: 14px;
  font-weight: 700;
  color: var(--teal);
  transition: transform 0.2s, background 0.2s;
}
details[open] > summary::before {
  content: '−';
  background: var(--teal);
  color: white;
  transform: rotate(0deg);
}
details > summary:hover {
  color: var(--teal);
}
details[open] {
  background: linear-gradient(90deg, rgba(241, 246, 244, 0.5) 0%, transparent 100%);
  border-radius: 8px;
}

/* --- 10. Улучшенный sticky header с тенью при скролле --- */
.header {
  backdrop-filter: blur(8px);
  background: rgba(255, 255, 255, 0.92);
}
.header.is-compact {
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(12px);
}
@media (prefers-color-scheme: dark) {
  .header {
    background: rgba(20, 32, 30, 0.88);
  }
  .header.is-compact {
    background: rgba(20, 32, 30, 0.96);
  }
}

/* --- 11. Hero: glassmorphism эффект --- */
.hero-panel {
  backdrop-filter: blur(4px);
  box-shadow: 0 8px 32px rgba(36, 62, 66, 0.12);
}

/* --- 12. Поиск: улучшенный фокус --- */
.site-search input:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(23, 97, 107, 0.15);
  outline: 0;
}

/* --- 13. Вертикальный ритм: больше воздуха --- */
.section p {
  margin-bottom: 22px;
}
.section h3 + p {
  margin-top: -8px;
}

/* --- 14. Видео в архиве: контейнер --- */
video {
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(36, 62, 66, 0.08);
}

/* --- 15. Прокрутка чата: кастомный скроллбар --- */
#chat-messages {
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
}
#chat-messages::-webkit-scrollbar {
  width: 6px;
}
#chat-messages::-webkit-scrollbar-track {
  background: transparent;
}
#chat-messages::-webkit-scrollbar-thumb {
  background: var(--line);
  border-radius: 3px;
}
#chat-messages::-webkit-scrollbar-thumb:hover {
  background: var(--muted);
}

/* --- 16. respect reduced motion для новых анимаций --- */
@media (prefers-reduced-motion: reduce) {
  .status-badge::before,
  .chat-typing span,
  .chat-launcher:not(.is-opened) {
    animation: none !important;
  }
}
