:root {
    --primary: #1E88E5;
    --primary-dark: #1565C0;
    --primary-light: #64B5F6;
    --secondary: #FFB74D;
    --success: #43A047;
    --error: #E53935;
    --warning: #FFA000;
    --background: #F5F7FA;
    --surface: #FFFFFF;
    --text: #2C3E50;
    --text-light: #7F8C8D;
    --border: #E0E0E0;
    --shadow-sm: 0 2px 4px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.12);
    --radius-sm: 12px;
    --radius-md: 20px;
    --radius-lg: 28px;
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--background);
    color: var(--text);
    line-height: 1.5;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 1.5rem;
}

/* Tarjetas estilo Flutter */
.card {
    background: var(--surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    transition: all 0.3s ease;
    border: 1px solid rgba(0,0,0,0.05);
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

/* Grid de métricas */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.metric-card {
    background: var(--surface);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    text-align: center;
    box-shadow: var(--shadow-sm);
    border-left: 4px solid var(--primary);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.metric-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.metric-icon {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.metric-card h3 {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-light);
    margin-bottom: 0.75rem;
    font-weight: 600;
}

.metric-card .value {
    font-size: 2.2rem;
    font-weight: 700;
    color: var(--primary-dark);
    line-height: 1.2;
}

.metric-card .unit {
    font-size: 0.8rem;
    color: var(--text-light);
    margin-left: 0.25rem;
}

/* Botones */
.btn {
    background: var(--primary);
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 40px;
    color: white;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.9rem;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.btn:hover {
    background: var(--primary-dark);
    transform: scale(0.98);
}

.btn-outline {
    background: transparent;
    border: 2px solid var(--primary);
    color: var(--primary);
}

.btn-outline:hover {
    background: var(--primary);
    color: white;
}

/* Grid de salones */
.room-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.5rem;
    margin-top: 1rem;
}

.room-card {
    cursor: pointer;
    transition: all 0.3s ease;
}

.room-card:hover {
    transform: translateY(-4px);
}

/* Dispositivos */
.device-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.device-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.25rem;
    background: var(--background);
    border-radius: var(--radius-sm);
    transition: all 0.2s ease;
}

.device-item:hover {
    background: #EEF2F7;
}

.device-info h4 {
    font-size: 1rem;
    margin-bottom: 0.25rem;
}

.device-info p {
    font-size: 0.75rem;
    color: var(--text-light);
}

/* Toggle switch estilo Flutter */
.toggle-switch {
    width: 52px;
    height: 28px;
    background: #CBD5E1;
    border-radius: 34px;
    position: relative;
    cursor: pointer;
    transition: all 0.3s ease;
}

.toggle-switch.active {
    background: var(--success);
}

.toggle-knob {
    width: 24px;
    height: 24px;
    background: white;
    border-radius: 50%;
    position: absolute;
    top: 2px;
    left: 3px;
    transition: transform 0.3s ease;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.toggle-switch.active .toggle-knob {
    transform: translateX(24px);
}

/* Login */
.login-box {
    max-width: 450px;
    margin: 10vh auto;
}

.login-brand {
    max-width: 120px;
    height: auto;
    margin: 0 auto 1rem;
    display: block;
    filter: drop-shadow(0 12px 24px rgba(0, 0, 0, 0.12));
}

.input-group {
    margin-bottom: 1.25rem;
}

.input-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    font-size: 0.9rem;
}

.input-group input {
    width: 100%;
    padding: 0.875rem 1.25rem;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 1rem;
    transition: all 0.2s ease;
}

.input-group input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(30,136,229,0.1);
}

/* Tendencia */
.trend {
    font-size: 0.8rem;
    margin-top: 0.5rem;
    font-weight: 600;
}

.trend-up {
    color: var(--success);
}

.trend-down {
    color: var(--error);
}

.trend-badge {
    font-size: 0.8rem;
    padding: 0.25rem 0.75rem;
    background: var(--background);
    border-radius: 20px;
}

/* Badge */
.badge {
    background: var(--background);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.8rem;
    color: var(--text-light);
}

/* Admin actions */
.admin-actions {
    margin-top: 1.5rem;
    display: flex;
    gap: 1rem;
    justify-content: center;
}

/* Responsive */
@media (max-width: 768px) {
    .container {
        padding: 1rem;
    }
    
    .metrics-grid {
        grid-template-columns: 1fr;
    }
    
    .metric-card .value {
        font-size: 1.8rem;
    }
    
    .room-grid {
        grid-template-columns: 1fr;
    }
}