/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
        'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
        sans-serif;
    background: linear-gradient(135deg, #ffffff 40%, #d10a11 100%);
    min-height: 100vh;
    padding: 20px;
    color: #333;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    overflow: hidden;
}

/* Header */
header {
    background: linear-gradient(135deg, #ffffff 40%, #d10a11 100%);
    padding: 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

header h1 {
    font-size: 2em;
    font-weight: 600;
}

.connection-status {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.9em;
}

.indicator {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    display: inline-block;
}

.indicator.connected {
    background: #10b981;
    box-shadow: 0 0 8px #10b981;
}

.indicator.disconnected {
    background: #ef4444;
    box-shadow: 0 0 8px #ef4444;
}

/* Main content */
main {
    padding: 30px;
}

.controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.btn {
    background: #d10a11;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    font-size: 1em;
    cursor: pointer;
    transition: background 0.3s ease;
}

.btn:hover {
    background: #e06165;
}

.btn:active {
    transform: scale(0.98);
}

#device-count {
    font-weight: 600;
    color: #d10a11;
}

/* Table */
.table-container {
    overflow-x: auto;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
}

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

thead {
    background: #f9fafb;
}

th {
    padding: 15px;
    text-align: left;
    font-weight: 600;
    border-bottom: 2px solid #e5e7eb;
    font-size: 0.9em;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

tbody tr {
    border-bottom: 1px solid #e5e7eb;
    transition: background 0.3s ease, opacity 0.3s ease;
}

/* Alive devices - pleasant green background */
tbody tr.alive {
    background: #d1fae5;
}

tbody tr.alive:hover {
    background: #a7f3d0;
}

/* Stale devices - red background and greyed out */
tbody tr.stale {
    background: #fee2e2;
    opacity: 0.6;
}

tbody tr.stale:hover {
    background: #fecaca;
    opacity: 0.7;
}

td {
    padding: 15px;
    font-size: 0.95em;
}

td.device-id {
    font-family: 'Courier New', monospace;
    font-weight: 600;
    color: #d10a11;
}

td.ip-address {
    font-family: 'Courier New', monospace;
    color: #6b7280;
}

td.timestamp {
    color: #6b7280;
    font-size: 0.9em;
}

td.temperature {
    font-family: 'Courier New', monospace;
    font-weight: 500;
}

/* No data message */
.no-data {
    text-align: center;
    padding: 60px 20px;
    color: #6b7280;
}

.no-data p {
    font-size: 1.1em;
    margin-bottom: 10px;
}

.no-data .hint {
    font-size: 0.9em;
    color: #9ca3af;
}

.no-data.hidden {
    display: none;
}

/* Footer */
footer {
    padding: 20px 30px;
    background: #f9fafb;
    border-top: 1px solid #e5e7eb;
    text-align: center;
    color: #6b7280;
    font-size: 0.9em;
}

#last-update {
    font-weight: 600;
    color: #374151;
}

/* Responsive design */
@media (max-width: 768px) {
    header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }

    header h1 {
        font-size: 1.5em;
    }

    .controls {
        flex-direction: column;
        gap: 15px;
    }

    th, td {
        padding: 10px;
        font-size: 0.85em;
    }

    table {
        font-size: 0.9em;
    }
}

/* Loading animation */
@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

.loading {
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

