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

body {
    font-family: 'Segoe UI', sans-serif;
    background: #0f172a;
    color: #e2e8f0;
    min-height: 100vh;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 24px;
}

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

header h1 {
    font-size: 1.8rem;
    font-weight: 700;
    color: #f1f5f9;
}

.status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    color: #94a3b8;
}

.dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #64748b;
}

.dot.connected {
    background: #22c55e;
    box-shadow: 0 0 8px #22c55e;
    animation: pulse 2s infinite;
}

.dot.error {
    background: #ef4444;
}

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

main {
    display: grid;
    grid-template-columns: 1fr 2fr;
    grid-template-rows: auto auto auto;
    gap: 20px;
}

.card {
    background: #1e293b;
    border: 1px solid #334155;
    border-radius: 12px;
    padding: 24px;
    transition: border-color 0.3s;
}

.card h3 {
    font-size: 0.9rem;
    font-weight: 600;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 16px;
}

/* Temperature Card */
.temperature-card {
    grid-column: 1;
    grid-row: 1;
    text-align: center;
    border-color: #22c55e;
}

.temperature-card .label {
    font-size: 0.85rem;
    color: #94a3b8;
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.temperature-card .value {
    font-size: 4rem;
    font-weight: 800;
    color: #22c55e;
    line-height: 1;
    margin-bottom: 12px;
    transition: color 0.5s;
}

.temperature-card .timestamp {
    font-size: 0.75rem;
    color: #64748b;
}

.temperature-card.warm {
    border-color: #f59e0b;
}

.temperature-card.warm .value {
    color: #f59e0b;
}

.temperature-card.hot {
    border-color: #ef4444;
    background: #1e1010;
    animation: alert-pulse 1s infinite;
}

.temperature-card.hot .value {
    color: #ef4444;
}

@keyframes alert-pulse {
    0%, 100% { border-color: #ef4444; }
    50% { border-color: #7f1d1d; }
}

/* Chart Card */
.chart-card {
    grid-column: 2;
    grid-row: 1 / 3;
}

.chart-card canvas {
    max-height: 280px;
}

/* Controls Card */
.controls-card {
    grid-column: 1;
    grid-row: 2;
}

.controls-card h3 {
    margin-bottom: 16px;
}

.btn {
    display: block;
    width: 100%;
    padding: 12px 16px;
    border: none;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    margin-bottom: 10px;
    transition: all 0.2s;
}

.btn-led {
    background: #1e3a5f;
    color: #93c5fd;
    border: 1px solid #2563eb;
}

.btn-led:hover {
    background: #2563eb;
    color: #fff;
}

.btn-led.active {
    background: #2563eb;
    color: #fff;
    box-shadow: 0 0 16px #2563eb80;
}

.btn-buzzer {
    background: #3b1f5e;
    color: #c4b5fd;
    border: 1px solid #7c3aed;
}

.btn-buzzer:hover {
    background: #7c3aed;
    color: #fff;
}

.btn-buzzer.active {
    background: #7c3aed;
    color: #fff;
    box-shadow: 0 0 16px #7c3aed80;
}

.btn-tv {
    background: #1a2e1a;
    color: #4ade80;
    border: 1px solid #22c55e;
    margin-top: 8px;
}

.btn-tv:hover {
    background: #22c55e;
    color: #0f172a;
}

/* Data Table */
.data-table {
    grid-column: 1 / 3;
    grid-row: 3;
}

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

thead th {
    text-align: left;
    padding: 10px 12px;
    font-size: 0.8rem;
    font-weight: 600;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid #334155;
}

tbody td {
    padding: 10px 12px;
    font-size: 0.9rem;
    border-bottom: 1px solid #1e293b;
    color: #cbd5e1;
}

tbody tr:hover {
    background: #0f172a;
}

tbody tr:last-child td {
    border-bottom: none;
}

.temp-value {
    font-weight: 600;
}

.temp-normal { color: #22c55e; }
.temp-warm { color: #f59e0b; }
.temp-hot { color: #ef4444; }

@media (max-width: 768px) {
    main {
        grid-template-columns: 1fr;
    }
    .chart-card {
        grid-column: 1;
        grid-row: 2;
    }
    .controls-card {
        grid-row: 3;
    }
    .data-table {
        grid-column: 1;
        grid-row: 4;
    }
}
