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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: #e8ecef;
    min-height: 100vh;
    padding: 20px;
    color: #2c3e50;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    overflow: hidden;
}

header {
    background: #4a6fa5;
    color: white;
    padding: 24px 30px;
    border-bottom: none;
}

header h1 {
    font-size: 2em;
    margin-bottom: 20px;
    font-weight: 600;
    letter-spacing: -0.5px;
}

.tabs {
    display: flex;
    gap: 8px;
    justify-content: flex-start;
}

.tab-btn {
    padding: 10px 24px;
    border: none;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
}

.tab-btn:hover {
    background: rgba(255, 255, 255, 0.15);
}

.tab-btn.active {
    background: white;
    color: #4a6fa5;
}

.tab-content {
    display: none;
    padding: 30px;
}

.tab-content.active {
    display: block;
}

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

.camera-card {
    background: #ffffff;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    transition: box-shadow 0.2s;
}

.camera-card:hover {
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.camera-header {
    background: #5a7fb8;
    color: white;
    padding: 12px 16px;
    font-weight: 500;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 14px;
}

.camera-status {
    font-size: 11px;
    padding: 4px 10px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.2);
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.camera-status.recording {
    background: #ff4d4f;
    animation: pulse 2s infinite;
}

.camera-status.online {
    background: #52c41a;
}

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

.camera-video {
    width: 100%;
    height: 300px;
    background: #1a1a1a;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.camera-video img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.recording-timer {
    background: #ff4d4f;
    color: white;
    padding: 8px 16px;
    text-align: center;
    font-weight: 500;
    font-size: 13px;
}

.camera-controls {
    padding: 12px 16px;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    background: #f8f9fa;
    border-top: 1px solid #e0e0e0;
}

.btn {
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s;
    flex: 1;
    min-width: 120px;
}

.btn-primary {
    background: #4a6fa5;
    color: white;
}

.btn-primary:hover {
    background: #3d5a8a;
}

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

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

.btn-success {
    background: #52c41a;
    color: white;
}

.btn-success:hover {
    background: #389e0d;
}

.loading {
    color: #7f8c8d;
    font-size: 13px;
}

.recordings-header {
    margin-bottom: 24px;
}

.recordings-header h2 {
    margin-bottom: 16px;
    color: #4a6fa5;
    font-size: 1.5em;
    font-weight: 600;
}

.active-recordings {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 20px;
}

.active-recording-card {
    background: #ff4d4f;
    color: white;
    padding: 12px 16px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 2px 6px rgba(255, 77, 79, 0.25);
}

.active-recording-card .info {
    flex: 1;
}

.active-recording-card .info h3 {
    font-size: 14px;
    margin-bottom: 4px;
    font-weight: 600;
}

.active-recording-card .info p {
    font-size: 12px;
    opacity: 0.9;
}

.recordings-list {
    display: grid;
    gap: 16px;
}

.recording-card {
    background: #ffffff;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    padding: 16px;
    display: flex;
    gap: 16px;
    align-items: center;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    transition: box-shadow 0.2s;
}

.recording-card:hover {
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.recording-preview {
    flex-shrink: 0;
    width: 200px;
    height: 120px;
    border-radius: 4px;
    overflow: hidden;
    background: #e0e0e0;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #d0d0d0;
}

.recording-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.recording-info {
    flex: 1;
}

.recording-info h3 {
    color: #4a6fa5;
    margin-bottom: 6px;
    font-size: 16px;
    font-weight: 600;
}

.recording-info p {
    color: #6c757d;
    font-size: 13px;
    margin: 3px 0;
}

.recording-actions {
    display: flex;
    gap: 8px;
}

.recording-actions .btn {
    padding: 6px 12px;
    min-width: auto;
    font-size: 12px;
}

.status-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    margin-left: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.status-badge.completed {
    background: #52c41a;
    color: white;
}

.status-badge.recording {
    background: #ff4d4f;
    color: white;
}

.status-badge.failed {
    background: #fa8c16;
    color: white;
}

/* Модальное окно */
.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: white;
    margin: 10% auto;
    padding: 24px;
    border-radius: 6px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    position: relative;
}

.close {
    color: #95a5a6;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    position: absolute;
    right: 16px;
    top: 16px;
    line-height: 1;
}

.close:hover {
    color: #4a6fa5;
}

.modal-content h2 {
    margin-bottom: 20px;
    color: #4a6fa5;
    font-size: 1.5em;
    font-weight: 600;
}

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

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    color: #4a6fa5;
    font-size: 14px;
}

.form-group input {
    width: 100%;
    padding: 10px;
    border: 1px solid #d0d0d0;
    border-radius: 4px;
    font-size: 14px;
    transition: border-color 0.2s;
}

.form-group input:focus {
    outline: none;
    border-color: #4a6fa5;
}

.form-group small {
    display: block;
    margin-top: 4px;
    color: #7f8c8d;
    font-size: 12px;
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #95a5a6;
}

.empty-state h3 {
    font-size: 20px;
    margin-bottom: 8px;
    color: #7f8c8d;
}

.empty-state p {
    font-size: 14px;
}

@media (max-width: 768px) {
    .cameras-grid {
        grid-template-columns: 1fr;
    }
    
    header h1 {
        font-size: 1.5em;
    }
    
    .camera-controls {
        flex-direction: column;
    }
    
    .btn {
        width: 100%;
    }
}
