* {
    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;
    color: #333;
}

.dashboard-container {
    max-width: 1400px;
    margin: 0 auto;
}

.dashboard-header {
    text-align: center;
    color: white;
    margin-bottom: 40px;
    padding: 30px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    animation: fadeIn 0.8s ease;
    position: relative;
}

.logout-btn {
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.logout-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

@keyframes fadeIn {
    from { 
        opacity: 0; 
        transform: translateY(-20px); 
    }
    to { 
        opacity: 1; 
        transform: translateY(0); 
    }
}

.dashboard-header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    font-weight: 700;
}

.subtitle {
    font-size: 1.1rem;
    opacity: 0.9;
    margin-top: 10px;
}

.filter-bar {
    display: flex;
    gap: 10px;
    margin-bottom: 30px;
    flex-wrap: wrap;
    justify-content: center;
}

.filter-btn {
    padding: 10px 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border-radius: 25px;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 500;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.filter-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

.filter-btn.active {
    background: white;
    color: #667eea;
    border-color: white;
    font-weight: 600;
}

.filter-btn.control-btn {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.4);
    font-weight: 600;
}

.filter-btn.control-btn:hover {
    background: rgba(255, 255, 255, 0.25);
}

.devices-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.device-card {
    background: white;
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.device-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
}

.device-card.active {
    border: 2px solid #4CAF50;
    box-shadow: 0 0 20px rgba(76, 175, 80, 0.3);
}

.device-card.inactive {
    border: 2px solid #e0e0e0;
}

.device-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.device-icon {
    font-size: 2.5rem;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 12px;
    color: white;
}

.device-card.active .device-icon {
    background: linear-gradient(135deg, #4CAF50 0%, #45a049 100%);
}

.status-indicator {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #e0e0e0;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
}

.status-indicator.active {
    background: #4CAF50;
    box-shadow: 0 0 15px rgba(76, 175, 80, 0.6);
    animation: pulse 2s infinite;
}

.status-indicator.inactive {
    background: #f44336;
    box-shadow: 0 0 10px rgba(244, 67, 54, 0.4);
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.7;
    }
}

.device-name {
    font-size: 1.3rem;
    font-weight: 600;
    margin-bottom: 8px;
    color: #333;
}

.device-type {
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 20px;
}

.device-info {
    margin-bottom: 20px;
}

.slider-control {
    margin-bottom: 20px;
    padding: 15px;
    background: #f5f5f5;
    border-radius: 10px;
}

.slider-control label {
    display: block;
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 10px;
    font-weight: 500;
}

.slider-value {
    color: #667eea;
    font-weight: 600;
}

.control-slider {
    width: 100%;
    height: 6px;
    border-radius: 5px;
    background: #ddd;
    outline: none;
    -webkit-appearance: none;
    cursor: pointer;
}

.control-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #667eea;
    cursor: pointer;
    transition: all 0.2s ease;
}

.control-slider::-webkit-slider-thumb:hover {
    background: #5568d3;
    transform: scale(1.1);
}

.control-slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #667eea;
    cursor: pointer;
    border: none;
    transition: all 0.2s ease;
}

.control-slider::-moz-range-thumb:hover {
    background: #5568d3;
    transform: scale(1.1);
}

.lock-status {
    margin-bottom: 20px;
    padding: 12px;
    background: #f5f5f5;
    border-radius: 10px;
    text-align: center;
    font-size: 1rem;
    color: #333;
}

.device-status {
    font-size: 0.95rem;
    color: #666;
    margin-bottom: 8px;
}

.device-status strong {
    color: #333;
}

.toggle-switch {
    position: relative;
    width: 60px;
    height: 30px;
    background: #ccc;
    border-radius: 30px;
    cursor: pointer;
    transition: background 0.3s ease;
    margin-top: 10px;
    user-select: none;
    -webkit-user-select: none;
    flex-shrink: 0;
}

.toggle-switch.active {
    background: #4CAF50;
}

.toggle-switch::after {
    content: '';
    position: absolute;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: white;
    top: 3px;
    left: 3px;
    transition: transform 0.3s ease;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.toggle-switch.active::after {
    transform: translateX(30px);
}

.stats-section {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-top: 30px;
}

.stat-card {
    background: white;
    border-radius: 16px;
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 20px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.stat-icon {
    font-size: 2.5rem;
    width: 70px;
    height: 70px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 16px;
}

.stat-info {
    flex: 1;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: #333;
    margin-bottom: 5px;
}

.stat-label {
    font-size: 0.9rem;
    color: #666;
}

.notifications {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 350px;
}

.notification {
    background: white;
    padding: 15px 20px;
    border-radius: 10px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    opacity: 0;
    transform: translateX(400px);
    transition: all 0.3s ease;
    font-size: 0.95rem;
    color: #333;
    border-left: 4px solid #667eea;
}

.notification.show {
    opacity: 1;
    transform: translateX(0);
}

.notification::before {
    content: '✓';
    display: inline-block;
    margin-right: 8px;
    color: #4CAF50;
    font-weight: bold;
}

.notification-success {
    border-left-color: #4CAF50;
}

.notification-success::before {
    content: '✓';
    color: #4CAF50;
}

.notification-error {
    border-left-color: #f44336;
}

.notification-error::before {
    content: '⚠';
    color: #f44336;
}

/* Responsive Design */
@media (max-width: 768px) {
    .dashboard-header h1 {
        font-size: 2rem;
    }

    .devices-grid {
        grid-template-columns: 1fr;
    }

    .stats-section {
        grid-template-columns: 1fr;
    }

    .stat-card {
        flex-direction: column;
        text-align: center;
    }

    .filter-bar {
        justify-content: flex-start;
        overflow-x: auto;
        padding-bottom: 10px;
    }

    .filter-btn {
        flex-shrink: 0;
        font-size: 0.85rem;
        padding: 8px 16px;
    }

    .notifications {
        left: 20px;
        right: 20px;
        max-width: none;
    }

    .notification {
        transform: translateY(-100px);
    }

    .notification.show {
        transform: translateY(0);
    }
}

@media (max-width: 480px) {
    body {
        padding: 10px;
    }

    .dashboard-header {
        padding: 20px;
    }

    .dashboard-header h1 {
        font-size: 1.5rem;
    }

    .device-card {
        padding: 20px;
    }
}
