/* =============================================================
   styles.css — глобальные стили АУ Система
   Локальная копия (stub) — используется когда DiskO-файл недоступен.
   ============================================================= */

*, *::before, *::after { box-sizing: border-box; }

html { font-size: 16px; }

body {
  margin: 0;
  padding: 0;
  font-family: 'Google Sans', Roboto, -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
  font-size: 14px;
  color: #202124;
  background: #f8f9fa;
  line-height: 1.5;
}

/* ===== КОНТЕЙНЕР ===== */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px;
}

/* ===== ЗАГОЛОВКИ ===== */
h1 { font-size: 1.8em; margin: 0 0 8px; color: #202124; }
h2 { font-size: 1.4em; margin: 0 0 8px; color: #202124; }
h3 { font-size: 1.1em; margin: 0 0 8px; color: #3c4043; }

header {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 30px;
  border-radius: 12px;
  margin-bottom: 24px;
  text-align: center;
}
header h1 { color: white; font-size: 2em; margin-bottom: 8px; }
.subtitle { color: rgba(255,255,255,0.85); font-size: 1.1em; margin: 0; }

/* ===== ПАНЕЛИ / СЕКЦИИ ===== */
.main-content { display: flex; flex-direction: column; gap: 20px; }

.connection-panel {
  background: white;
  padding: 28px;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.info-panel {
  background: #d4edda;
  border-left: 4px solid #28a745;
  padding: 20px;
  border-radius: 8px;
}

/* ===== ПОЛЯ ВВОДА ===== */
.input-group {
  margin-bottom: 20px;
}

.input-group label {
  display: block;
  font-weight: 600;
  margin-bottom: 6px;
  color: #3c4043;
  font-size: 0.95em;
}

.input-group input[type="text"],
.input-group input[type="password"],
.input-group input[type="email"],
.input-group input[type="number"],
.input-group select,
.input-group textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid #dadce0;
  border-radius: 8px;
  font-size: 0.95em;
  font-family: inherit;
  color: #202124;
  background: #fff;
  transition: border-color 0.2s, box-shadow 0.2s;
  outline: none;
}

.input-group input:focus,
.input-group select:focus,
.input-group textarea:focus {
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.15);
}

/* ===== КНОПКИ ===== */
button {
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s;
}

button:disabled { opacity: 0.55; cursor: not-allowed; }

.btn, .button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 20px;
  border: none;
  border-radius: 8px;
  font-size: 0.92em;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s, box-shadow 0.2s;
}

.btn-primary {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
}
.btn-primary:hover { opacity: 0.9; transform: translateY(-1px); box-shadow: 0 4px 12px rgba(102,126,234,0.35); }

.btn-success { background: #28a745; color: white; }
.btn-success:hover { background: #218838; }

.btn-danger { background: #dc3545; color: white; }
.btn-danger:hover { background: #c82333; }

.btn-secondary { background: #6c757d; color: white; }
.btn-secondary:hover { background: #5a6268; }

.btn-outline {
  background: transparent;
  border: 1.5px solid #667eea;
  color: #667eea;
}
.btn-outline:hover { background: rgba(102, 126, 234, 0.08); }

/* ===== ФОРМЫ В СТИЛЕ МАТЕРИАЛ ===== */
.form-row { display: flex; gap: 16px; flex-wrap: wrap; }
.form-row .input-group { flex: 1; min-width: 200px; }

/* ===== ТАБЛИЦЫ (общие стили) ===== */
.data-table-wrapper {
  overflow-x: auto;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  background: white;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88em;
}

.data-table th {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 10px 12px;
  text-align: left;
  font-weight: 600;
  font-size: 0.85em;
  position: sticky;
  top: 0;
  z-index: 10;
}

.data-table td {
  padding: 8px 12px;
  border-bottom: 1px solid #f0f0f0;
  color: #3c4043;
}

.data-table tr:hover td { background: #f8f9ff; }
.data-table tr.selected td { background: #e8edff; }

/* ===== СОСТОЯНИЯ ЗАГРУЗКИ ===== */
.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 40px;
  color: #5f6368;
  font-size: 0.95em;
}

.loading::before {
  content: '';
  width: 20px;
  height: 20px;
  border: 3px solid #e8eaed;
  border-top-color: #667eea;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ===== СООБЩЕНИЯ / АЛЕРТЫ ===== */
.alert {
  padding: 14px 18px;
  border-radius: 8px;
  margin-bottom: 16px;
  font-size: 0.92em;
  display: flex;
  align-items: flex-start;
  gap: 10px;
}
.alert-success { background: #d4edda; color: #155724; border-left: 4px solid #28a745; }
.alert-error   { background: #f8d7da; color: #721c24; border-left: 4px solid #dc3545; }
.alert-warning { background: #fff3cd; color: #856404; border-left: 4px solid #ffc107; }
.alert-info    { background: #d1ecf1; color: #0c5460; border-left: 4px solid #17a2b8; }

/* ===== БЕЙДЖИ ===== */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 0.78em;
  font-weight: 600;
  white-space: nowrap;
}
.badge-success { background: #d4edda; color: #155724; }
.badge-danger  { background: #f8d7da; color: #721c24; }
.badge-warning { background: #fff3cd; color: #856404; }
.badge-info    { background: #d1ecf1; color: #0c5460; }
.badge-primary { background: #e8eeff; color: #3c4eaa; }

/* ===== КАРТОЧКИ ===== */
.card {
  background: white;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  overflow: hidden;
}
.card-header {
  padding: 16px 20px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  font-weight: 600;
  font-size: 0.95em;
}
.card-body { padding: 20px; }

/* ===== СПИСОК / SIDEBAR ===== */
.sidebar {
  width: 260px;
  flex-shrink: 0;
  background: white;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  padding: 16px;
}
.sidebar-item {
  padding: 10px 14px;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.92em;
  color: #3c4043;
  transition: background 0.15s;
  text-decoration: none;
}
.sidebar-item:hover { background: #f5f7fa; }
.sidebar-item.active { background: #e8eeff; color: #3c4eaa; font-weight: 600; }

/* ===== МОДАЛЬНЫЕ ОКНА ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 60px;
  z-index: 10000;
}
.modal {
  background: white;
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.25);
  max-width: 600px;
  width: 95%;
  max-height: 85vh;
  overflow-y: auto;
  animation: slideDown 0.2s ease;
}
@keyframes slideDown { from { transform: translateY(-20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.modal-header {
  padding: 18px 24px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border-radius: 12px 12px 0 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.modal-header h2 { margin: 0; font-size: 1.1em; color: white; }
.modal-close { background: none; border: none; color: white; font-size: 1.5em; cursor: pointer; padding: 0 4px; }
.modal-body { padding: 24px; }
.modal-footer { padding: 16px 24px; border-top: 1px solid #e8eaed; display: flex; gap: 10px; justify-content: flex-end; }

/* ===== ПЕРЕКЛЮЧАТЕЛИ ===== */
.toggle {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
}
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute;
  inset: 0;
  background: #ccc;
  border-radius: 24px;
  transition: 0.3s;
  cursor: pointer;
}
.toggle-slider::before {
  content: '';
  position: absolute;
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background: white;
  border-radius: 50%;
  transition: 0.3s;
}
.toggle input:checked + .toggle-slider { background: #667eea; }
.toggle input:checked + .toggle-slider::before { transform: translateX(20px); }

/* ===== ФИЛЬТРЫ ===== */
.filters-bar {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
  padding: 12px 16px;
  background: #f8f9fa;
  border-radius: 8px;
  margin-bottom: 16px;
}
.filters-bar input, .filters-bar select {
  padding: 7px 12px;
  border: 1.5px solid #dadce0;
  border-radius: 6px;
  font-size: 0.9em;
  font-family: inherit;
  outline: none;
  background: white;
}
.filters-bar input:focus, .filters-bar select:focus { border-color: #667eea; }

/* ===== СКРОЛЛБАР ===== */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: #f1f1f1; border-radius: 4px; }
::-webkit-scrollbar-thumb { background: #bbb; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #888; }

/* Подсказка title остаётся; cursor:help давал курсор «?» (на macOS) и нативный tooltip часто не виден на скриншотах */
[title] { cursor: inherit; }

/* ===== УТИЛИТЫ ===== */
.text-muted { color: #5f6368; }
.text-small { font-size: 0.85em; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.hidden { display: none !important; }
.flex { display: flex; }
.flex-1 { flex: 1; }
.gap-8 { gap: 8px; }
.gap-16 { gap: 16px; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.p-8 { padding: 8px; }
.p-16 { padding: 16px; }

/* ===== АДАПТИВНОСТЬ ===== */
@media (max-width: 768px) {
  .container { padding: 12px; }
  .connection-panel { padding: 16px; }
  .form-row { flex-direction: column; }
  .sidebar { width: 100%; }
  .modal { max-width: 100%; margin: 0; border-radius: 0; }
}

/* ===== АНИМАЦИИ ===== */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

.fade-in { animation: fadeIn 0.25s ease; }
.slide-up { animation: slideUp 0.25s ease; }
