body {
    background-color: #f5f5f5;
}

#connectionStatus {
    font-size: 0.9rem;
    padding: 0.4rem 0.8rem;
}

#deviceTable {
    font-size: 0.85rem;
}

#deviceTable thead th {
    background-color: #343a40;
    color: white;
    position: sticky;
    top: 0;
    z-index: 10;
}

#deviceTable tbody tr.device-on {
    background-color: #d7ffd9;
}

#deviceTable tbody tr.device-off {
    background-color: #ffd7d7;
}

.card-header {
    font-weight: 600;
}

.cmd-button {
    min-width: 120px;
}

.loop-status {
    font-size: 0.85rem;
}

.loop-status.loop-on {
    background-color: #28a745 !important;
}

.loop-status.loop-off {
    background-color: #6c757d !important;
}

.device-group-item {
    border: 1px solid #dee2e6;
    border-radius: 0.375rem;
    padding: 1rem;
    margin-bottom: 1rem;
    background-color: #fff;
}

.button-config-item {
    border: 1px solid #e9ecef;
    border-radius: 0.25rem;
    padding: 0.75rem;
    margin-bottom: 0.5rem;
    background-color: #f8f9fa;
}

.remove-btn {
    cursor: pointer;
}

.form-label-sm {
    font-size: 0.85rem;
    margin-bottom: 0.25rem;
}

.table-responsive {
    max-height: 350px;
    overflow-y: auto;
}

.button-grid {
    max-height: 300px;
    overflow-y: auto;
}

.status-indicator {
    display: inline-block;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 2px solid rgba(0, 0, 0, 0.2);
    box-shadow: 0 0 3px rgba(0, 0, 0, 0.3);
}

.status-alive {
    background-color: #28a745;
    box-shadow: 0 0 8px rgba(40, 167, 69, 0.6);
    animation: pulse-green 2s infinite;
}

.status-warning {
    background-color: #ffc107;
    box-shadow: 0 0 8px rgba(255, 193, 7, 0.6);
}

.status-offline {
    background-color: #dc3545;
}

@keyframes pulse-green {
    0%, 100% {
        box-shadow: 0 0 8px rgba(40, 167, 69, 0.6);
    }
    50% {
        box-shadow: 0 0 15px rgba(40, 167, 69, 0.9);
    }
}

.value-cell {
    transition: background-color 0.4s ease;
}

.value-flash {
    background-color: #ffeb3b !important;
    animation: flash-pulse 0.4s ease;
}

@keyframes flash-pulse {
    0% {
        background-color: #ffeb3b;
        transform: scale(1);
    }
    50% {
        background-color: #ffc107;
        transform: scale(1.02);
    }
    100% {
        background-color: transparent;
        transform: scale(1);
    }
}

@media (max-width: 768px) {
    .card-body {
        padding: 0.75rem;
    }
    
    .cmd-button {
        min-width: 90px;
        font-size: 0.85rem;
    }
}
