body {
    margin: 0;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #f5f7fa;
}
 
.header {
    background: none;   /* remove background block */
    padding: 20px 40px; /* spacing like 'Security Incidents' */
}

.header h2 {
    font-size: 24px;
    font-weight: 600;
    color: #667eea; /* same blue tone used in Security Incidents */
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}


 
.controls {
    background: white;
    padding: 20px;
    margin: 20px;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
    display: flex;
    gap: 15px;
    align-items: center;
}
 
.btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-block;
}
 
.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}
 
.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}
 
.btn.secondary {
    background: #6c757d;
}
 
.btn.warning {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}
 
.btn.danger {
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a24 100%);
}
 
.btn.success {
    background: linear-gradient(135deg, #00b894 0%, #00cec9 100%);
}
 
.btn.small {
    padding: 6px 12px;
    font-size: 12px;
    margin: 2px;
}
 
.content {
    margin: 0 20px;
}
 
/* Table View Styles */
.table-container {
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
    overflow: hidden;
    overflow-x: auto;
}
 
.camera-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 1000px;
}
 
.camera-table th {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 16px;
    text-align: left;
    font-weight: 500;
    white-space: nowrap;
}
 
.camera-table td {
    padding: 16px;
    border-bottom: 1px solid #eee;
    vertical-align: top;
}
 
.camera-table tr:hover {
    background: #f8f9ff;
}
 
/* Column-specific styling */
.camera-table th:nth-child(1), .camera-table td:nth-child(1) { width: 10%; } /* Camera ID */
.camera-table th:nth-child(2), .camera-table td:nth-child(2) { width: 15%; } /* Name */
.camera-table th:nth-child(3), .camera-table td:nth-child(3) { width: 12%; } /* Tag */
.camera-table th:nth-child(4), .camera-table td:nth-child(4) { width: 25%; } /* RTSP URL */
.camera-table th:nth-child(5), .camera-table td:nth-child(5) { width: 15%; } /* Stream Status */
.camera-table th:nth-child(6), .camera-table td:nth-child(6) { width: 10%; } /* Date */
.camera-table th:nth-child(7), .camera-table td:nth-child(7) { width: 8%; } /* Status */
.camera-table th:nth-child(8), .camera-table td:nth-child(8) { width: 15%; } /* Actions */
 
.camera-id {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: bold;
}
 
.status-badge {
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}
 
.status-active {
    background: #d4edda;
    color: #155724;
}
 
.status-inactive {
    background: #f8d7da;
    color: #721c24;
}
 
.stream-status {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 500;
    background: #e3f2fd;
    color: #1565c0;
    font-family: monospace;
    word-break: break-all;
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.stream-status:hover {
    white-space: normal;
    word-break: break-word;
    max-width: none;
    z-index: 10;
    position: relative;
    background: #bbdefb;
}

.stream-status.available {
    background: #c8e6c9;
    color: #2e7d32;
}

.stream-status.unavailable {
    background: #ffcdd2;
    color: #c62828;
}
 
/* Live View Styles */
.camera-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(400px, 1fr));
    gap: 20px;
}
 
.camera-card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
    overflow: hidden;
    transition: transform 0.3s ease;
}
 
.camera-card:hover {
    transform: translateY(-5px);
}
 
.camera-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
 
.camera-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 500;
}
 
.camera-body {
    padding: 20px;
}
 
.camera-info {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 15px;
    font-size: 14px;
}
 
.video-container {
    width: 100%;
    height: 240px;
    background: #000;
    border-radius: 8px;
    overflow: hidden;
    position: relative;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
}
 
.video-stream {
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center;
    /* Optimize for smooth playback */
    image-rendering: optimizeSpeed;
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
    /* Hardware acceleration */
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
    will-change: transform;
}
 
.stream-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #888;
    font-size: 14px;
    background: linear-gradient(45deg, #1a1a1a 25%, transparent 25%),
                linear-gradient(-45deg, #1a1a1a 25%, transparent 25%),
                linear-gradient(45deg, transparent 75%, #1a1a1a 75%),
                linear-gradient(-45deg, transparent 75%, #1a1a1a 75%);
    background-size: 20px 20px;
    background-position: 0 0, 0 10px, 10px -10px, -10px 0px;
    flex-direction: column;
    text-align: center;
}
 
.stream-error {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #dc3545;
    font-size: 14px;
    background: #000;
    flex-direction: column;
    text-align: center;
}
 
.stream-loading {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #007bff;
    font-size: 14px;
    background: #000;
    flex-direction: column;
}
 
.actions {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}
 
.actions .btn {
    padding: 8px 16px;
    font-size: 12px;
}
 
/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    backdrop-filter: blur(5px);
}
 
.modal-content {
    background: white;
    margin: 5% auto;
    padding: 30px;
    border-radius: 12px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    position: relative;
    animation: modalSlideIn 0.3s ease;
}
 
@keyframes modalSlideIn {
    from { opacity: 0; transform: translateY(-50px); }
    to { opacity: 1; transform: translateY(0); }
}
 
.close {
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 24px;
    cursor: pointer;
    color: #999;
    transition: color 0.3s ease;
}
 
.close:hover {
    color: #333;
}
 
.form-group {
    margin-bottom: 20px;
}
 
.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: #333;
}
 
.form-group input,
.form-group select {
    width: 100%;
    padding: 12px;
    border: 2px solid #e1e5e9;
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.3s ease;
    box-sizing: border-box;
}
 
.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #667eea;
}
 
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #666;
}
 
.empty-state h3 {
    margin: 0 0 10px 0;
    color: #333;
}
 
.loading-spinner {
    border: 3px solid #f3f3f3;
    border-top: 3px solid #667eea;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    animation: spin 1s linear infinite;
    margin: 0 auto 10px;
}
 
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}
 
/* Alert styles */
.alert {
    background: #fff3cd;
    border: 1px solid #ffeaa7;
    color: #856404;
    padding: 15px;
    border-radius: 8px;
    margin: 20px;
}
 
.alert-info {
    background: #d4edda;
    border: 1px solid #c3e6cb;
    color: #155724;
}
 
.alert-error {
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
}
 
.alert-title {
    font-weight: bold;
    margin-bottom: 10px;
}
 
/* Stream control styles */
.stream-controls {
    display: flex;
    gap: 10px;
    margin-top: 10px;
    padding: 10px;
    background: rgba(0,0,0,0.7);
    border-radius: 6px;
    justify-content: center;
    align-items: center;
}
 
.stream-controls .btn {
    padding: 6px 12px;
    font-size: 11px;
    min-width: auto;
    background: rgba(255,255,255,0.2);
    border: 1px solid rgba(255,255,255,0.3);
    color: white;
    backdrop-filter: blur(10px);
}
 
.stream-controls .btn:hover {
    background: rgba(255,255,255,0.3);
    transform: none;
    box-shadow: none;
}
 
.stream-controls .btn.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-color: #667eea;
}
 
.stream-controls .btn.recording {
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a24 100%);
    border-color: #ff6b6b;
    animation: recordingPulse 2s infinite;
}
 
@keyframes recordingPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}
 
/* Quality selector */
.quality-selector {
    display: flex;
    align-items: center;
    gap: 5px;
    color: white;
    font-size: 11px;
}
 
.quality-selector select {
    background: rgba(255,255,255,0.2);
    border: 1px solid rgba(255,255,255,0.3);
    color: white;
    border-radius: 4px;
    padding: 2px 6px;
    font-size: 10px;
    outline: none;
}
 
.quality-selector select option {
    background: #333;
    color: white;
}
 
/* Stream overlay */
.stream-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.8);
    display: none;
    align-items: center;
    justify-content: center;
    color: white;
    flex-direction: column;
    text-align: center;
    font-size: 14px;
}
 
.stream-overlay.show {
    display: flex;
}
 
.stream-overlay .loading-spinner {
    border-color: #f3f3f3;
    border-top-color: #667eea;
    margin-bottom: 15px;
}
 
/* Fullscreen styles */
.video-container.fullscreen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 999;
    border-radius: 0;
    margin: 0;
}
 
.video-container.fullscreen .stream-controls {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0,0,0,0.8);
}
 
/* PTZ Controls */
.ptz-controls {
    display: grid;
    grid-template-areas:
        "up-left up up-right"
        "left home right"
        "down-left down down-right";
    gap: 5px;
    max-width: 120px;
    margin: 10px auto;
}
 
.ptz-btn {
    background: rgba(255,255,255,0.2);
    border: 1px solid rgba(255,255,255,0.3);
    color: white;
    padding: 8px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}
 
.ptz-btn:hover {
    background: rgba(255,255,255,0.3);
}
 
.ptz-btn:active {
    transform: scale(0.95);
}
 
.ptz-up { grid-area: up; }
.ptz-down { grid-area: down; }
.ptz-left { grid-area: left; }
.ptz-right { grid-area: right; }
.ptz-up-left { grid-area: up-left; }
.ptz-up-right { grid-area: up-right; }
.ptz-down-left { grid-area: down-left; }
.ptz-down-right { grid-area: down-right; }
.ptz-home { grid-area: home; background: rgba(102, 126, 234, 0.8); }
 
/* Zoom controls */
.zoom-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 10px;
}
 
.zoom-slider {
    flex: 1;
    height: 4px;
    background: rgba(255,255,255,0.3);
    border-radius: 2px;
    outline: none;
    appearance: none;
    -webkit-appearance: none;
}
 
.zoom-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    background: #667eea;
    border-radius: 50%;
    cursor: pointer;
}
 
.zoom-slider::-moz-range-thumb {
    width: 16px;
    height: 16px;
    background: #667eea;
    border-radius: 50%;
    cursor: pointer;
    border: none;
}
 
/* Recording indicator */
.recording-indicator {
    position: absolute;
    top: 10px;
    right: 10px;
    background: #ff6b6b;
    color: white;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 10px;
    font-weight: bold;
    display: none;
    align-items: center;
    gap: 5px;
    animation: recordingPulse 2s infinite;
}
 
.recording-indicator.show {
    display: flex;
}
 
.recording-dot {
    width: 6px;
    height: 6px;
    background: white;
    border-radius: 50%;
    animation: recordingDot 1s infinite;
}
 
@keyframes recordingDot {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0; }
}
 
/* Stream info overlay */
.stream-info {
    position: absolute;
    top: 10px;
    left: 10px;
    background: rgba(0,0,0,0.7);
    color: white;
    padding: 6px 10px;
    border-radius: 4px;
    font-size: 10px;
    font-family: monospace;
    display: none;
}
 
.stream-info.show {
    display: block;
}
 
/* Mobile responsive adjustments */
@media (max-width: 768px) {
    .camera-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .controls {
        flex-direction: column;
        align-items: stretch;
    }
    
    .controls .btn {
        margin: 5px 0;
        text-align: center;
    }
    
    .stream-controls {
        flex-wrap: wrap;
        gap: 5px;
    }
    
    .stream-controls .btn {
        flex: 1;
        min-width: 60px;
    }
    
    .ptz-controls {
        max-width: 100px;
    }
    
    .ptz-btn {
        padding: 6px;
        font-size: 10px;
    }
    
    .modal-content {
        margin: 10% auto;
        padding: 20px;
    }
    
    .table-container {
        overflow-x: scroll;
    }
    
    .camera-table {
        min-width: 1200px;
    }
}