/*
Пояснения к каждому блоку:
    :root — тут правишь цвета, радиусы, основной шрифт.
    body — общий фон и шрифт для всей страницы.
    .center — контейнер для форм/основных страниц по центру.
    .menu — горизонтальное меню, с настройкой стилей для ссылок.
    table, th, td, tr — стилизация таблиц, цветовые схемы.
    .status-dot, .status-dot.online, .status-dot.offline — иконка онлайн/оффлайн.
    button, .btn, .btn-grey — стили для всех кнопок (основные и второстепенные).
    input, select, textarea, label — поля ввода и подписи для них.
    .device-card — общий стиль карточки устройства.
    .device-card .header-row и .dev-type — “шапка” карточки.
    .device-card-grid — сетка (таблица параметров) внутри карточки.
    .section-title, .desc-box, .logs-box — оформление описания, логов и секций.
    .actions, .back-btn — кнопки управления на карточке.
    .err — для вывода ошибок (например, если сервер не ответил).
    @media — адаптивные стили для мобильных (сужение).
*/

.hide-file-input {
  display: none !important;
}

:root {
  /* === Глобальные переменные для цветов, радиусов, тени и шрифта === */
  --main-bg: #f7f7fa;            /* Цвет фона всей страницы */
  --card-bg: #fff;               /* Фон карточек, форм и таблиц */
  --card-radius: 20px;           /* Радиус скругления карточек и полей */
  --blue: #1677ff;               /* Главный синий цвет для кнопок и заголовков */
  --light-blue: #f0f6ff;         /* Светлый фон для описания/логов */
  --shadow: 0 4px 24px #0002;    /* Единая тень карточек и таблиц */
  --font-main: Inter, Arial, sans-serif; /* Главный шрифт сайта */
}

/* === Фон и базовый шрифт страницы === */
body {
  background: var(--main-bg);    /* Применяем фоновый цвет */
  font-family: var(--font-main); /* Задаём основной шрифт */
  margin: 0;                     /* Убираем стандартные отступы */
  padding: 0;
}

/* === Центральный контейнер для форм, меню и основных блоков === */
.center {
  max-width: 440px;              /* Максимальная ширина центрального блока */
  margin: 60px auto;             /* Центрирование по горизонтали, отступ сверху */
  background: var(--card-bg);    /* Белый фон */
  padding: 2.2em 2em 2em 2em;    /* Внутренние отступы */
  border-radius: 12px;           /* Скругление углов */
  box-shadow: var(--shadow);     /* Тень */
}

/* === Компактная карточка для форм входа/регистрации === */
.center.form-card {
  max-width: 400px;              /* Уменьшенная ширина */
  margin: 40px auto;             /* Меньший отступ сверху */
  padding: 2em 1.5em;            /* Компактные отступы */
}

/* === Исправление полей ввода в форме входа === */
.center.form-card input {
  width: calc(100% - 1.8em);     /* Учитываем padding контейнера */
  box-sizing: border-box;        /* Включаем padding и border в ширину */
  margin: 0.4em 0;               /* Отступы сверху и снизу */
  padding: 0.7em 0.9em;          /* Внутренние отступы */
  border: 1.1px solid #dbeafe;   /* Граница */
  border-radius: 8px;            /* Скругление */
  font-size: 1em;                /* Размер шрифта */
}

.center.form-card input:focus {
  border: 1.5px solid var(--blue); /* Синяя рамка при фокусе */
  outline: none;
  background: #e8f0fe;           /* Светлый фон при фокусе */
}

/* === Исправление кнопок в форме входа === */
.center.form-card button {
  width: calc(100% - 1.8em);     /* Учитываем padding контейнера */
  box-sizing: border-box;        /* Включаем padding и border в ширину */
  margin: 0.4em 0;               /* Отступы сверху и снизу */
  padding: 0.8em 1em;            /* Внутренние отступы */
  border: none;                  /* Убираем границу */
  border-radius: 8px;            /* Скругление */
  font-size: 1em;                /* Размер шрифта */
  cursor: pointer;               /* Курсор-указатель */
  transition: all 0.2s;          /* Плавные переходы */
}

.center.form-card button:hover {
  transform: translateY(-1px);   /* Легкий подъем при наведении */
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15); /* Тень при наведении */
}

/* === Горизонтальное меню навигации === */
.menu {
  display: flex;                 /* В строку */
  gap: 1em;                      /* Промежуток между пунктами */
  margin: 1.5em 0 1.2em 0;
  padding-left: 18px;
}
.menu a {
  text-decoration: none;         /* Без подчёркивания */
  color: #235;                   /* Цвет текста */
  font-weight: bold;             /* Жирный */
  padding: 5px 11px;             /* Отступы вокруг */
  border-radius: 7px;
  transition: background .15s;   /* Плавная смена фона при наведении */
}
.menu a:hover {
  background: var(--light-blue); /* Светлый фон при наведении */
}

/* === Правый блок меню (язык и версия) === */
.menu-right {
  margin-left: auto;              /* Прижимаем к правому краю */
  display: flex;                  /* В строку */
  align-items: center;            /* Выравнивание по центру */
  gap: 1em;                       /* Промежуток между элементами */
}

/* === Отображение версии в меню === */
.version-info {
  color: #888;                    /* Серый цвет */
  font-size: 0.9em;              /* Чуть меньше основного текста */
  font-weight: normal;           /* Обычный вес */
  padding: 5px 11px;             /* Отступы как у ссылок */
  background: #f5f5f5;           /* Светлый фон */
  border-radius: 7px;            /* Скругление */
  border: 1px solid #e0e0e0;     /* Тонкая рамка */
}

/* === Переключатель языков === */
.language-selector {
  display: flex;                  /* В строку */
  gap: 0.3em;                     /* Небольшой промежуток между флагами */
  align-items: center;            /* Выравнивание по центру */
  background: var(--card-bg);    /* Белый фон */
  padding: 4px 8px;               /* Внутренние отступы */
  border-radius: 8px;            /* Скругление */
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1); /* Легкая тень */
}

.lang-flag {
  font-size: 1.5em;              /* Размер флага */
  cursor: pointer;                /* Курсор-указатель */
  padding: 2px 4px;               /* Отступы вокруг флага */
  border-radius: 4px;             /* Скругление */
  transition: all 0.2s;          /* Плавные переходы */
  opacity: 0.6;                   /* Полупрозрачный по умолчанию */
  filter: grayscale(30%);         /* Немного обесцвеченный */
}

.lang-flag:hover {
  opacity: 1;                     /* Полностью непрозрачный при наведении */
  filter: grayscale(0%);          /* Полный цвет при наведении */
  transform: scale(1.15);        /* Увеличение при наведении */
  background: var(--light-blue); /* Светлый фон при наведении */
}

.lang-flag.active {
  opacity: 1;                     /* Полностью непрозрачный */
  filter: grayscale(0%);         /* Полный цвет */
  background: var(--light-blue);  /* Светлый фон для активного */
  box-shadow: 0 0 0 2px var(--blue); /* Синяя рамка для активного */
}

/* === Отображение версии в форме входа === */
.version-info-login {
  text-align: center;             /* Центрирование */
  color: #888;                    /* Серый цвет */
  font-size: 0.85em;             /* Чуть меньше основного текста */
  font-weight: normal;           /* Обычный вес */
  margin-top: 15px;              /* Отступ сверху */
  padding: 8px 12px;             /* Отступы */
  background: #f8f9fa;           /* Светлый фон */
  border-radius: 8px;            /* Скругление как у полей ввода */
  border: 1.1px solid #dbeafe;   /* Рамка как у полей ввода */
  width: calc(100% - 2em);       /* Ширина как у полей ввода, чуть уже */
  box-sizing: border-box;        /* Включаем padding и border в ширину */
}

/* === Стили для форм входа и регистрации === */

/* Кнопка регистрации */
.btn-register {
  background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
  color: white;
  border: none;
  padding: 12px 24px;
  border-radius: 6px;
  font-size: 16px;
  font-weight: bold;
  cursor: pointer;
  width: 100%;
  transition: all 0.3s ease;
  box-shadow: 0 2px 10px rgba(40, 167, 69, 0.3);
}

.btn-register:hover {
  background: linear-gradient(135deg, #218838 0%, #1ea085 100%);
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(40, 167, 69, 0.4);
}

/* Кнопка возврата */
.btn-back {
  background: #6c757d;
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: 6px;
  font-size: 14px;
  cursor: pointer;
  width: 100%;
  transition: all 0.3s ease;
}

.btn-back:hover {
  background: #5a6268;
  transform: translateY(-1px);
}

/* Сообщение об успехе */
.success-message {
  background: #d4edda;
  border: 1px solid #c3e6cb;
  color: #155724;
  padding: 20px;
  border-radius: 8px;
  margin: 20px 0;
  text-align: center;
}

.success-message p {
  margin: 10px 0;
  font-size: 16px;
}

.success-message p:first-child {
  font-weight: bold;
  font-size: 18px;
}

/* Ошибка регистрации */
.registration-error {
  background: #f8d7da;
  border: 1px solid #f5c6cb;
  color: #721c24;
  padding: 15px;
  border-radius: 6px;
  margin: 15px 0;
  text-align: center;
  font-weight: bold;
}

/* Улучшенные поля ввода для регистрации */
#registrationForm input {
  margin-bottom: 15px;
  padding: 12px 15px;
  border: 2px solid #e9ecef;
  border-radius: 8px;
  font-size: 16px;
  transition: all 0.3s ease;
  width: 100%;
  box-sizing: border-box;
}

#registrationForm input:focus {
  border-color: #28a745;
  box-shadow: 0 0 0 3px rgba(40, 167, 69, 0.1);
  outline: none;
}

#registrationForm input:invalid {
  border-color: #dc3545;
}

#registrationForm input:valid {
  border-color: #28a745;
}

/* Кнопка отправки формы регистрации */
#registrationForm button {
  background: linear-gradient(135deg, #007bff 0%, #0056b3 100%);
  color: white;
  border: none;
  padding: 15px 30px;
  border-radius: 8px;
  font-size: 16px;
  font-weight: bold;
  cursor: pointer;
  width: 100%;
  transition: all 0.3s ease;
  box-shadow: 0 2px 10px rgba(0, 123, 255, 0.3);
}

#registrationForm button:hover {
  background: linear-gradient(135deg, #0056b3 0%, #004085 100%);
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(0, 123, 255, 0.4);
}

#registrationForm button:active {
  transform: translateY(0);
}

/* === Стили для управления пользователями === */

/* Фильтры пользователей */
.user-filters {
  margin-bottom: 20px;
  padding: 15px;
  background: #f8f9fa;
  border-radius: 8px;
  border: 1px solid #e9ecef;
}

.user-filters .filter-row {
  display: flex;
  gap: 20px;
  align-items: center;
  flex-wrap: wrap;
}

.user-filters .status-filter,
.user-filters .search-filter {
  display: flex;
  align-items: center;
  gap: 8px;
}

.user-filters label {
  font-weight: bold;
  color: #333;
  white-space: nowrap;
}

.user-filters select,
.user-filters input {
  padding: 8px 12px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 14px;
}

.user-filters input {
  min-width: 200px;
}

/* Бейджи статусов пользователей */
.status-badge {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: bold;
  text-transform: uppercase;
}

.status-badge.pending {
  background: #fff3cd;
  color: #856404;
  border: 1px solid #ffeaa7;
}

.status-badge.active {
  background: #d4edda;
  color: #155724;
  border: 1px solid #c3e6cb;
}

.status-badge.blocked {
  background: #f8d7da;
  color: #721c24;
  border: 1px solid #f5c6cb;
}

/* Кнопки действий для пользователей */
.btn-approve {
  background: #28a745;
  color: white;
  border: none;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 12px;
  cursor: pointer;
  margin-right: 4px;
}

.btn-approve:hover {
  background: #218838;
}

.btn-reject {
  background: #dc3545;
  color: white;
  border: none;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 12px;
  cursor: pointer;
  margin-right: 4px;
}

.btn-reject:hover {
  background: #c82333;
}

.btn-toggle {
  background: #ffc107;
  color: #212529;
  border: none;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 12px;
  cursor: pointer;
  margin-right: 4px;
}

.btn-toggle:hover {
  background: #e0a800;
}

.btn-view {
  background: #17a2b8;
  color: white;
  border: none;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 12px;
  cursor: pointer;
}

.btn-view:hover {
  background: #138496;
}

/* Модальное окно с деталями пользователя */
.user-details-modal {
  background: white;
  padding: 30px;
  border-radius: 10px;
  max-width: 500px;
  margin: 50px auto;
  box-shadow: 0 4px 20px rgba(0,0,0,0.15);
}

.user-details {
  margin: 20px 0;
}

.user-details p {
  margin: 10px 0;
  padding: 8px 0;
  border-bottom: 1px solid #eee;
}

.user-details p:last-child {
  border-bottom: none;
}

.user-details strong {
  color: #333;
  min-width: 150px;
  display: inline-block;
}

.modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid #eee;
}

.modal-actions .btn {
  padding: 10px 20px;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  font-weight: bold;
}

.modal-actions .btn-secondary {
  background: #6c757d;
  color: white;
}

.modal-actions .btn-primary {
  background: #007bff;
  color: white;
}

.modal-actions .btn-danger {
  background: #dc3545;
  color: white;
}

.modal-actions .btn-warning {
  background: #ffc107;
  color: #212529;
}

.modal-actions .btn:hover {
  opacity: 0.9;
}

/* === Унификация таблиц — каждая как “карточка” === */
table {
  background: var(--card-bg);         /* Белый фон */
  border-radius: var(--card-radius);  /* Скругление */
  box-shadow: var(--shadow);          /* Тень */
  margin: 18px auto 22px auto;        /* Центрирование, отступы сверху/снизу */
  border-collapse: separate;          /* Таблица не слипается */
  border-spacing: 0;
  overflow: hidden;                   /* Лишнее не показываем */
  width: 97%;                         /* Ширина почти на всю страницу */
  font-size: 1.05em;                  /* Чуть крупнее стандартного */
}
th, td {
  padding: 12px 13px;                 /* Отступы в ячейках */
  text-align: left;                   /* Выравнивание по левому краю */
}
th {
  background: var(--light-blue);      /* Голубой фон у заголовков */
  font-weight: bold;                  /* Жирный текст */
  color: #1451b3;                     /* Синий цвет заголовка */
  border-bottom: 1.5px solid #e3e7ed; /* Линия снизу */
}
tr:nth-child(even) td {
  background: #fafbfc;                /* Чередование строк */
}
tr:hover td {
  background: #eef5ff;                /* Подсветка строки при наведении */
  transition: background .1s;
}
td button {
  padding: 3px 13px;
  border-radius: 7px;
  background: var(--blue);            /* Синяя кнопка внутри таблицы */
  color: #fff;
  border: none;
  font-size: 1em;
  cursor: pointer;
  transition: background .14s;
}
td button:hover {
  background: #0955b3;                /* Тёмно-синий при наведении */
}

/* === Точка для статуса онлайн/оффлайн === */
.status-dot {
  display: inline-block;
  width: 12px;                        /* Диаметр точки */
  height: 12px;
  border-radius: 50%;                 /* Круг */
  margin-right: 7px;
  vertical-align: middle;
  background: #aaa;                   /* Базово — серая */
  border: 1.5px solid #fff;           /* Белая тонкая окантовка */
  box-shadow: 0 0 0 1.5px #cfc;       /* Светло-зелёный ободок */
}
.status-dot.online { background: #0c4 !important; }  /* Зелёная точка (онлайн) */
.status-dot.offline { background: #aaa !important; } /* Серая точка (оффлайн) */

/* === Кнопки (унифицированно) === */
button, .btn {
  background: var(--blue);            /* Синий фон */
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 10px 20px;
  font-size: 1.08em;
  cursor: pointer;
  box-shadow: 0 2px 8px #1677ff22;
  transition: background .16s;
  margin: 7px 0 3px 0;
}
button:hover, .btn:hover {
  background: #0955b3;                /* Тёмно-синий при наведении */
}
.btn-grey, .back-btn {
  background: #eee !important;         /* Серый фон для второстепенных кнопок */
  color: #444 !important;
  box-shadow: none !important;
}
.btn-small {
  padding: 4px 10px;
  font-size: 0.9em;
  margin: 0;
}

/* === Оформление форм (инпуты, селекты, textarea) === */
input, select, textarea {
  font-size: 1em;
  border: 1.1px solid #dbeafe;
  margin: 0.4em 0 0.4em 0;
  width: 100%;                        /* Растягиваются на всю ширину */
  padding: 0.7em 0.9em;
  border-radius: 8px;
  background: #fafdff;
  transition: border .13s;
}
input:focus, select:focus, textarea:focus {
  border: 1.5px solid var(--blue);    /* Синяя рамка при фокусе */
  outline: none;
  background: #e8f0fe;                /* Светлый фон при фокусе */
}
label { font-size: 1em; color: #3a3a55; }

/* === Общий стиль карточек: устройства, форма, логи === */
.device-card, .form-card, .log-card {
  max-width: 100%;                    /* Максимальная ширина карточки */
  margin: 20px;                       /* Отступы */
  border-radius: var(--card-radius);
  background: var(--card-bg);
  box-shadow: var(--shadow);
  padding: 28px 28px 22px 28px;       /* Исходные внутренние отступы */
  border: 1px solid #ececec;
}

/* === Специальные стили для карточки устройства (компактные) === */
.device-card {
  padding: 20px 24px 18px 24px;       /* Уменьшенные внутренние отступы только для карточки устройства */
}

/* === Двухколоночная структура карточки устройства === */
.device-card-layout {
  display: flex;
  gap: 30px;                          /* Расстояние между колонками */
  align-items: flex-start;            /* Выравнивание по верху */
}

.device-info-column {
  flex: 1;                            /* Левая колонка занимает доступное пространство */
  min-width: 0;                       /* Позволяет колонке сжиматься */
}

.device-structure-column {
  flex: 1;                            /* Правая колонка занимает доступное пространство */
  min-width: 0;                       /* Позволяет колонке сжиматься */
}



/* === Верхний блок карточки устройства === */
.device-card .header-row {
  display: flex;
  justify-content: space-between;     /* Края разнесены */
  align-items: flex-end;
  margin-bottom: 4px;                 /* Уменьшенный отступ снизу */
}
.device-card .dev-type {
  font-weight: 700;
  font-size: 1.25em;
  letter-spacing: 0.02em;
}
.device-card .right-head {
  text-align: right;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}
.device-card .id-label {
  font-weight: 600;
  font-size: 1.04em;
  letter-spacing: 0.04em;
}
.device-card .status-spot {
  display: flex;
  align-items: center;
  margin-top: 4px;
  margin-bottom: 2px;
  font-size: 1.03em;
}
.device-card .status-dot {
  width: 14px;
  height: 14px;
  margin-right: 8px;
}

/* === Таблица параметров устройства (grid-сетка) === */
.device-card-grid {
  display: grid;
  grid-template-columns: max-content 1fr; /* Левая колонка — по содержимому, правая — всё остальное */
  gap: 6px 16px;                     /* Уменьшенные отступы между строками и колонками */
  align-items: center;               /* Вертикальное выравнивание */
  margin-bottom: 12px;               /* Уменьшенный отступ снизу */
  font-size: 1.0em;                  /* Уменьшенный размер шрифта */
  padding-left: 2px;
}
.device-card-grid .label {
  font-weight: bold;
  color: #1a1a1a;
  text-align: left;
  justify-self: end;                 /* Подписи справа отступают */
}
.device-card-grid .value {
  color: #222;
  font-family: inherit;
  font-size: 1em;
  margin-left: 0;
  text-align: left;
  word-break: break-all;
  justify-self: start;               /* Значения слева */
}

/* === Заголовки секций в карточке === */
.device-card .section-title {
  font-size: 1.05em;                  /* Уменьшенный размер шрифта */
  color: var(--blue);
  margin-top: 16px;                   /* Уменьшенный отступ сверху */
  margin-bottom: 5px;                 /* Уменьшенный отступ снизу */
  font-weight: bold;
}

/* === Описание (note) в карточке === */
.device-card .desc-box {
  background: var(--light-blue);
  border-radius: 8px;
  padding: 8px 12px;                  /* Уменьшенные отступы */
  color: #555;
  font-size: 1.0em;                   /* Уменьшенный размер шрифта */
  margin-bottom: 8px;                 /* Уменьшенный отступ снизу */
  text-align: left;
}

/* === Логи устройства в карточке === */
.device-card .logs-box {
  background: #f7f7fa;
  border-radius: 8px;
  padding: 8px 10px;                  /* Уменьшенные отступы */
  min-height: 36px;                   /* Уменьшенная минимальная высота */
  color: #444;
  font-family: monospace;
  font-size: 0.95em;                  /* Уменьшенный размер шрифта */
  max-height: 100px;                  /* Уменьшенная максимальная высота */
  overflow-y: auto;
  margin-bottom: 6px;                 /* Уменьшенный отступ снизу */
  text-align: left;
}

/* === Кнопки управления внизу карточки устройства === */
.device-card .actions {
  display: flex;
  gap: 14px;                         /* Уменьшенное расстояние между кнопками */
  margin-top: 18px;                  /* Уменьшенный отступ сверху */
}
.device-card .actions button {
  flex: 1 1 0px;                     /* Кнопки равной ширины */
}
.device-card .back-btn {
  margin-top: 20px;                  /* Уменьшенный отступ сверху */
  width: 100%;
}

#page {
  max-width: 100%;
  width: 100%;
  margin: 0;
  background: none;
  padding: 0;
}

.log-row {
  display: flex;
  align-items: flex-start;
  width: 95%;
  max-width: 1400px;
  margin-left: 2em;
  margin-bottom: 2em;
}

.log-area {
  background: #111;
  color: #32ff32;
  font-family: monospace;
  font-size: 0.96em;
  padding: 1em;
  border-radius: 8px;
  box-shadow: 0 2px 8px #aaa;
  height: 340px;
  overflow-y: auto;
  white-space: pre-wrap;
  flex: 1 1 auto;
  min-width: 320px;
  margin-right: 1.5em; /* расстояние между логом и кнопкой */
}

.log-side-panel {
  display: flex;
  flex-direction: column;
  gap: 1em;
  align-items: flex-end;
  min-width: 170px;
  margin-top: 0.5em;
}


/* === Красный для ошибок (например, не загрузились данные) === */
.err {
  color: #b00;
}

/* === Стили для фильтров и поиска устройств === */
.device-filters {
  background: var(--light-blue);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 25px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  width: 100%;
  box-sizing: border-box;
}

.filter-row {
  display: flex;
  gap: 20px;
  margin-bottom: 15px;
  flex-wrap: wrap;
}

.status-filter, .search-filter {
  flex: 1;
  min-width: 200px;
}

.status-filter label, .search-filter label {
  display: block;
  font-weight: bold;
  color: #333;
  margin-bottom: 8px;
  font-size: 0.95em;
}

.status-filter select, .search-filter input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #dbeafe;
  border-radius: 8px;
  background: #fff;
  font-size: 1em;
  transition: border-color 0.2s;
}

.status-filter select:focus, .search-filter input:focus {
  border-color: var(--blue);
  outline: none;
  box-shadow: 0 0 0 2px rgba(22, 119, 255, 0.1);
}

.device-stats {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
  padding-top: 15px;
  border-top: 1px solid #e3e7ed;
}

.device-stats span {
  background: #fff;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 0.9em;
  font-weight: bold;
  color: #555;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

/* === Таблица устройств === */
.devices-container {
  margin-top: 20px;
}

.devices-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--card-bg);
  border-radius: var(--card-radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  margin-bottom: 20px;
}

.devices-table thead {
  background: var(--light-blue);
}

.devices-table th {
  padding: 15px 12px;
  text-align: left;
  font-weight: bold;
  color: #1451b3;
  border-bottom: 2px solid #e3e7ed;
  font-size: 1.05em;
  position: relative;
}

.devices-table th.sortable {
  cursor: pointer;
  user-select: none;
  transition: background-color 0.2s ease;
}

.devices-table th.sortable:hover {
  background-color: #e8f0fe;
}

.sort-indicator {
  margin-left: 8px;
  font-size: 0.9em;
  color: #999;
  transition: color 0.2s ease;
}

.sort-indicator.active {
  color: #1451b3;
  font-weight: bold;
}

.devices-table td {
  padding: 12px;
  border-bottom: 1px solid #f0f0f0;
  vertical-align: middle;
}

.device-row {
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.device-row:hover {
  background-color: #f8f9fa;
}

.device-row.online {
  border-left: 4px solid #4CAF50;
}

.device-row.offline {
  border-left: 4px solid #f44336;
  opacity: 0.8;
}

.device-id-cell {
  font-family: monospace;
  font-weight: bold;
  color: #333;
}

.device-id {
  font-size: 1.1em;
}

.status-cell {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: bold;
}

.device-row.online .status-cell {
  color: #4CAF50;
}

.device-row.offline .status-cell {
  color: #f44336;
}

.type-cell, .version-cell {
  color: #555;
}

.last-seen-cell {
  color: #666;
  font-size: 0.95em;
}

.description-cell {
  color: #444;
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* === Стили для таблицы прошивок === */
.firmware-filters {
  background: var(--card-bg);
  border-radius: var(--card-radius);
  padding: 20px;
  margin-bottom: 20px;
  box-shadow: var(--shadow);
}

.firmware-stats {
  display: flex;
  gap: 20px;
  margin-bottom: 20px;
  font-weight: bold;
  color: #555;
}

.firmware-container {
  background: var(--card-bg);
  border-radius: var(--card-radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.firmware-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--card-bg);
}

.firmware-table thead {
  background: var(--light-blue);
}

.firmware-table th {
  padding: 15px 12px;
  text-align: left;
  font-weight: bold;
  color: #1451b3;
  border-bottom: 2px solid #e3e7ed;
  font-size: 1.05em;
  position: relative;
}

.firmware-table th.sortable {
  cursor: pointer;
  user-select: none;
  transition: background-color 0.2s ease;
}

.firmware-table th.sortable:hover {
  background-color: #e8f0fe;
}

.firmware-table td {
  padding: 12px;
  border-bottom: 1px solid #f0f0f0;
  vertical-align: middle;
}

.firmware-row {
  transition: background-color 0.2s ease;
}

.firmware-row:hover {
  background-color: #f8f9fa;
}

.fw-date {
  color: #666;
  font-size: 0.9em;
  white-space: nowrap;
  width: 140px;
}

.fw-device-type {
  color: #555;
  font-weight: 500;
  width: 150px;
}

.fw-version {
  width: 120px;
}

.version-badge {
  background: #e3f2fd;
  color: #1976d2;
  padding: 4px 8px;
  border-radius: 12px;
  font-size: 0.9em;
  font-weight: bold;
}

.fw-chip {
  color: #666;
  font-family: monospace;
  font-size: 0.95em;
  width: 100px;
}

.fw-description {
  color: #444;
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.fw-file {
  text-align: center;
}

.file-link {
  color: #1976d2;
  text-decoration: none;
  font-weight: 500;
}

.file-link:hover {
  text-decoration: underline;
}

.no-file {
  color: #999;
  font-style: italic;
}

.fw-actions {
  text-align: center;
  width: 100px;
}

.btn-icon {
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
  margin: 0 2px;
  border-radius: 4px;
  font-size: 1.1em;
  transition: background-color 0.2s ease;
}

.btn-icon:hover {
  background-color: #f0f0f0;
}

.btn-icon.btn-danger:hover {
  background-color: #ffebee;
}

.no-data {
  text-align: center;
  color: #999;
  font-style: italic;
  padding: 40px;
}

/* === Стили для модального окна === */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
}

.modal-content {
  background: var(--card-bg);
  border-radius: var(--card-radius);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
  width: 90%;
  max-width: 600px;
  max-height: 90vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px;
  border-bottom: 1px solid #e0e0e0;
}

.modal-header h3 {
  margin: 0;
  color: #333;
  font-size: 1.3em;
}

.modal-close {
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: #999;
  padding: 0;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background-color 0.2s ease;
}

.modal-close:hover {
  background-color: #f0f0f0;
  color: #333;
}

.modal-body {
  padding: 24px;
  overflow-y: auto;
  overflow-x: hidden;
  flex: 1;
}

.firmware-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
  box-sizing: border-box;
  align-items: center;
  max-width: 500px;
  margin: 0 auto;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  align-items: center;
}

.form-group label {
  font-weight: 600;
  color: #333;
  font-size: 0.95em;
  text-align: center;
  width: 100%;
}

.form-group input,
.form-group select,
.form-group textarea {
  padding: 12px;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  font-size: 1em;
  transition: border-color 0.2s ease;
  box-sizing: border-box;
  width: 100%;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: #1976d2;
}

.form-group textarea {
  resize: vertical;
  min-height: 80px;
}

.form-hint {
  color: #666;
  font-size: 0.85em;
  margin-top: 4px;
}

/* === Стили для загрузки файлов === */

.file-info {
  margin-top: 12px;
  padding: 12px;
  background: #e8f5e8;
  border-radius: 6px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  box-sizing: border-box;
}

.file-name {
  font-weight: 600;
  color: #2e7d32;
}

.file-size {
  color: #666;
  font-size: 0.9em;
}

/* === Стили для прогресса загрузки === */
.upload-progress {
  margin-top: 16px;
}

.progress-bar {
  width: 100%;
  height: 8px;
  background: #e0e0e0;
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 8px;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #1976d2, #42a5f5);
  width: 0%;
  transition: width 0.3s ease;
}

.progress-text {
  text-align: center;
  font-weight: 600;
  color: #1976d2;
  font-size: 0.9em;
}

/* === Стили для кнопок модального окна === */
.modal-actions {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid #e0e0e0;
}

.btn-loading {
  display: none;
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* === Адаптивность для мобильных устройств === */
@media (max-width: 768px) {
  .modal-content {
    width: 95%;
    margin: 20px;
  }
  
  .modal-header,
  .modal-body {
    padding: 16px;
  }
  
  
  .modal-actions {
    flex-direction: column;
  }
  
  .modal-actions .btn {
    width: 100%;
  }
}

.device-item {
  background: var(--card-bg);
  border-radius: var(--card-radius);
  padding: 20px;
  box-shadow: var(--shadow);
  border: 2px solid transparent;
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
}

.device-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0,0,0,0.15);
  border-color: var(--blue);
}

.device-item.online {
  border-left: 4px solid #4CAF50;
}

.device-item.offline {
  border-left: 4px solid #f44336;
  opacity: 0.8;
}

.device-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
  padding-bottom: 10px;
  border-bottom: 1px solid #f0f0f0;
}

.device-id {
  font-size: 1.2em;
  font-weight: bold;
  color: #333;
  font-family: monospace;
  word-break: break-all;
}

.device-status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9em;
  font-weight: bold;
}

.device-item.online .device-status {
  color: #4CAF50;
}

.device-item.offline .device-status {
  color: #f44336;
}

/* === Таблица информации в карточке устройства === */
.device-info-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 10px;
  background: #f8f9fa;
  border-radius: 6px;
  overflow: hidden;
}

.device-info-table td {
  padding: 8px 12px;
  font-size: 0.9em;
  border-bottom: 1px solid #e9ecef;
}

.device-info-table tr:last-child td {
  border-bottom: none;
}

.info-label {
  font-weight: bold;
  color: #495057;
  width: 120px;
  min-width: 120px;
  background: #e9ecef;
  border-right: 1px solid #dee2e6;
}

.info-value {
  color: #333;
  word-break: break-all;
  background: #fff;
  padding-left: 12px;
}

.no-devices {
  text-align: center;
  padding: 40px 20px;
  color: #666;
  font-size: 1.1em;
  background: #f9f9f9;
  border-radius: 12px;
  border: 2px dashed #ddd;
}

/* === Расширенная карточка устройства === */
.device-card.expanded {
  max-width: 900px !important;        /* Ограничиваем максимальную ширину */
  width: auto !important;             /* Автоматическая ширина */
  margin: 20px auto !important;       /* Центрируем карточку */
  padding: 22px 26px 20px 26px !important;  /* Уменьшенные отступы */
  box-sizing: border-box !important;
  min-width: 600px !important;        /* Уменьшенная минимальная ширина */
}

/* === Компактный заголовок устройства === */
.device-header-compact {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 15px;
  border-bottom: 2px solid #f0f0f0;
}

.device-id-compact h2 {
  margin: 0 0 8px 0;
  font-size: 1.8em;
  color: #333;
  font-family: monospace;
  word-break: break-all;
}

.device-status-compact {
  text-align: right;
}

/* === Таблица информации об устройстве === */
.device-info-table {
  margin-bottom: 25px;
}

.device-table {
  width: 100%;
  border-collapse: collapse;
  background: #f8f9fa;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.device-table tr {
  border-bottom: 1px solid #e9ecef;
}

.device-table tr:last-child {
  border-bottom: none;
}

.device-table td {
  padding: 12px 15px;
  vertical-align: top;
}

.table-label {
  background: #e9ecef;
  font-weight: bold;
  color: #495057;
  width: 140px;
  min-width: 140px;
  border-right: 1px solid #dee2e6;
}

.table-value {
  background: #fff;
  color: #333;
  word-break: break-all;
  border-right: 1px solid #f0f0f0;
}

.table-value.status-value {
  font-weight: bold;
  padding: 4px 8px;
  border-radius: 4px;
  background: #e9ecef;
}

/* === Секция логов === */
.device-logs-section {
  margin-bottom: 25px;
}

.device-logs-section h3 {
  margin: 0 0 10px 0;
  color: var(--blue);
  font-size: 1.1em;
  border-bottom: 1px solid #dee2e6;
  padding-bottom: 5px;
}

.device-title h2 {
  margin: 0 0 10px 0;
  font-size: 2em;
  color: #333;
  font-family: monospace;
  word-break: break-all;
}

.device-type-badge {
  background: var(--blue);
  color: white;
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 0.9em;
  font-weight: bold;
  display: inline-block;
}

.device-status-expanded {
  text-align: right;
}

.status-indicator {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
  font-size: 1.1em;
  font-weight: bold;
}

.status-indicator.online {
  color: #4CAF50;
}

.status-indicator.offline {
  color: #f44336;
}

.last-seen {
  color: #666;
  font-size: 0.9em;
}

.device-info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 30px;
  margin-bottom: 30px;
}

.info-section {
  background: #f8f9fa;
  border-radius: 12px;
  padding: 20px;
  border: 1px solid #e9ecef;
}

.info-section h3 {
  margin: 0 0 15px 0;
  color: var(--blue);
  font-size: 1.2em;
  border-bottom: 1px solid #dee2e6;
  padding-bottom: 8px;
}

.info-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.info-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid #f0f0f0;
}

.info-item:last-child {
  border-bottom: none;
}

.info-label {
  font-weight: bold;
  color: #555;
  min-width: 140px;
}

.info-value {
  color: #333;
  text-align: right;
  word-break: break-all;
  flex: 1;
  margin-left: 15px;
}

.status-value {
  font-weight: bold;
  padding: 4px 8px;
  border-radius: 4px;
  background: #e9ecef;
}

.device-actions {
  display: flex;
  gap: 15px;
  margin: 30px 0;
  flex-wrap: wrap;
}

.device-actions .btn {
  flex: 1;
  min-width: 150px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 20px;
  font-size: 1em;
}

.btn-icon {
  font-size: 1.2em;
}

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

.btn-secondary:hover {
  background: #5a6268;
}

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

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

/* === Стили для кнопок внизу списка устройств === */
.device-actions-bottom {
  display: flex;
  gap: 15px;
  margin-top: 20px;
  flex-wrap: wrap;
}

.device-actions-bottom .btn {
  flex: 1;
  min-width: 150px;
}

/* === Адаптив: сужаем на телефонах === */
@media (max-width: 700px) {
  .device-card, .form-card, .log-card, .center { padding: 10px 3px 12px 3px; }
  .device-card-grid { grid-template-columns: 1fr; }
  .device-card-grid .label { text-align:left; }
  .menu { flex-direction: column; gap: 0.3em; padding-left:0;}
  
  /* === Адаптивные стили для формы входа на мобильных === */
  .center.form-card {
    max-width: 95%;               /* Почти на всю ширину экрана */
    margin: 20px auto;            /* Меньший отступ */
    padding: 1.5em 1em;           /* Компактные отступы */
  }
  
  .center.form-card input,
  .center.form-card button {
    width: calc(100% - 0.2em);    /* Учитываем уменьшенный padding */
    font-size: 16px;              /* Предотвращает зум на iOS */
  }
  
  .version-info-login {
    margin-top: 10px;             /* Меньший отступ на мобильных */
    font-size: 0.8em;             /* Чуть меньше размер шрифта */
    width: calc(100% - 0.4em);    /* Ширина как у других элементов на мобильных, чуть уже */
  }
  table { width: 100%; font-size: 0.99em;}
  th, td { padding: 7px 6px; }
  
  /* Адаптив для новых элементов */
  .filter-row {
    flex-direction: column;
    gap: 15px;
  }
  
  .status-filter, .search-filter {
    min-width: auto;
  }
  
  .devices-table {
    font-size: 0.9em;
  }
  
  .devices-table th,
  .devices-table td {
    padding: 8px 6px;
  }
  
  .description-cell {
    max-width: 100px;
  }
  
  .device-stats {
    flex-direction: column;
    gap: 10px;
  }
  
  .device-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }
  
  .device-info-table {
    font-size: 0.8em;
  }
  
  .device-info-table td {
    padding: 4px 6px;
  }
  
  .info-label {
    width: 80px;
    min-width: 80px;
  }
  
  /* Адаптив для расширенной карточки */
  .device-card.expanded {
    padding: 20px 15px;
    margin: 10px;
  }
  
  .device-header-expanded {
    flex-direction: column;
    align-items: flex-start;
    gap: 15px;
  }
  
  .device-status-expanded {
    text-align: left;
  }
  
  .device-info-grid {
    grid-template-columns: 1fr;
    gap: 20px;
  }
  
  .device-actions {
    flex-direction: column;
  }
  
  .device-actions .btn {
    min-width: auto;
  }
  
  /* Адаптив для компактной карточки устройства */
  .device-header-compact {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }
  
  .device-status-compact {
    text-align: left;
  }
  
  .device-table {
    font-size: 0.9em;
  }
  
  .device-table td {
    padding: 8px 10px;
  }
  
  .table-label {
    width: 120px;
    min-width: 120px;
  }
}

/* === Дополнительные медиа-запросы для больших экранов === */
@media (min-width: 1200px) {
  .devices-grid {
    grid-template-columns: repeat(auto-fill, minmax(420px, 1fr));
  }
  
  .device-card.expanded {
    max-width: 800px;                  /* Фиксированная ширина для больших экранов */
  }
}

@media (min-width: 1600px) {
  .devices-grid {
    grid-template-columns: repeat(auto-fill, minmax(400px, 1fr));
  }
  
  .device-card.expanded {
    max-width: 750px;                  /* Еще более компактная ширина для очень больших экранов */
  }
  
  .device-info-grid {
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  }
}

/* === Стили для личного кабинета пользователя === */

.user-dashboard {
  padding: 20px;
  max-width: 1200px;
  margin: 0 auto;
}

.user-dashboard h2 {
  color: var(--blue);
  margin-bottom: 20px;
  font-size: 1.8em;
}

.dashboard-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 15px;
  margin-bottom: 25px;
  flex-wrap: wrap;
}

.controls-left {
  display: flex;
  gap: 10px;
}

.view-toggle {
  display: flex;
  gap: 5px;
  background: #f8f9fa;
  border-radius: 8px;
  padding: 4px;
}

.view-btn {
  background: transparent;
  border: none;
  padding: 8px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 16px;
  transition: all 0.2s;
  color: #666;
}

.view-btn:hover {
  background: #e9ecef;
  color: #333;
}

.view-btn.active {
  background: #007bff;
  color: white;
}

/* Стили для режима списка */
.devices-list {
  margin-top: 20px;
}

.devices-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--card-bg);
  border-radius: var(--card-radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.devices-table th {
  background: #f8f9fa;
  padding: 15px 12px;
  text-align: left;
  font-weight: 600;
  color: #555;
  border-bottom: 2px solid #e9ecef;
}

.devices-table td {
  padding: 12px;
  border-bottom: 1px solid #e9ecef;
  vertical-align: middle;
}

.devices-table tbody tr:hover {
  background: #f8f9fa;
}

.devices-table tbody tr:last-child td {
  border-bottom: none;
}

.devices-table .btn-edit,
.devices-table .btn-remove {
  margin: 0 2px;
  padding: 6px 8px;
  font-size: 14px;
}

.btn-add-device {
  background: var(--blue);
  color: white;
  border: none;
  padding: 12px 20px;
  border-radius: 8px;
  font-size: 1em;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-add-device:hover {
  background: #0056b3;
}

.btn-refresh {
  background: #28a745;
  color: white;
  border: none;
  padding: 12px 20px;
  border-radius: 8px;
  font-size: 1em;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-refresh:hover {
  background: #218838;
}


.user-devices-list {
  min-height: 200px;
}

.no-devices {
  text-align: center;
  padding: 60px 20px;
  color: #666;
  background: var(--card-bg);
  border-radius: var(--card-radius);
  box-shadow: var(--shadow);
}

.no-devices p {
  margin: 10px 0;
  font-size: 1.1em;
}

.devices-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(400px, 1fr));
  gap: 20px;
  margin-top: 20px;
}

.device-card {
  background: var(--card-bg);
  border-radius: var(--card-radius);
  box-shadow: var(--shadow);
  padding: 20px;
  transition: transform 0.2s, box-shadow 0.2s;
}

.device-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 30px rgba(0, 0, 0, 0.15);
}

.device-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 15px;
  padding-bottom: 15px;
  border-bottom: 1px solid #eee;
}

.device-header h3 {
  margin: 0;
  color: var(--blue);
  font-size: 1.3em;
  flex: 1;
  word-break: break-word;
}

.device-actions {
  display: flex;
  gap: 8px;
  margin-left: 10px;
}

.btn-edit, .btn-remove, .btn-refresh-uptime {
  background: none;
  border: none;
  padding: 6px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 1.1em;
  transition: background 0.2s;
}

.btn-edit:hover {
  background: #e3f2fd;
}

.btn-remove:hover {
  background: #ffebee;
}

.btn-refresh-uptime:hover {
  background: #e8f5e8;
}

.btn-refresh-uptime:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.device-info {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.info-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 5px 0;
}

.info-row .label {
  font-weight: 600;
  color: #555;
  min-width: 160px;
}

.info-row .value {
  color: #333;
  text-align: right;
  word-break: keep-all;
  white-space: nowrap;
  flex: 1;
  margin-left: 10px;
  min-width: 0;
}

.loading, .error {
  text-align: center;
  padding: 40px 20px;
  color: #666;
  background: var(--card-bg);
  border-radius: var(--card-radius);
  box-shadow: var(--shadow);
}

.error {
  color: #dc3545;
  background: #fff5f5;
}

/* === Стили для модального окна добавления устройства === */

.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
}

.modal-content {
  background: var(--card-bg);
  border-radius: var(--card-radius);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
  max-width: 500px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 25px;
  border-bottom: 1px solid #eee;
}

.modal-header h3 {
  margin: 0;
  color: var(--blue);
  font-size: 1.4em;
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.5em;
  cursor: pointer;
  color: #999;
  padding: 0;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background 0.2s;
}

.modal-close:hover {
  background: #f5f5f5;
  color: #333;
}

.modal-body {
  padding: 25px;
}

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
  color: #333;
}

.form-group input {
  width: 100%;
  padding: 12px 15px;
  border: 2px solid #e1e5e9;
  border-radius: 8px;
  font-size: 1em;
  transition: border-color 0.2s;
  box-sizing: border-box;
}

.form-group input:focus {
  outline: none;
  border-color: var(--blue);
}

.form-group small {
  display: block;
  margin-top: 5px;
  color: #666;
  font-size: 0.9em;
}

.form-actions {
  display: flex;
  gap: 15px;
  justify-content: flex-end;
  margin-top: 25px;
  padding-top: 20px;
  border-top: 1px solid #eee;
}

.btn-cancel {
  background: #6c757d;
  color: white;
  border: none;
  padding: 12px 20px;
  border-radius: 8px;
  font-size: 1em;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-cancel:hover {
  background: #5a6268;
}

.btn-submit {
  background: var(--blue);
  color: white;
  border: none;
  padding: 12px 20px;
  border-radius: 8px;
  font-size: 1em;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-submit:hover {
  background: #0056b3;
}

/* === Адаптивные стили для личного кабинета === */

@media (max-width: 768px) {
  .user-dashboard {
    padding: 15px;
  }
  
  .dashboard-controls {
    flex-direction: column;
    align-items: stretch;
  }
  
  .controls-left {
    justify-content: center;
  }
  
  .view-toggle {
    justify-content: center;
    margin-top: 10px;
  }
  
  .btn-add-device, .btn-refresh {
    width: 100%;
    text-align: center;
  }
  
  .devices-grid {
    grid-template-columns: 1fr;
    gap: 15px;
  }
  
  /* Адаптивная таблица для мобильных */
  .devices-table {
    font-size: 14px;
  }
  
  .devices-table th,
  .devices-table td {
    padding: 8px 6px;
  }
  
  .devices-table th:nth-child(3),
  .devices-table td:nth-child(3),
  .devices-table th:nth-child(4),
  .devices-table td:nth-child(4),
  .devices-table th:nth-child(5),
  .devices-table td:nth-child(5) {
    display: none;
  }
  
  .device-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }
  
  .device-actions {
    margin-left: 0;
    align-self: flex-end;
  }
  
  .info-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 5px;
  }
  
  .info-row .label {
    min-width: auto;
  }
  
  .info-row .value {
    text-align: left;
    margin-left: 0;
  }
  
  .modal-content {
    width: 95%;
    margin: 20px;
  }
  
  .form-actions {
    flex-direction: column;
  }
  
  .btn-cancel, .btn-submit {
    width: 100%;
  }
}

/* === Стили для синхронизации файлов === */
.file-sync-toggle {
  display: flex;
  align-items: center;
  gap: 12px;
}

.toggle-switch {
  position: relative;
  display: inline-block;
  width: 50px;
  height: 24px;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #ccc;
  transition: 0.3s;
  border-radius: 24px;
}

.toggle-slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: 0.3s;
  border-radius: 50%;
}

.toggle-switch input:checked + .toggle-slider {
  background-color: var(--blue);
}

.toggle-switch input:checked + .toggle-slider:before {
  transform: translateX(26px);
}

.toggle-switch input:disabled + .toggle-slider {
  opacity: 0.5;
  cursor: not-allowed;
}

.file-sync-status {
  font-size: 0.9em;
  font-weight: 500;
  padding: 4px 8px;
  border-radius: 4px;
}

.file-sync-status.enabled {
  color: #28a745;
  background-color: #d4edda;
}

.file-sync-status.disabled {
  color: #6c757d;
  background-color: #e2e3e5;
}

.file-sync-status.saving {
  color: #ffc107;
  background-color: #fff3cd;
}

.file-sync-status.error {
  color: #dc3545;
  background-color: #f8d7da;
}

.files-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background-color: var(--light-blue);
  border-radius: 8px;
  margin-bottom: 12px;
}

.files-title {
  font-weight: 600;
  color: #333;
}
