* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Arial', sans-serif;
    background-color: #f5f5f5;
    color: #333;
    line-height: 1.6;
}

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

h1 {
    color: #5d4037;
    margin-bottom: 20px;
    text-align: center;
}

/* Кнопки */
.btn-add,
.btn-save,
.btn-cancel,
.btn-edit,
.btn-delete {
    display: inline-block;
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    text-decoration: none;
}

.btn-add,
.btn-save {
    background-color: #795548;
    color: #fff;
}

.btn-add:hover,
.btn-save:hover {
    background-color: #6d4c41;
}

.btn-cancel {
    background-color: #9e9e9e;
    color: #fff;
}

.btn-cancel:hover {
    background-color: #757575;
}

.btn-edit,
.btn-delete {
    padding: 6px 12px;
    font-size: 12px;
}

.btn-edit {
    background-color: #8d6e63;
    color: #fff;
}

.btn-edit:hover {
    background-color: #7a5c52;
}

.btn-delete {
    background-color: #d84315;
    color: #fff;
}

.btn-delete:hover {
    background-color: #bf360c;
}

.btn-edit:disabled,
.btn-delete:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background-color: #9e9e9e;
}

.btn-edit:disabled:hover,
.btn-delete:disabled:hover {
    background-color: #9e9e9e;
}

/* Таблицы */
.doctors-table {
    width: 100%;
    border-collapse: collapse;
    background-color: #fff;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.doctors-table th,
.doctors-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

.doctors-table th {
    background-color: #757575;
    color: #fff;
    font-weight: bold;
}

.doctors-table tr:hover {
    background-color: #f9f9f9;
}

.actions {
    display: flex;
    gap: 10px;
}

/* Модальное окно */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
}

.modal-content {
    background-color: #fefefe;
    margin: 5% auto;
    padding: 30px;
    border-radius: 8px;
    width: 90%;
    max-width: 500px;
    position: relative;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.close {
    position: absolute;
    right: 15px;
    top: 15px;
    font-size: 24px;
    cursor: pointer;
    color: #666;
}

.close:hover {
    color: #333;
}

/* Стили для JSON модалки */
.modal-content.json-modal {
    max-width: 900px;
    max-height: 80vh;
    overflow-y: auto;
}

.json-display {
    background-color: #f5f5f5;
    padding: 15px;
    border-radius: 4px;
    max-height: 60vh;
    overflow-y: auto;
    font-family: monospace;
    font-size: 14px;
    white-space: pre-wrap;
    word-break: break-all;
}

.modal-actions {
    margin-top: 15px;
    text-align: right;
}

.copy-btn {
    background-color: #795548;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
}

.copy-btn:hover {
    background-color: #6d4c41;
}

.copy-success {
    color: #4CAF50;
    margin-left: 10px;
    display: none;
}

/* Формы */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
    color: #5d4037;
}

.form-group input[type="text"] {
    width: 100%;
    padding: 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 14px;
}

.form-group input[type="checkbox"] {
    margin-right: 8px;
}

.form-buttons {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 25px;
}

/* Боковое меню */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    background-color: #3e2723;
    color: #fff;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    padding-top: 10px;
    z-index: 900;
    transition: width 0.2s ease;
}

.sidebar-collapsed {
    width: 60px;
}

.sidebar-expanded {
    width: 300px; /* увеличено с 280px до 300px */
}

.sidebar-toggle {
    cursor: pointer;
    padding: 10px;
    text-align: left;
    font-size: 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
}

.sidebar-toggle-icon {
    display: inline-block;
    width: 32px;
    text-align: center;
}

.sidebar-toggle-text {
    white-space: nowrap;
}

.sidebar-collapsed .sidebar-toggle-text {
    display: none;
}

.sidebar-expanded .sidebar-toggle-text {
    display: inline-block;
    margin-left: 4px;
}

.sidebar-link {
    display: flex;
    align-items: center;
    padding: 10px 12px; /* базовые отступы, будут переопределены для расширенного */
    text-decoration: none;
    color: #fff;
    font-size: 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    white-space: nowrap;
    overflow: hidden;
}

/* В расширенном состоянии уменьшаем отступы для экономии места */
.sidebar-expanded .sidebar-link {
    padding-left: 8px;
    padding-right: 15px; /* воздух справа, но теперь меньше */
}

.sidebar-link:hover {
    background-color: #4e342e;
}

.sidebar-icon {
    width: 32px;
    height: 32px;
    border-radius: 4px;
    background-color: #5d4037;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 10px;
    font-weight: bold;
    font-size: 14px;
    flex-shrink: 0;
}

.sidebar-text {
    white-space: nowrap;
    opacity: 0;
    width: 0;
    overflow: hidden;
    transition: opacity 0.15s ease;
}

.sidebar.sidebar-expanded .sidebar-text {
    opacity: 1;
    width: auto;
    margin-left: 4px;
    overflow: visible;
}

/* Область контента справа от меню */
.content-wrapper {
    margin-left: 60px;
    padding: 20px;
    transition: margin-left 0.2s ease;
}

/* Информация о пользователе в сайдбаре */
.user-info {
    margin-top: auto;
    padding: 15px 10px;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    color: #fff;
    font-size: 12px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-expanded .user-info {
    padding-right: 15px; /* синхронизируем с отступами ссылок */
}

/* Скрываем в свернутом состоянии */
.sidebar.sidebar-collapsed .user-info,
.sidebar.sidebar-collapsed .impersonation-banner {
    display: none !important;
}

/* Показываем в развернутом */
.sidebar.sidebar-expanded .user-info {
    display: block;
}

.sidebar.sidebar-expanded .impersonation-banner {
    display: block;
    background-color: #ff9800;
    color: #fff;
    padding: 8px 15px 8px 8px; /* уменьшен правый отступ */
    text-align: center;
    margin: 5px 0;
    border-radius: 4px;
    white-space: normal;
}

.impersonation-banner button {
    background: #fff;
    color: #ff9800;
    border: none;
    padding: 2px 8px;
    border-radius: 4px;
    cursor: pointer;
}

.user-info-name {
    font-weight: bold;
    margin-bottom: 5px;
}

.user-info-roles {
    font-style: italic;
    opacity: 0.9;
}

.user-info-impersonate {
    margin-top: 5px;
    color: #ffb74d;
}

/* Стили для таблицы API логов */
.clickable-row {
    cursor: pointer;
}

.clickable-row:hover {
    background-color: #f0f0f0 !important;
}

.response-error {
    background-color: #ffebee !important;
}

.response-success {
    background-color: #e8f5e9 !important;
}

.token-display {
    font-family: monospace;
    font-size: 12px;
}

.request-params {
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Фильтры и пагинация */
.filters-compact {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.filters-compact label {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.9em;
}

.filters-compact select {
    padding: 4px 8px;
    font-size: 0.9em;
}

.filter-group {
    display: flex;
    flex-direction: column;
}

.filter-group label {
    margin-bottom: 5px;
    font-weight: bold;
    color: #5d4037;
}

.filter-group select {
    padding: 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 14px;
}

.filter-buttons {
    grid-column: 1 / -1;
    display: flex;
    gap: 10px;
    align-items: center;
}

.endpoint-example {
    font-size: 0.85em;
    color: #666;
    margin-top: 3px;
    font-style: italic;
}

.pagination {
    margin-top: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.pagination a {
    padding: 5px 10px;
    background-color: #f0f0f0;
    border: 1px solid #ddd;
    text-decoration: none;
    color: #333;
}

.pagination a:hover {
    background-color: #e0e0e0;
}

.pagination .current {
    padding: 5px 10px;
    background-color: #795548;
    color: white;
    border: 1px solid #6d4c41;
}

.export-btn {
    background-color: #795548;
    color: white;
    padding: 8px 15px;
    text-decoration: none;
    border-radius: 4px;
    display: inline-block;
    margin-left: auto;
}

.export-btn:hover {
    background-color: #6d4c41;
}

.export-container {
    display: flex;
    justify-content: flex-end;
    margin-top: 20px;
    margin-bottom: 10px;
}

/* Дополнительные утилиты */
.platform-info {
    font-size: 0.85em;
    color: #666;
    margin-top: 3px;
    font-style: italic;
}

/* Вертикальные границы для таблиц */
.doctors-table th,
.doctors-table td {
    border-right: 1px solid #d0d0d0; /* очень светлая линия */
}

.doctors-table th:last-child,
.doctors-table td:last-child {
    border-right: none; /* у последней колонки границу убираем */
}

/* Принудительно делаем эмодзи в иконках белыми */
.sidebar-icon span {
    filter: brightness(0) invert(1);
}
