/* =========================================
   X24 — Global Stylesheet (style.css)
   - Светлая/тёмная тема на CSS-переменных
   - Единые кнопки/формы/таблицы/карточки
   - Инструменты: тултипы, алерты, утилиты
   - Адаптив и печать
========================================= */

/* ==========================
   Цветовые переменные
========================== */
:root {
  --bg:        #f7f7fb;
  --card:      #ffffff;
  --text:      #222222;
  --muted:     #666666;
  --line:      #e8e8ef;
  --brand:     #2563eb;
  --brand-2:   #1e40af;
  --success:   #10b981;
  --danger:    #ef4444;
  --warn:      #f59e0b;
  --shadow:    0 8px 24px rgba(0,0,0,.08);
}

/* Темная тема — добавь класс .dark-mode на <body> */
body.dark-mode {
  --bg:      #1e1e2f;
  --card:    #2a2a3f;
  --text:    #f0f0f0;
  --muted:   #aaaaaa;
  --line:    #444466;
  --brand:   #4f46e5;
  --brand-2: #3730a3;
  --shadow:  0 8px 24px rgba(0,0,0,.25);
}

/* ==========================
   Базовые стили/контейнер
========================== */
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.wrap {
  max-width: 100%;
  margin: 32px auto;
  padding: 0 16px;
}

.header { text-align: center; margin-bottom: 24px; }
.header h1 { font-size: 28px; margin: 0; }
.header .description {
  font-size: 16px; color: var(--muted);
  margin-top: 8px; line-height: 1.5;
  max-width: 900px; margin-left: auto; margin-right: auto;
}

/* ==========================
   Карточки/блоки/алерты
========================== */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px;
  margin: 16px 0;
  box-shadow: var(--shadow);
}

.alert {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  margin: 12px 0;
}
.alert.success { background: rgba(16,185,129,.08); border-color: rgba(16,185,129,.25); color: #0a6d55; }
.alert.error   { background: rgba(239,68,68,.08);  border-color: rgba(239,68,68,.25);  color: #8a1f1f; }
.alert.warn    { background: rgba(245,158,11,.10); border-color: rgba(245,158,11,.35); color: #6a4706; }

/* ==========================
   Формы / поля / фильтры
========================== */
form.filters {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 14px;
}

.field { margin: 12px 0; }
.field label { display: block; margin: 0 0 6px; font-weight: 600; color: var(--text); }
input[type=text],
input[type=file],
select,
textarea {
  width: 100%;
  max-width: 520px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--text);
  outline: none;
  transition: border-color .15s ease, box-shadow .15s ease;
}
input[type=text]:focus,
input[type=file]:focus,
select:focus,
textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(37,99,235,.15);
}
textarea { min-height: 120px; resize: vertical; }

.inline-field {
  display: inline-flex; align-items: center; gap: 8px;
}

/* ==========================
   Кнопки
========================== */
.btn {
  appearance: none;
  border: 0;
  border-radius: 10px;
  padding: 10px 14px;
  cursor: pointer;
  font-weight: 600;
  transition: transform .04s ease, background .15s ease, color .15s ease, border-color .15s ease;
  user-select: none;
}
.btn:active { transform: translateY(1px); }

.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-2); }

.btn-ghost { background: var(--card); border: 1px solid var(--line); color: var(--text); }
.btn-ghost:hover { border-color: var(--brand); }

.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { filter: brightness(.95); }

.btn-row { display: flex; gap: 10px; flex-wrap: wrap; }

/* ==========================
   Таблицы
========================== */
table {
  width: 100%;
  border-collapse: collapse;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  background: var(--card);
}
th, td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
  text-align: left;
}
th {
  background: #fafafe;
  font-weight: 700;
}
tr:last-child td { border-bottom: 0; }

th.speciality-col, td.speciality-col {
  min-width: 420px;
  white-space: pre-wrap;
}
.w30 { width: 72px; text-align: center; }

/* Табличные метки/бейджи */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  background: #eef;
  color: #334;
  font-weight: 600;
  font-size: 12px;
}
.row-actions form { display: inline; }

/* Контейнер тултипа — только иконка + подсказка */
.tooltip {
  position: relative;
  display: inline-block;
  cursor: help;
}

/* Иконка */
.tooltip .info {
  font-size: 16px;
  color: var(--muted);
  margin-left: 6px;
  transition: color .2s ease;
}
.tooltip:hover .info {
  color: var(--brand);
}

/* Подсказка — центрируется по иконке */
.tooltip .tip {
  position: absolute;
  bottom: calc(100% + 10px);
  left: 50%;
  transform: translateX(-50%);
  width: 320px;
  padding: 10px 14px;
  background: #111;
  color: #fff;
  border-radius: 8px;
  font-size: 13px;
  line-height: 1.4;
  box-shadow: 0 8px 24px rgba(0,0,0,.25);
  opacity: 0;
  visibility: hidden;
  transition: opacity .2s ease, visibility .2s ease;
  z-index: 20;
  text-align: left;
  white-space: normal;
}

/* Стрелка по центру */
.tooltip .tip::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 50%;
  margin-left: -6px;
  border-width: 6px;
  border-style: solid;
  border-color: #111 transparent transparent transparent;
}

/* Показ */
.tooltip:hover .tip,
.tooltip:focus-within .tip {
  opacity: 1;
  visibility: visible;
}


/* ==========================
   Витрина: шапка/футер/баннеры
========================== */
.footer {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  margin-top: 40px;
  padding: 20px;
  border-top: 1px solid var(--line);
  background: transparent;
}
.footer-col { flex: 1; }

.banner-slider img {
  max-width: 100%;
  display: block;
  margin-bottom: 10px;
  border-radius: 8px;
  box-shadow: var(--shadow);
}

/* ==========================
   Утилиты
========================== */
.no-print { /* скрыть блок при печати */ }
.text-muted { color: var(--muted) !important; }
.text-center { text-align: center !important; }
.mt-0{margin-top:0!important}.mt-8{margin-top:8px!important}.mt-12{margin-top:12px!important}.mt-16{margin-top:16px!important}
.mb-0{margin-bottom:0!important}.mb-8{margin-bottom:8px!important}.mb-12{margin-bottom:12px!important}.mb-16{margin-bottom:16px!important}
.p-0{padding:0!important}.p-8{padding:8px!important}.p-12{padding:12px!important}.p-16{padding:16px!important}

/* ==========================
   Адаптивность
========================== */
@media (max-width: 900px) {
  .wrap { padding: 0 12px; }
}
@media (max-width: 768px) {
  table, th, td { font-size: 13px; }
  .wrap { padding: 0 10px; }
  .header h1 { font-size: 24px; }
}

/* ==========================
   Печать
========================== */
@media print {
  .no-print { display: none !important; }
  body { background: #fff; color: #000; }
  .card { border: 0; box-shadow: none; }
  .btn, .tooltip .info, .tooltip .tip { display: none !important; }
}


.toolbar {
    white-space: nowrap; /* запрещает перенос */
}
.toolbar button {
    display: inline-block; /* кнопки идут рядом */
    margin-right: 5px;     /* расстояние между кнопками */
}

.title,
.status,
.speciality {
    white-space: pre-wrap;   /* сохраняет переносы */
    word-break: break-word;  /* перенос длинных слов */
    overflow-wrap: break-word; /* на случай очень длинных */
}
