* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #1a1a1a;
    color: #ffffff;
    padding: 20px;
}

.control-panel {
    max-width: 1200px;
    margin: 0 auto;
}

.header {
    text-align: center;
    margin-bottom: 30px;
    padding: 20px;
    background: linear-gradient(135deg, #2c3e50, #3498db);
    border-radius: 10px;
}

.header h1 {
    font-size: 2.5em;
    margin-bottom: 10px;
}

.header p {
    font-size: 1.1em;
    opacity: 0.9;
}

.main-controls {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    margin-bottom: 30px;
}

.control-section {
    background: #2a2a2a;
    border-radius: 10px;
    padding: 25px;
    border: 1px solid #444;
}

.control-section h2 {
    margin-bottom: 20px;
    color: #3498db;
    border-bottom: 2px solid #3498db;
    padding-bottom: 10px;
}

.camera-container {
    position: relative;
    background: #000;
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 20px;
}

#cameraVideo {
    width: 100%;
    height: 300px;
    object-fit: cover;
    display: block;
}

.camera-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    color: #888;
    font-size: 1.2em;
}

.camera-overlay div:first-child {
    font-size: 3em;
    margin-bottom: 10px;
}

.btn-group {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

.btn {
    padding: 12px 20px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s ease;
    flex: 1;
    min-width: 120px;
}

.btn-primary {
    background: #3498db;
    color: white;
}

.btn-primary:hover {
    background: #2980b9;
    transform: translateY(-2px);
}

.btn-success {
    background: #27ae60;
    color: white;
}

.btn-success:hover {
    background: #229954;
    transform: translateY(-2px);
}

.btn-warning {
    background: #f39c12;
    color: white;
}

.btn-warning:hover {
    background: #d68910;
    transform: translateY(-2px);
}

.btn-danger {
    background: #e74c3c;
    color: white;
}

.btn-danger:hover {
    background: #c0392b;
    transform: translateY(-2px);
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

.status-indicator {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    margin-right: 8px;
}

.status-offline {
    background: #e74c3c;
}

.status-online {
    background: #27ae60;
}

.projector-controls {
    display: grid;
    gap: 15px;
}

.info-panel {
    background: #2a2a2a;
    border-radius: 10px;
    padding: 20px;
    border: 1px solid #444;
}

.info-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
    padding: 8px 0;
    border-bottom: 1px solid #333;
}

.info-row:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.info-row span:first-child {
    font-weight: 600;
    color: #ccc;
}

/* Selection and Multi-device Controls */
.selection-group {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.selection-group label {
    font-weight: 600;
    color: #ccc;
    min-width: 120px;
}

.device-select {
    flex: 1;
    min-width: 200px;
    padding: 8px 12px;
    border: 1px solid #555;
    border-radius: 4px;
    background: #333;
    color: #fff;
    font-size: 14px;
}

.device-select:focus {
    outline: none;
    border-color: #3498db;
}

.btn-small {
    padding: 6px 12px;
    font-size: 12px;
    min-width: auto;
}

/* Camera and Projector Units */
.camera-unit, .projector-unit {
    background: #1e1e1e;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 15px;
    border: 1px solid #333;
}

.camera-header, .projector-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.camera-header h3, .projector-header h3 {
    color: #3498db;
    margin: 0;
    font-size: 1.1em;
}

.camera-controls-mini, .projector-controls-mini {
    display: flex;
    gap: 5px;
}

/* Compact camera container for multi-camera setup */
.camera-unit .camera-container {
    position: relative;
    background: #000;
    border-radius: 6px;
    overflow: hidden;
    margin-bottom: 10px;
}

.camera-unit .camera-video {
    width: 100%;
    height: 200px;
    object-fit: cover;
    display: block;
}

.camera-unit .camera-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    color: #888;
    font-size: 1em;
}

.camera-unit .camera-overlay div:first-child {
    font-size: 2em;
    margin-bottom: 5px;
}

/* Compact info panels */
.info-panel-mini {
    background: #2a2a2a;
    border-radius: 6px;
    padding: 10px;
    border: 1px solid #444;
}

.info-row-mini {
    display: flex;
    justify-content: space-between;
    margin-bottom: 5px;
    padding: 4px 0;
    font-size: 12px;
}

.info-row-mini:last-child {
    margin-bottom: 0;
}

.info-row-mini span:first-child {
    font-weight: 600;
    color: #ccc;
}

.info-row-mini span:last-child {
    color: #fff;
}

/* Multi-device controls */
.multi-controls {
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid #444;
}

/* Sequence controls */
.sequence-controls, .export-controls {
    margin-top: 20px;
    padding: 15px;
    background: #1e1e1e;
    border-radius: 8px;
    border: 1px solid #333;
}

.sequence-controls h3, .export-controls h3 {
    color: #27ae60;
    margin-bottom: 15px;
    font-size: 1.1em;
}

.export-controls h3 {
    color: #3498db;
}

.sequence-info, .export-info {
    margin-top: 15px;
    padding-top: 10px;
    border-top: 1px solid #444;
}

.sequence-info input[type="number"] {
    background: #333;
    border: 1px solid #555;
    color: #fff;
    border-radius: 4px;
    padding: 4px 8px;
    font-size: 12px;
}

.sequence-info input[type="number"]:focus {
    outline: none;
    border-color: #3498db;
}

/* Device selection within camera units */
.device-selection {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 15px;
    padding: 10px;
    background: #333;
    border-radius: 6px;
}

.device-selection label {
    font-weight: 600;
    color: #ccc;
    min-width: 60px;
}

.device-select-mini {
    flex: 1;
    padding: 6px 10px;
    border: 1px solid #555;
    border-radius: 4px;
    background: #2a2a2a;
    color: #fff;
    font-size: 13px;
}

.device-select-mini:focus {
    outline: none;
    border-color: #3498db;
}

.device-select-mini:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

#activeCamerasContainer {
    display: grid;
    gap: 15px;
}

/* When multiple cameras are active, use grid layout */
#activeCamerasContainer.multi-camera {
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}

#activeProjectorsContainer {
    display: grid;
    gap: 15px;
}

#activeProjectorsContainer {
    display: grid;
    gap: 15px;
}

/* Animation for adding/removing units */
.camera-unit, .projector-unit {
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.camera-unit.removing, .projector-unit.removing {
    animation: slideOut 0.3s ease-out forwards;
}

@keyframes slideOut {
    to {
        opacity: 0;
        transform: translateY(-10px);
        height: 0;
        padding: 0;
        margin: 0;
    }
}

/* Status indicators for sequence */
.sequence-active {
    background: linear-gradient(45deg, #27ae60, #2ecc71) !important;
}

.sequence-paused {
    background: linear-gradient(45deg, #f39c12, #e67e22) !important;
}