/* Ciemny motyw */
:root {
    --primary-color: #3498db;
    --secondary-color: #2ecc71;
    --danger-color: #e74c3c;
    --warning-color: #f39c12;
    --dark-color: #1a1a1a;
    --darker-color: #121212;
    --light-color: #2d2d2d;
    --text-color: #e0e0e0;
    --text-muted: #a0a0a0;
    --border-radius: 8px;
    --box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
    --transition: all 0.3s ease;
}

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--darker-color);
}

header {
    background: linear-gradient(135deg, var(--primary-color), var(--dark-color));
    color: white;
    padding: 1.5rem 0;
    box-shadow: var(--box-shadow);
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-controls {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

h1 {
    font-size: 1.8rem;
    font-weight: 600;
}

.last-update {
    font-size: 0.9rem;
    opacity: 0.9;
}

/* Wskaźnik żywości */
.live-indicator {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    color: var(--secondary-color);
}

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

@keyframes pulse {
    0% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(1.1); }
    100% { opacity: 1; transform: scale(1); }
}

main {
    max-width: 1200px;
    margin: 2rem auto;
    padding: 0 1rem;
    display: grid;
    gap: 1.5rem;
}

.card {
    background: var(--dark-color);
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    padding: 1.5rem;
    transition: var(--transition);
    border: 1px solid var(--light-color);
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.4);
}

h2 {
    margin-bottom: 1.2rem;
    color: var(--text-color);
    border-bottom: 2px solid var(--light-color);
    padding-bottom: 0.5rem;
}

h3 {
    margin-bottom: 0.8rem;
    color: var(--primary-color);
}

/* Sekcja danych bieżących */
.current-data .data-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
}

.data-item {
    display: flex;
    align-items: center;
    padding: 1rem;
    border-radius: var(--border-radius);
    background: var(--light-color);
    transition: var(--transition);
}

.data-item:hover {
    transform: scale(1.02);
}

.data-icon {
    font-size: 2.5rem;
    margin-right: 1rem;
}

.data-info h3 {
    margin-bottom: 0.3rem;
}

.data-value {
    font-size: 1.8rem;
    font-weight: bold;
    margin-bottom: 0.3rem;
}

.data-trend {
    font-size: 0.9rem;
    color: var(--text-muted);
}

/* Statystyki */
.stats-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
}

.stat-card {
    padding: 1rem;
    border-radius: var(--border-radius);
    background: var(--light-color);
}

.stat-item {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0;
    border-bottom: 1px solid #444;
}

.stat-item:last-child {
    border-bottom: none;
}

.stat-label {
    font-weight: 500;
}

.stat-value {
    font-weight: bold;
}

/* Trend indicators */
.trend-up {
    color: var(--danger-color);
}

.trend-up::before {
    content: "↗ ";
}

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

.trend-down::before {
    content: "↘ ";
}

.trend-stable {
    color: var(--warning-color);
}

.trend-stable::before {
    content: "→ ";
}

/* Porównanie */
.comparison-container {
    display: grid;
    gap: 1rem;
}

.comparison-item {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.comparison-label {
    min-width: 100px;
    font-weight: 500;
}

.comparison-bar {
    flex: 1;
    height: 20px;
    background: var(--light-color);
    border-radius: 10px;
    position: relative;
    overflow: hidden;
}

.bar {
    position: absolute;
    height: 100%;
    border-radius: 10px;
    transition: width 0.5s ease;
}

.bar.today {
    background: var(--primary-color);
    z-index: 2;
}

.comparison-value {
    min-width: 60px;
    text-align: right;
    font-weight: bold;
}

/* Wykres */
.chart-container {
    position: relative;
    height: 400px;
    width: 100%;
}

.chart-info {
    text-align: center;
    padding: 10px;
    color: var(--text-muted);
    font-style: italic;
    margin-top: 0.5rem;
}

/* Tabela pomiarów */
.table-container {
    overflow-x: auto;
    border-radius: var(--border-radius);
    border: 1px solid var(--light-color);
}

table {
    width: 100%;
    border-collapse: collapse;
}

th, td {
    padding: 0.8rem;
    text-align: left;
    border-bottom: 1px solid #444;
}

th {
    background: var(--light-color);
    font-weight: 600;
    position: sticky;
    top: 0;
}

tr:hover {
    background: #2a2a2a;
}

.table-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

/* Powiadomienia */
#notifications-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.notification {
    background: var(--dark-color);
    border: 1px solid var(--light-color);
    border-radius: var(--border-radius);
    padding: 1rem;
    box-shadow: var(--box-shadow);
    animation: slideIn 0.3s ease;
    min-width: 300px;
}

.notification.warning {
    border-left: 4px solid var(--warning-color);
}

.notification.danger {
    border-left: 4px solid var(--danger-color);
}

.notification.success {
    border-left: 4px solid var(--secondary-color);
}

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* Stopka */
footer {
    background: var(--dark-color);
    color: var(--text-color);
    padding: 1.5rem 0;
    margin-top: 2rem;
    border-top: 1px solid var(--light-color);
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.footer-controls {
    display: flex;
    gap: 0.5rem;
}

.btn-small {
    padding: 0.3rem 0.6rem;
    background: var(--light-color);
    border: none;
    border-radius: 4px;
    color: var(--text-color);
    cursor: pointer;
    font-size: 0.8rem;
}

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

.status .connected {
    color: var(--secondary-color);
}

.status .error {
    color: var(--danger-color);
}

/* Animacje */
@keyframes valueChange {
    0% { background-color: transparent; }
    50% { background-color: rgba(255, 255, 255, 0.1); }
    100% { background-color: transparent; }
}

.data-value.changing {
    animation: valueChange 0.5s ease;
}

/* Tryb offline */
body.offline-mode {
    opacity: 0.8;
}

.offline-banner {
    background: var(--warning-color);
    color: black;
    text-align: center;
    padding: 0.5rem;
    font-weight: bold;
}

/* Responsywność */
@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }
    
    .header-controls {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .current-data .data-grid {
        grid-template-columns: 1fr;
    }
    
    .stats-container {
        grid-template-columns: 1fr;
    }
    
    .comparison-item {
        flex-direction: column;
        align-items: stretch;
        gap: 0.5rem;
    }
    
    .footer-content {
        flex-direction: column;
        gap: 1rem;
    }
    
    #notifications-container {
        left: 10px;
        right: 10px;
        top: 10px;
    }
    
    .notification {
        min-width: auto;
    }
    
    .chart-container {
        height: 300px;
    }
}
