/* Smart Building - Inteligentny Budynek Styles */
:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --secondary: #64748b;
    --success: #22c55e;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #3b82f6;
    
    --bg-dark: #0f172a;
    --bg-card: #1e293b;
    --bg-hover: #334155;
    
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    
    --border: #334155;
    --radius: 12px;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-dark);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
}

.app {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 0;
    border-bottom: 1px solid var(--border);
    margin-bottom: 30px;
}

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
}

.status-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: var(--bg-card);
    border-radius: 20px;
    font-size: 0.875rem;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--success);
    animation: pulse 2s infinite;
}

.status-dot.active {
    background: var(--success);
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Main Grid */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

@media (max-width: 1200px) {
    .dashboard-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
}

/* Cards */
.card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
}

.card h2 {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 20px;
    color: var(--text-primary);
}

/* Overview Card */
.overview-card {
    grid-column: span 2;
}

.metrics-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
}

.metric {
    text-align: center;
    padding: 16px;
    background: var(--bg-dark);
    border-radius: var(--radius);
}

.metric-value {
    display: block;
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary);
}

.metric-label {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

@media (max-width: 768px) {
    .metrics-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Floor Selector */
.floors-card {
    grid-column: span 1;
}

.floor-selector {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.floor-btn {
    padding: 8px 12px;
    background: var(--bg-dark);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.875rem;
}

.floor-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.floor-btn.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

/* HVAC Zones */
.hvac-card {
    grid-column: span 1;
}

.hvac-zones {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.hvac-zone {
    padding: 16px;
    background: var(--bg-dark);
    border-radius: var(--radius);
    border-left: 4px solid var(--success);
}

.hvac-zone.warning {
    border-left-color: var(--warning);
}

.hvac-zone.idle {
    border-left-color: var(--text-muted);
}

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

.zone-name {
    font-weight: 600;
}

.zone-status {
    font-size: 0.75rem;
    padding: 4px 8px;
    border-radius: 12px;
    background: rgba(34, 197, 94, 0.2);
    color: var(--success);
}

.zone-status.warning {
    background: rgba(245, 158, 11, 0.2);
    color: var(--warning);
}

.zone-status.idle {
    background: rgba(100, 116, 139, 0.2);
    color: var(--text-muted);
}

.zone-temp {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 8px;
}

.temp-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
}

.temp-controls {
    display: flex;
    gap: 4px;
}

.temp-btn {
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 8px;
    background: var(--bg-card);
    color: var(--text-primary);
    cursor: pointer;
    font-size: 1.25rem;
    transition: all 0.2s;
}

.temp-btn:hover:not(:disabled) {
    background: var(--primary);
}

.temp-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.zone-humidity {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* Energy Card */
.energy-card {
    grid-column: span 1;
}

.energy-chart {
    height: 150px;
    margin-bottom: 20px;
}

.chart-bars {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    height: 100%;
    gap: 8px;
}

.chart-bar {
    flex: 1;
    background: linear-gradient(to top, var(--primary), var(--info));
    border-radius: 4px 4px 0 0;
    position: relative;
    min-height: 30px;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    align-items: center;
    padding-bottom: 4px;
}

.bar-label {
    font-size: 0.625rem;
    color: var(--text-muted);
    position: absolute;
    bottom: -20px;
}

.bar-value {
    font-size: 0.625rem;
    color: var(--text-secondary);
    position: absolute;
    top: -18px;
}

.energy-summary {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.energy-item {
    display: flex;
    justify-content: space-between;
    padding: 8px 12px;
    background: var(--bg-dark);
    border-radius: 8px;
}

.energy-label {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.energy-value {
    font-weight: 600;
    color: var(--success);
}

/* Security Card */
.security-card {
    grid-column: span 1;
}

.security-status {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.security-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: var(--bg-dark);
    border-radius: var(--radius);
}

.security-icon {
    font-size: 1.5rem;
}

.security-label {
    flex: 1;
    font-weight: 500;
}

.security-state {
    font-size: 0.875rem;
    padding: 4px 12px;
    border-radius: 12px;
    background: rgba(34, 197, 94, 0.2);
    color: var(--success);
}

.security-state.locked {
    background: rgba(239, 68, 68, 0.2);
    color: var(--danger);
}

.security-state.active {
    background: rgba(34, 197, 94, 0.2);
    color: var(--success);
}

.security-state.ok {
    background: rgba(34, 197, 94, 0.2);
    color: var(--success);
}

/* Sensors Card */
.sensors-card {
    grid-column: span 1;
}

.sensors-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.sensor {
    padding: 16px;
    background: var(--bg-dark);
    border-radius: var(--radius);
    text-align: center;
}

.sensor-icon {
    font-size: 1.5rem;
    display: block;
    margin-bottom: 8px;
}

.sensor-name {
    font-size: 0.75rem;
    color: var(--text-secondary);
    display: block;
    margin-bottom: 4px;
}

.sensor-value {
    font-size: 1rem;
    font-weight: 600;
    display: block;
    margin-bottom: 4px;
}

.sensor-status {
    font-size: 0.625rem;
    padding: 2px 8px;
    border-radius: 10px;
    background: rgba(34, 197, 94, 0.2);
    color: var(--success);
}

.sensor-status.online {
    background: rgba(34, 197, 94, 0.2);
    color: var(--success);
}

.sensor-status.offline {
    background: rgba(239, 68, 68, 0.2);
    color: var(--danger);
}

/* Alerts Card */
.alerts-card {
    grid-column: span 1;
}

.alerts-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.alert {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px;
    background: var(--bg-dark);
    border-radius: var(--radius);
    border-left: 4px solid var(--info);
}

.alert.critical {
    border-left-color: var(--danger);
}

.alert.warning {
    border-left-color: var(--warning);
}

.alert.info {
    border-left-color: var(--info);
}

.alert-icon {
    font-size: 1.25rem;
}

.alert-content {
    flex: 1;
}

.alert-title {
    font-weight: 600;
    font-size: 0.875rem;
    display: block;
    margin-bottom: 4px;
}

.alert-desc {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.alert-time {
    font-size: 0.75rem;
    color: var(--text-muted);
    white-space: nowrap;
}

/* Footer */
.footer {
    margin-top: 40px;
    padding: 20px 0;
    border-top: 1px solid var(--border);
}

.footer-info {
    display: flex;
    justify-content: space-between;
    color: var(--text-muted);
    font-size: 0.875rem;
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.card {
    animation: fadeIn 0.3s ease-out;
}

.card:nth-child(1) { animation-delay: 0s; }
.card:nth-child(2) { animation-delay: 0.1s; }
.card:nth-child(3) { animation-delay: 0.2s; }
.card:nth-child(4) { animation-delay: 0.3s; }
.card:nth-child(5) { animation-delay: 0.4s; }
.card:nth-child(6) { animation-delay: 0.5s; }
.card:nth-child(7) { animation-delay: 0.6s; }
