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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
}

.header {
    text-align: center;
    margin-bottom: 40px;
}

.header h1 {
    color: #333;
    font-size: 2.5em;
    margin-bottom: 10px;
}

.control-panel {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    margin-bottom: 40px;
}

.video-control, .grid-control {
    background: white;
    border-radius: 15px;
    padding: 25px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
}

.section-title {
    font-size: 1.3em;
    color: #333;
    margin-bottom: 20px;
    font-weight: 600;
}

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

.input-group label {
    display: block;
    margin-bottom: 8px;
    color: #555;
    font-weight: 500;
}

.input-group input, .input-group select {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e1e5e9;
    border-radius: 10px;
    font-size: 14px;
    transition: all 0.3s ease;
}

.input-group input:focus, .input-group select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 15px 30px;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-right: 10px;
    margin-bottom: 10px;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(102, 126, 234, 0.3);
}

.btn.danger {
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a24 100%);
}

.btn.success {
    background: linear-gradient(135deg, #26de81 0%, #20bf6b 100%);
}

.devices-section {
    background: white;
    border-radius: 15px;
    padding: 25px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    margin-bottom: 30px;
}

.devices-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.device-card {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 20px;
    border: 2px solid #e1e5e9;
    transition: all 0.3s ease;
    cursor: pointer;
}

.device-card:hover {
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.device-card.active {
    border-color: #26de81;
    background: #f0fff4;
}

.device-card.offline {
    border-color: #ff6b6b;
    background: #fff5f5;
}

.device-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.device-name {
    font-weight: 600;
    font-size: 1.1em;
}

.device-status {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.8em;
    font-weight: 500;
}

.status-active {
    background: #26de81;
    color: white;
}

.status-offline {
    background: #ff6b6b;
    color: white;
}

.status-pending {
    background: #ffa502;
    color: white;
}

.performance-data {
    margin-top: 15px;
    font-family: monospace;
    background: rgba(0, 0, 0, 0.05);
    padding: 10px;
    border-radius: 8px;
    display: none;
}

.grid-designer {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin: 20px 0;
    max-width: 400px;
}

.grid-cell {
    aspect-ratio: 1;
    border: 2px dashed #ccc;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.8em;
}

.grid-cell:hover {
    border-color: #667eea;
    background: rgba(102, 126, 234, 0.1);
}

.grid-cell.assigned {
    border-color: #26de81;
    background: rgba(38, 222, 129, 0.1);
    border-style: solid;
}

.connection-status {
    margin-top: 10px;
    display: flex;
    gap: 20px;
    justify-content: center;
}

.connection-status span {
    padding: 5px 15px;
    border-radius: 20px;
    font-size: 0.9em;
    font-weight: 500;
}

.status-local.connected {
    background: #26de81;
    color: white;
}

.status-local.disconnected {
    background: #ff6b6b;
    color: white;
}

.status-firebase.connected {
    background: #4285f4;
    color: white;
}

.status-firebase.disconnected {
    background: #666;
    color: white;
}

.room-selector {
    background: white;
    border-radius: 15px;
    padding: 20px;
    margin-bottom: 30px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.sync-methods {
    display: flex;
    gap: 15px;
    margin-bottom: 15px;
}

.method-indicator {
    padding: 5px 15px;
    border-radius: 15px;
    font-size: 0.8em;
    font-weight: 500;
}

.method-indicator.local {
    background: #e8f5e8;
    color: #2d5a2d;
}

.method-indicator.firebase {
    background: #e3f2fd;
    color: #1565c0;
}

.status-bar {
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 15px;
    border-radius: 10px;
    margin-top: 20px;
    font-family: monospace;
}

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
}

.modal-content {
    background: white;
    margin: 50px auto;
    padding: 30px;
    border-radius: 15px;
    max-width: 500px;
    position: relative;
}

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

@media (max-width: 768px) {
    .control-panel {
        grid-template-columns: 1fr;
    }
    
    .devices-grid {
        grid-template-columns: 1fr;
    }
    
    .connection-status {
        flex-direction: column;
        align-items: center;
        gap: 10px;
    }
}