/* Базовые стили */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background-color: #f5f5f5;
    color: #333;
    line-height: 1.6;
}

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

/* ==================== Общая шапка приложения ==================== */
.app-header {
    background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
    color: white;
    padding: 16px 24px;
    border-radius: 8px;
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 30px;
    flex-wrap: wrap;
}

.header-title {
    font-size: 22px;
    font-weight: 600;
    margin: 0;
    white-space: nowrap;
}

.header-nav {
    display: flex;
    gap: 8px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    color: rgba(255, 255, 255, 0.85);
    text-decoration: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
    background: rgba(255, 255, 255, 0.05);
}

.nav-link:hover {
    background: rgba(255, 255, 255, 0.15);
    color: white;
}

.nav-link.active {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

.nav-icon {
    font-size: 16px;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 6px;
}

.user-icon {
    font-size: 18px;
}

.user-name {
    font-size: 14px;
    font-weight: 500;
}

.user-role {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.15);
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.user-role.role-admin {
    background: rgba(231, 76, 60, 0.3);
    color: #ffd3ce;
}

.user-role.role-operator {
    background: rgba(52, 152, 219, 0.3);
    color: #cce5ff;
}

.user-role.role-viewer {
    background: rgba(39, 174, 96, 0.3);
    color: #c8f7d6;
}

.logout-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: rgba(231, 76, 60, 0.15);
    color: #ff8a80;
    border: 1px solid rgba(231, 76, 60, 0.3);
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.logout-btn:hover:not(:disabled) {
    background: rgba(231, 76, 60, 0.3);
    color: white;
    border-color: rgba(231, 76, 60, 0.5);
}

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

.logout-icon {
    font-size: 16px;
}

/* Адаптивность шапки */
@media (max-width: 768px) {
    .app-header {
        flex-direction: column;
        align-items: stretch;
        padding: 16px;
    }
    
    .header-left {
        flex-direction: column;
        align-items: center;
        gap: 12px;
    }
    
    .header-nav {
        width: 100%;
        justify-content: center;
    }
    
    .header-right {
        flex-direction: column;
        gap: 12px;
    }
    
    .user-info {
        justify-content: center;
    }
    
    .logout-btn {
        width: 100%;
        justify-content: center;
    }
}

/* Старый стиль header (для обратной совместимости, если где-то используется) */
header:not(.app-header) {
    background-color: #2c3e50;
    color: white;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
}

header:not(.app-header) h1 {
    font-size: 24px;
    font-weight: 600;
}

/* Элементы управления */
.controls {
    background-color: white;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    align-items: flex-end;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.control-group label {
    font-size: 14px;
    font-weight: 500;
    color: #555;
}

.control-group select,
.control-group input {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    min-width: 200px;
}

.control-group select:focus,
.control-group input:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.2);
}

#load-timeline-btn {
    padding: 8px 20px;
    background-color: #3498db;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s;
}

#load-timeline-btn:hover {
    background-color: #2980b9;
}

#load-timeline-btn:active {
    background-color: #21618c;
}

.btn-primary {
    padding: 8px 20px;
    background-color: #3498db;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s;
}

.btn-primary:hover:not(:disabled) {
    background-color: #2980b9;
}

.btn-primary:disabled {
    background-color: #95a5a6;
    cursor: not-allowed;
}

.btn-secondary {
    padding: 8px 20px;
    background-color: #95a5a6;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s;
}

.btn-secondary:hover {
    background-color: #7f8c8d;
}

/* Основной контейнер контента */
.main-content {
    display: flex;
    flex-direction: row;
    gap: 20px;
    margin-bottom: 20px;
    align-items: flex-start;
    width: 100%;
    overflow: hidden;
}

/* Секция видео (видео + таймлайн) */
.video-section {
    display: flex;
    flex-direction: column;
    gap: 15px;
    flex: 1;
    min-width: 0;
    max-width: calc(100% - 370px); /* Оставляем место для events-section (350px + gap 20px) */
}

/* Видео контейнер */
.video-container {
    width: 100%;
    max-width: 100%;
    background-color: #000;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    position: relative;
    aspect-ratio: 16/9; /* Сохранить пропорции */
    flex-shrink: 0; /* Не сжимать видео */
}

#video-player-1,
#video-player-2 {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: contain; /* Сохранить пропорции видео */
}

/* Контейнер таймлайна (горизонтальный) */
.timeline-container {
    background-color: white;
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    height: 200px; /* Фиксированная высота для горизонтального таймлайна */
    overflow-x: auto;
    overflow-y: hidden;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

/* Canvas таймлайн (горизонтальный) */
.timeline-canvas {
    display: block;
    width: 100%;
    height: 100%;
    min-height: 170px;
    cursor: pointer;
    background-color: #f8f9fa;
    flex-shrink: 0;
}

/* Секция кнопки записи аномалии */
.event-button-section {
    display: flex;
    justify-content: center;
    padding: 15px;
    flex-shrink: 0;
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    margin-bottom: 15px;
}

/* Секция событий (справа) */
.events-section {
    flex: 0 0 350px; /* Фиксированная ширина */
    display: flex;
    flex-direction: column;
    min-width: 350px;
    max-width: 350px;
    align-self: stretch;
}

/* Статус */
.status {
    padding: 10px 15px;
    border-radius: 4px;
    font-size: 14px;
    margin-top: 10px;
}

.status.info {
    background-color: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

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

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

/* Адаптивность */
@media (max-width: 768px) {
    .controls {
        flex-direction: column;
        align-items: stretch;
    }
    
    .control-group select,
    .control-group input {
        width: 100%;
    }
    
    .main-content {
        flex-direction: column;
    }
    
    .events-section {
        flex: 1 1 auto;
        min-width: 100%;
        max-width: 100%;
    }
    
    .events-list-container {
        height: auto;
        max-height: 500px;
    }
    
    .timeline-container {
        height: 150px;
    }
    
    .video-container {
        aspect-ratio: 16/9;
    }
}

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

.modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content {
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    animation: slideIn 0.2s;
}

@keyframes slideIn {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

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

.modal-header h2 {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
}

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

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

.modal-body {
    padding: 20px;
}

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

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

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    font-family: inherit;
    box-sizing: border-box;
}

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

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

/* Контейнер для скриншота */
.screenshot-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: center;
    padding: 10px;
    background-color: #f8f9fa;
    border-radius: 4px;
    border: 1px solid #ddd;
}

.screenshot-group {
    margin-top: 15px;
}

.screenshot-canvas {
    width: 100%;
    max-width: 100%;
    max-height: 75vh;
    min-height: 500px;
    height: auto;
    border: 2px solid #ddd;
    border-radius: 8px;
    cursor: crosshair;
    background-color: #000;
    display: block;
    object-fit: contain;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transition: border-color 0.2s, box-shadow 0.2s;
    margin: 0 auto;
}

.screenshot-canvas:hover {
    border-color: #3498db;
    box-shadow: 0 4px 16px rgba(52, 152, 219, 0.2);
}

.screenshot-canvas.drawing {
    border-color: #2980b9;
    box-shadow: 0 0 0 4px rgba(41, 128, 185, 0.3);
}

.screenshot-controls {
    display: flex;
    gap: 10px;
    margin-top: 10px;
    justify-content: center;
    flex-wrap: wrap;
}

.screenshot-controls button {
    padding: 8px 16px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: white;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
}

.screenshot-controls button:hover {
    background: #f8f9fa;
    border-color: #3498db;
    color: #3498db;
}

.screenshot-canvas.drawing {
    cursor: crosshair;
}

.screenshot-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
}

/* Большое модальное окно для выделения рамки */
.bbox-modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.95);
    animation: fadeIn 0.2s;
}

.bbox-modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
}

.bbox-modal-content {
    width: 95%;
    height: 95%;
    max-width: 95vw;
    max-height: 95vh;
    background-color: #1a1a1a;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    overflow: hidden;
}

.bbox-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 30px;
    background-color: #2c3e50;
    color: white;
    border-bottom: 2px solid #34495e;
    flex-shrink: 0;
}

.bbox-modal-header h2 {
    margin: 0;
    font-size: 24px;
    font-weight: 600;
}

.bbox-modal-close {
    background: none;
    border: none;
    color: white;
    font-size: 32px;
    cursor: pointer;
    padding: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.bbox-modal-close:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.bbox-modal-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 20px;
    overflow: hidden;
    min-height: 0;
}

.bbox-canvas {
    flex: 1;
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
    border: 3px solid #444;
    border-radius: 8px;
    cursor: crosshair;
    background-color: #000;
    display: block;
    object-fit: contain;
    margin: 0 auto;
    min-height: 0;
}

.bbox-canvas:hover {
    border-color: #3498db;
}

.bbox-canvas.drawing {
    border-color: #2980b9;
    box-shadow: 0 0 0 4px rgba(41, 128, 185, 0.3);
}

.bbox-controls {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-top: 20px;
    flex-shrink: 0;
    padding: 15px;
    background-color: #2c3e50;
    border-radius: 8px;
}

.bbox-controls button {
    padding: 12px 24px;
    border: 2px solid #34495e;
    border-radius: 6px;
    background: #34495e;
    color: white;
    cursor: pointer;
    font-size: 16px;
    font-weight: 500;
    transition: all 0.2s;
    min-width: 150px;
}

.bbox-controls .btn-secondary {
    background: #34495e;
    border-color: #34495e;
}

.bbox-controls .btn-secondary:hover {
    background: #3d566b;
    border-color: #3498db;
}

.bbox-controls .btn-primary {
    background: #3498db;
    border-color: #3498db;
}

.bbox-controls .btn-primary:hover {
    background: #2980b9;
    border-color: #2980b9;
}

.bbox-hint {
    text-align: center;
    color: #bbb;
    font-size: 14px;
    margin-top: 10px;
    flex-shrink: 0;
}

/* Превью скриншота в форме события */
.screenshot-preview-group {
    margin-top: 15px;
}

.screenshot-preview-container {
    position: relative;
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
    border: 2px solid #ddd;
    border-radius: 8px;
    overflow: hidden;
    background-color: #000;
    min-height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.screenshot-preview {
    max-width: 100%;
    max-height: 400px;
    width: auto;
    height: auto;
    display: block;
    object-fit: contain;
}

.screenshot-preview-info {
    position: absolute;
    top: 10px;
    left: 10px;
    background-color: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 12px;
    display: none;
}

.screenshot-preview-info.show {
    display: block;
}

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

/* Список событий */
.events-list-container {
    background-color: white;
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
}

.events-list-container h3 {
    margin: 0 0 15px 0;
    font-size: 18px;
    font-weight: 600;
    color: #2c3e50;
}

.events-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.events-empty {
    text-align: center;
    color: #999;
    padding: 20px;
    font-style: italic;
}

.event-item {
    padding: 12px;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    background-color: #fafafa;
    transition: background-color 0.2s, border-color 0.2s;
    cursor: pointer;
}

.event-item:hover {
    background-color: #f0f0f0;
    border-color: #3498db;
}

.event-item.selected {
    background-color: #e3f2fd;
    border-color: #3498db;
    border-width: 2px;
}

.event-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 8px;
}

.event-time {
    font-weight: 600;
    color: #2c3e50;
    font-size: 14px;
}

.event-category {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}

.event-category.падёж {
    background-color: #ffebee;
    color: #c62828;
}

.event-category.человек {
    background-color: #e3f2fd;
    color: #1565c0;
}

.event-description {
    color: #555;
    font-size: 13px;
    line-height: 1.5;
    margin-bottom: 8px;
    word-wrap: break-word;
}

.event-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

.event-actions button {
    padding: 4px 12px;
    border: none;
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.btn-edit {
    background-color: #3498db;
    color: white;
}

.btn-edit:hover {
    background-color: #2980b9;
}

.btn-delete {
    background-color: #e74c3c;
    color: white;
}

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

/* Toast уведомления */
#toast-container {
    position: fixed !important;
    top: 20px !important;
    right: 20px !important;
    left: auto !important;
    bottom: auto !important;
    z-index: 99999 !important;
    display: flex !important;
    flex-direction: column;
    gap: 10px;
    max-width: 400px;
    pointer-events: none;
    margin: 0 !important;
    padding: 0 !important;
    width: auto !important;
    height: auto !important;
}

.toast {
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    padding: 16px 20px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    min-width: 300px;
    max-width: 400px;
    opacity: 0;
    transform: translateX(100%);
    transition: opacity 0.3s ease, transform 0.3s ease;
    pointer-events: auto;
    position: relative;
}

.toast.show {
    opacity: 1;
    transform: translateX(0);
}

.toast-icon {
    font-size: 20px;
    line-height: 1;
    flex-shrink: 0;
    margin-top: 2px;
}

.toast-error {
    border-left: 4px solid #e74c3c;
}

.toast-error .toast-icon {
    color: #e74c3c;
}

.toast-warning {
    border-left: 4px solid #f39c12;
}

.toast-warning .toast-icon {
    color: #f39c12;
}

.toast-info {
    border-left: 4px solid #3498db;
}

.toast-info .toast-icon {
    color: #3498db;
}

.toast-success {
    border-left: 4px solid #27ae60;
}

.toast-success .toast-icon {
    color: #27ae60;
}

.toast-close {
    background: none;
    border: none;
    font-size: 24px;
    color: #999;
    cursor: pointer;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: background-color 0.2s, color 0.2s;
    flex-shrink: 0;
    margin-left: auto;
    line-height: 1;
}

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

.toast-close:active {
    background-color: #e0e0e0;
}

/* Стили для ошибок валидации форм */
.form-group {
    position: relative;
}

.form-group input:invalid,
.form-group textarea:invalid {
    border-color: #e74c3c;
}

.form-group input:invalid:focus,
.form-group textarea:invalid:focus {
    border-color: #e74c3c;
    box-shadow: 0 0 0 2px rgba(231, 76, 60, 0.2);
}

.validation-error {
    color: #e74c3c;
    font-size: 12px;
    margin-top: 4px;
    display: block;
}

.validation-error.show {
    display: block;
}

.field-error {
    border-color: #e74c3c !important;
}

.field-error:focus {
    border-color: #e74c3c !important;
    box-shadow: 0 0 0 2px rgba(231, 76, 60, 0.2) !important;
}

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

/* Секция аномальности в модалке */
.event-modal-anomaly {
    margin: 15px 0;
    padding: 15px;
    background-color: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
}

.anomaly-label {
    font-weight: 600;
    color: #333;
    margin-bottom: 10px;
    font-size: 14px;
}

.anomaly-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.btn-anomaly {
    padding: 8px 16px;
    border: 2px solid #ddd;
    border-radius: 6px;
    background: white;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s;
}

.btn-anomaly:hover {
    border-color: #999;
}

.btn-normal {
    color: #27ae60;
}

.btn-normal:hover {
    background-color: #e8f8f0;
    border-color: #27ae60;
}

.btn-normal.active {
    background-color: #27ae60;
    color: white;
    border-color: #27ae60;
}

.btn-anomaly-flag {
    color: #e74c3c;
}

.btn-anomaly-flag:hover {
    background-color: #fdf0ef;
    border-color: #e74c3c;
}

.btn-anomaly-flag.active {
    background-color: #e74c3c;
    color: white;
    border-color: #e74c3c;
}

.btn-reset {
    color: #7f8c8d;
}

.btn-reset:hover {
    background-color: #f5f5f5;
    border-color: #7f8c8d;
}

.anomaly-status {
    margin-top: 10px;
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 500;
    display: inline-block;
}

.status-normal {
    background-color: #e8f8f0;
    color: #27ae60;
}

.status-anomaly {
    background-color: #fdf0ef;
    color: #e74c3c;
}

.status-unchecked {
    background-color: #f5f5f5;
    color: #7f8c8d;
}

/* Секция видео в модалке события */
.event-modal-video {
    margin: 15px 0;
    padding: 15px;
    background-color: #1a1a1a;
    border-radius: 8px;
}

.event-modal-video-label {
    font-weight: 600;
    color: #ccc;
    margin-bottom: 10px;
    font-size: 14px;
}

.event-modal-video video {
    width: 100%;
    max-height: 400px;
    border-radius: 4px;
    background: #000;
}

.event-modal-video video[src=""] {
    display: none;
}

/* Секция комментария в модалке */
.event-modal-comment {
    margin: 15px 0;
    padding: 15px;
    background-color: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
}

.event-modal-comment label {
    display: block;
    font-weight: 600;
    color: #333;
    margin-bottom: 8px;
    font-size: 14px;
}

.event-modal-comment textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
    resize: vertical;
    min-height: 60px;
    box-sizing: border-box;
}

.event-modal-comment textarea:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.2);
}

.btn-save-comment {
    margin-top: 10px;
    padding: 8px 16px;
    background-color: #3498db;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s;
}

.btn-save-comment:hover {
    background-color: #2980b9;
}

/* Индикаторы на карточке события */
.event-badges {
    display: flex;
    align-items: center;
    gap: 6px;
}

.anomaly-indicator {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.anomaly-indicator.anomaly-true {
    background-color: #e74c3c;
}

.anomaly-indicator.anomaly-false {
    background-color: #27ae60;
}

.comment-indicator {
    font-size: 14px;
    opacity: 0.7;
}

/* Подсветка карточек по статусу */
.event-card.event-card-anomaly {
    border-left: 4px solid #e74c3c;
}

.event-card.event-card-normal {
    border-left: 4px solid #27ae60;
}

/* ===== Пагинация ===== */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin-top: 24px;
    padding: 16px;
    flex-wrap: wrap;
}

.pagination-btn {
    min-width: 40px;
    height: 40px;
    padding: 8px 12px;
    border: 1px solid #ddd;
    background: white;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: #333;
    transition: all 0.2s;
}

.pagination-btn:hover:not(.disabled):not(.active) {
    background: #f0f0f0;
    border-color: #bbb;
}

.pagination-btn.active {
    background: #3498db;
    color: white;
    border-color: #3498db;
}

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

.pagination-dots {
    padding: 0 8px;
    color: #666;
}

/* ===== Информация о событиях ===== */
.events-info {
    text-align: center;
    padding: 12px;
    color: #666;
    font-size: 14px;
    background: #f9f9f9;
    border-radius: 6px;
    margin-bottom: 16px;
}

/* ===== Индикатор загрузки событий ===== */
.loading-events {
    text-align: center;
    padding: 60px 20px;
    color: #666;
    font-size: 16px;
}

.loading-events::before {
    content: '';
    display: block;
    width: 40px;
    height: 40px;
    margin: 0 auto 16px;
    border: 3px solid #eee;
    border-top-color: #3498db;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* ===== Ленивая загрузка скриншотов ===== */
.screenshot-placeholder {
    min-height: 120px;
    background: linear-gradient(90deg, #f0f0f0 25%, #e8e8e8 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 4px;
}

.screenshot-placeholder.loading {
    min-height: 120px;
}

.screenshot-placeholder.loaded {
    animation: none;
    background: none;
    min-height: auto;
}

.screenshot-placeholder.error {
    animation: none;
    background: #fee;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 80px;
}

.screenshot-placeholder.error::after {
    content: '⚠ Ошибка загрузки';
    color: #c00;
    font-size: 12px;
}

@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

/* ===== Улучшенные индикаторы аномальности ===== */
.anomaly-indicator {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
}

.anomaly-indicator.anomaly-true {
    color: #e74c3c;
}

.anomaly-indicator.anomaly-false {
    color: #27ae60;
}

/* ==================== DatePicker - Выбор даты с календарём ==================== */
.date-picker {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

/* Кнопки быстрого доступа */
.date-picker-quick-buttons {
    display: flex;
    gap: 6px;
}

.quick-date-btn {
    padding: 8px 14px;
    border: 1px solid #ddd;
    border-radius: 6px;
    background: white;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    color: #555;
}

.quick-date-btn:hover:not(:disabled) {
    background: #f0f0f0;
    border-color: #bbb;
}

.quick-date-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    background: #f8f8f8;
}

.quick-date-btn.active {
    background: #3498db;
    color: white;
    border-color: #3498db;
}

.quick-date-btn.available:not(.active) {
    border-color: #3498db;
    color: #3498db;
}

/* Поле выбранной даты */
.date-picker-selected {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 14px;
    border: 1px solid #ddd;
    border-radius: 6px;
    background: white;
    cursor: pointer;
    min-width: 200px;
    transition: all 0.2s;
    position: relative;
}

.date-picker-selected:hover {
    border-color: #3498db;
}

.date-picker-selected:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.2);
}

.date-picker-selected.open {
    border-color: #3498db;
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.2);
}

.date-picker-selected.has-value .date-picker-value {
    color: #333;
    font-weight: 500;
}

.date-picker-value {
    flex: 1;
    font-size: 14px;
    color: #999;
}

.date-picker-icon {
    color: #666;
    flex-shrink: 0;
}

/* Выпадающий календарь */
.date-picker-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    margin-top: 4px;
    background: white;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    min-width: 280px;
    animation: dropdownFadeIn 0.2s ease;
}

@keyframes dropdownFadeIn {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Заголовок календаря */
.calendar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid #eee;
}

.calendar-month-year {
    font-size: 15px;
    font-weight: 600;
    color: #333;
    text-transform: capitalize;
}

.calendar-nav-btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: none;
    border-radius: 6px;
    cursor: pointer;
    color: #666;
    transition: all 0.2s;
}

.calendar-nav-btn:hover {
    background: #f0f0f0;
    color: #333;
}

/* Дни недели */
.calendar-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    padding: 8px 12px;
    border-bottom: 1px solid #eee;
}

.calendar-weekdays span {
    text-align: center;
    font-size: 12px;
    font-weight: 600;
    color: #999;
    text-transform: uppercase;
}

/* Сетка дней */
.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    padding: 8px 12px 12px;
    gap: 4px;
}

.calendar-day {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    font-size: 14px;
    cursor: default;
    transition: all 0.15s;
}

.calendar-day.empty {
    visibility: hidden;
}

.calendar-day.disabled {
    color: #ccc;
}

.calendar-day.available {
    cursor: pointer;
    color: #333;
    font-weight: 500;
}

.calendar-day.available:hover {
    background: #e3f2fd;
    color: #1976d2;
}

.calendar-day.today {
    border: 2px solid #3498db;
}

.calendar-day.selected {
    background: #3498db;
    color: white;
    font-weight: 600;
}

.calendar-day.selected:hover {
    background: #2980b9;
    color: white;
}

/* Адаптивность DatePicker */
@media (max-width: 600px) {
    .date-picker {
        flex-direction: column;
        align-items: stretch;
    }
    
    .date-picker-quick-buttons {
        justify-content: center;
    }
    
    .date-picker-selected {
        min-width: 100%;
    }
    
    .date-picker-dropdown {
        left: 50%;
        transform: translateX(-50%);
    }
}

/* Контейнер для DatePicker с position relative */
.date-picker-container {
    position: relative;
}

/* ==================== CameraPicker - Карточки камер ==================== */
.camera-picker {
    width: 100%;
}

.camera-grid {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.camera-grid.loading {
    opacity: 0.6;
    pointer-events: none;
}

.camera-empty {
    color: #999;
    font-style: italic;
    padding: 10px;
}

.camera-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    min-width: 180px;
}

.camera-card:hover {
    border-color: #3498db;
    box-shadow: 0 2px 8px rgba(52, 152, 219, 0.15);
    transform: translateY(-1px);
}

.camera-card.selected {
    border-color: #3498db;
    background: linear-gradient(135deg, #e3f2fd 0%, #f5f9ff 100%);
    box-shadow: 0 2px 12px rgba(52, 152, 219, 0.25);
}

.camera-card.active {
    border-color: #27ae60;
}

.camera-card.active.selected {
    border-color: #3498db;
}

.camera-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 8px;
    background: #f0f0f0;
    color: #666;
    flex-shrink: 0;
}

.camera-card.selected .camera-icon {
    background: #3498db;
    color: white;
}

.camera-card.active .camera-icon {
    background: #27ae60;
    color: white;
}

.camera-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.camera-name {
    font-size: 14px;
    font-weight: 600;
    color: #333;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.camera-stats {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 12px;
    color: #777;
}

.camera-days {
    display: flex;
    align-items: center;
    gap: 4px;
}

.camera-days svg {
    opacity: 0.7;
}

.camera-last {
    color: #999;
}

.camera-last.today {
    color: #27ae60;
    font-weight: 500;
}

.camera-live-badge {
    position: absolute;
    top: -6px;
    right: -6px;
    padding: 2px 6px;
    background: #27ae60;
    color: white;
    font-size: 9px;
    font-weight: 700;
    border-radius: 4px;
    letter-spacing: 0.5px;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* Адаптивность CameraPicker */
@media (max-width: 768px) {
    .camera-grid {
        flex-direction: column;
    }
    
    .camera-card {
        min-width: 100%;
    }
}

