/* MODERAN GRAPHITE/NEON STIL */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, Roboto, sans-serif;
    background: linear-gradient(135deg, #0f172a 0%, #020617 100%);
    color: #f1f5f9;
    min-height: 100vh;
    line-height: 1.5;
}

.container {
    width: 100%;
    max-width: 1200px;
    margin: auto;
    padding: 24px 16px;
}

/* KARTICE I STAKLENI EFEKT */
.card, .dashboard-header, .desktop-stats-section, .device-card, .chart-box, .summary-card {
    background: rgba(30, 41, 59, 0.7);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 16px;
    box-shadow: 0 10px 30px -10px rgba(0,0,0,0.5);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 15px 35px -5px rgba(0,0,0,0.6);
}

/* STATUSI I POKAZATELJI */
.status {
    padding: 8px 14px;
    border-radius: 30px;
    font-weight: 600;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.online {
    background: rgba(16, 185, 129, 0.15);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.offline {
    background: rgba(239, 68, 68, 0.15);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.badge {
    padding: 6px 14px;
    border-radius: 30px;
    font-weight: 700;
    font-size: 12px;
    letter-spacing: 0.5px;
    display: inline-block;
    min-width: 70px;
    text-align: center;
}

.off { background: #334155; color: #94a3b8; }
.heating-on { background: #ef4444; color: white; box-shadow: 0 0 15px rgba(239, 68, 68, 0.45); }
.cooling-on { background: #3b82f6; color: white; box-shadow: 0 0 15px rgba(59, 130, 246, 0.45); }
.on { background: #10b981; color: white; }

/* KONTROLE I GUMBI */
input[type="number"] {
    width: 100px;
    height: 52px;
    border: 2px solid #334155;
    border-radius: 12px;
    text-align: center;
    font-size: 24px;
    font-weight: 700;
    background: #0b0f17;
    color: white;
    transition: border-color 0.2s, box-shadow 0.2s;
}

input[type="number"]:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
    outline: none;
}

button {
    height: 52px;
    border: none;
    border-radius: 12px;
    font-weight: 600;
    font-size: 14px;
    letter-spacing: 0.3px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

button:hover {
    filter: brightness(1.15);
    transform: translateY(-1px);
}

button:active {
    transform: translateY(1px);
}

/* DESKTOP VIEW */
.desktop-view { display: block; }

.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    padding: 16px 24px;
}

.dashboard-header h2 {
    font-size: 22px;
    font-weight: 600;
}

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

.card {
    padding: 24px;
    display: flex;
    flex-direction: column;
}

.card-title {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #94a3b8;
    margin-bottom: 20px;
    font-weight: 700;
}

/* PRIKAZ TEMPERATURA */
.temp-grid-display {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.temp-label {
    font-size: 13px;
    color: #94a3b8;
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.temp-value {
    font-size: 42px;
    font-weight: 800;
    color: #f8fafc;
}

.value-target { color: #3b82f6; }

/* KONTROLE RAZMJESTAJ */
.inline-controls {
    display: flex;
    gap: 12px;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
}

.temp-btn {
    width: 52px;
    font-size: 18px;
    background: #334155;
    color: white;
}

.save-btn {
    width: 100%;
    background: #10b981;
    color: white;
    margin-bottom: 14px;
}

.power-section {
    display: flex;
    gap: 12px;
}

.power-btn { flex: 1; }
.power-on { background: rgba(16, 185, 129, 0.2); border: 1px solid #10b981; color: #34d399; }
.power-off { background: rgba(239, 68, 68, 0.2); border: 1px solid #ef4444; color: #f87171; }

.status-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.status-row:last-child { border-bottom: none; }
.status-row label { font-size: 14px; display: flex; align-items: center; gap: 8px; }
.status-value { font-weight: 700; }

/* STATISTIKA I GRAFOVI STILIZACIJA */
.desktop-stats-section {
    margin-top: 24px;
    padding: 24px;
}

.section-title {
    font-size: 16px;
    margin-bottom: 20px;
    color: #cbd5e1;
    display: flex;
    align-items: center;
    gap: 8px;
}

.stats-summary-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 24px;
}

.summary-card {
    background: rgba(15, 23, 42, 0.6);
    padding: 16px;
    text-align: center;
}

.summary-label {
    font-size: 12px;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}

.summary-value {
    font-size: 28px;
    font-weight: 800;
}

.card-heater-time .summary-value { color: #f59e0b; }
.card-cooling-time .summary-value { color: #06b6d4; }

.charts-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.chart-box {
    background: rgba(15, 23, 42, 0.5);
    padding: 20px;
}

.chart-box h4 {
    font-size: 13px;
    color: #94a3b8;
    margin-bottom: 16px;
}

/* MOBILE VIEW RESPONSIVE */
.mobile-view { display: none; }

@media (max-width: 900px) {
    .desktop-view { display: none; }
    .mobile-view { display: block; }

    .device-card {
        padding: 20px;
    }

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

    .card-header h2 { font-size: 20px; }

    /* UNOS I POREDAN PRIKAZ TEMPERATURA */
    .mobile-temp-container {
        display: flex;
        flex-direction: column;
        gap: 12px;
        max-width: 290px;
        margin: 0 auto 24px auto;
        background: rgba(11, 15, 23, 0.5);
        padding: 14px 20px;
        border-radius: 12px;
        border: 1px solid rgba(255,255,255,0.02);
    }

    .mobile-temp-row {
        display: flex;
        justify-content: space-between;
        align-items: center;
    }

    .mobile-temp-label {
        font-size: 15px;
        color: #94a3b8;
    }

    .mobile-temp-value {
        font-size: 26px;
        font-weight: 700;
    }
    
    .target-color { color: #3b82f6; }

    .mobile-controls {
        display: flex;
        gap: 12px;
        margin-bottom: 14px;
        align-items: center;
    }

    .mobile-controls .wide-btn { flex: 2.2; background: #334155; font-size: 16px;}
    .mobile-controls input[type="number"] { flex: 1; min-width: 80px; }

    .mobile-save {
        width: 100%;
        height: 52px;
        font-size: 15px;
        font-weight: 700;
        background: #10b981;
        box-shadow: 0 4px 12px rgba(16, 185, 129, 0.2);
        margin-bottom: 14px;
    }

    .mobile-power-buttons {
        display: flex;
        gap: 12px;
        margin-bottom: 24px;
    }

    .mobile-power-buttons button.power-btn {
        flex: 1;
        height: 52px;
    }

    .status-grid {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 12px;
        margin-bottom: 24px;
    }

    .status-item {
        background: rgba(15, 23, 42, 0.5);
        border-radius: 14px;
        padding: 14px;
        text-align: center;
        border: 1px solid rgba(255,255,255,0.03);
    }

    .status-item label {
        display: block;
        font-size: 12px;
        color: #94a3b8;
        margin-bottom: 8px;
    }
    
    .bold-text { font-weight: 700; font-size: 15px; }

    /* NOVO: PREKRASAN GUMB ZA STATISTIKU */
    .mobile-stats-link {
        display: flex;
        width: 100%;
        height: 54px;
        background: linear-gradient(90deg, #3b82f6 0%, #2563eb 100%);
        color: white;
        text-decoration: none;
        justify-content: center;
        align-items: center;
        border-radius: 12px;
        font-weight: 700;
        font-size: 14px;
        letter-spacing: 0.5px;
        box-shadow: 0 4px 15px rgba(37, 99, 235, 0.3);
    }

    /* STRANICA MOBILNE STATISTIKE */
    .mobile-stats-page { padding: 12px; }
    
    .mobile-stats-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        margin-bottom: 20px;
        padding: 4px;
    }

    .mobile-stats-header h2 { font-size: 18px; font-weight: 600; }

    .back-btn {
        color: #3b82f6;
        text-decoration: none;
        font-weight: 600;
        font-size: 15px;
        display: flex;
        align-items: center;
        gap: 4px;
    }
}