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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

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

header {
    background: white;
    padding: 20px 30px;
    border-radius: 10px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

header h1 {
    color: #333;
    font-size: 28px;
}

.connection-status {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 16px;
    color: #666;
}

.status-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    animation: pulse 2s infinite;
}

.status-dot.connected {
    background-color: #10b981;
    box-shadow: 0 0 10px rgba(16, 185, 129, 0.5);
}

.status-dot.disconnected {
    background-color: #ef4444;
    box-shadow: 0 0 10px rgba(239, 68, 68, 0.5);
    animation: none;
}

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

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
}

.card {
    background: white;
    padding: 25px;
    border-radius: 10px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.card.full-width {
    grid-column: 1 / -1;
}

.card h2 {
    color: #333;
    margin-bottom: 20px;
    font-size: 20px;
    border-bottom: 2px solid #667eea;
    padding-bottom: 10px;
}

/* Status Card */
.status-content {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.status-item {
    display: flex;
    justify-content: space-between;
    padding: 10px;
    background: #f3f4f6;
    border-radius: 5px;
}

.status-item .label {
    font-weight: 600;
    color: #666;
}

.status-item .value {
    color: #333;
    font-family: 'Courier New', monospace;
}

/* Temperature Card */
.temperature-display {
    display: flex;
    align-items: baseline;
    justify-content: center;
    margin: 20px 0;
}

.big-value {
    font-size: 48px;
    font-weight: bold;
    color: #667eea;
}

.unit {
    font-size: 24px;
    color: #999;
    margin-left: 5px;
}

.chart-placeholder {
    margin-top: 20px;
    text-align: center;
}

#tempChart {
    max-width: 100%;
    height: auto;
}

/* LED Control Card */
.control-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.led-status {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.led-light {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    border: 3px solid #ddd;
    transition: all 0.3s ease;
}

.led-light.on {
    background: radial-gradient(circle, #fbbf24, #f59e0b);
    box-shadow: 0 0 30px rgba(251, 191, 36, 0.8);
    border-color: #f59e0b;
}

.led-light.off {
    background: #e5e7eb;
}

#led-status-text {
    font-size: 18px;
    font-weight: bold;
    color: #666;
}

/* Button Status Card */
.button-status {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
}

.button-panel {
    width: 120px;
    height: 120px;
    border-radius: 10px;
    border: 3px solid #ddd;
    transition: all 0.3s ease;
}

.button-panel.idle {
    background: linear-gradient(135deg, #e5e7eb 0%, #d1d5db 100%);
}

.button-panel.pressed {
    background: linear-gradient(135deg, #34d399 0%, #10b981 100%);
    box-shadow: 0 0 30px rgba(52, 211, 153, 0.8);
    border-color: #10b981;
}

.button-panel.released {
    background: linear-gradient(135deg, #60a5fa 0%, #3b82f6 100%);
    box-shadow: 0 0 30px rgba(96, 165, 250, 0.6);
    border-color: #3b82f6;
}

#button-status-text {
    font-size: 18px;
    font-weight: bold;
    color: #666;
}

.button-group {
    display: flex;
    gap: 10px;
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 5px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.btn:active {
    transform: translateY(0);
}

.btn-success {
    background-color: #10b981;
    color: white;
}

.btn-success:hover {
    background-color: #059669;
}

.btn-danger {
    background-color: #ef4444;
    color: white;
}

.btn-danger:hover {
    background-color: #dc2626;
}

.btn-secondary {
    background-color: #6b7280;
    color: white;
}

.btn-secondary:hover {
    background-color: #4b5563;
}

/* Moisture Gauges */
.moisture-gauge {
    width: 200px;
    height: 200px;
    border-radius: 50%;
    border: 10px solid #e5e7eb;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin: 20px auto;
    transition: all 0.5s ease;
}

.moisture-gauge-small {
    width: 120px;
    height: 120px;
    border: 8px solid #e5e7eb;
}

.moisture-gauge.dry {
    border-color: #ef4444;
    background: radial-gradient(circle, #fca5a5, #fee2e2);
}

.moisture-gauge.medium {
    border-color: #f59e0b;
    background: radial-gradient(circle, #fcd34d, #fef3c7);
}

.moisture-gauge.wet {
    border-color: #10b981;
    background: radial-gradient(circle, #6ee7b7, #d1fae5);
}

.moisture-percentage-small {
    font-size: 36px;
    font-weight: bold;
    color: #333;
}

.moisture-label-small {
    font-size: 14px;
    color: #666;
    margin-top: 2px;
}

/* Message Log */
.log-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.log-controls label {
    display: flex;
    align-items: center;
    gap: 5px;
    color: #666;
}

.message-log {
    background: #1f2937;
    color: #10b981;
    font-family: 'Courier New', monospace;
    font-size: 13px;
    padding: 15px;
    border-radius: 5px;
    height: 300px;
    overflow-y: auto;
    line-height: 1.6;
}

.message-log::-webkit-scrollbar {
    width: 8px;
}

.message-log::-webkit-scrollbar-track {
    background: #111827;
}

.message-log::-webkit-scrollbar-thumb {
    background: #4b5563;
    border-radius: 4px;
}

.log-entry {
    margin-bottom: 5px;
}

.log-entry .timestamp {
    color: #6b7280;
}

.log-entry .topic {
    color: #3b82f6;
}

.log-entry .message {
    color: #10b981;
}

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

    .dashboard-grid {
        grid-template-columns: 1fr;
    }

    .button-group {
        flex-direction: column;
        width: 100%;
    }

    .btn {
        width: 100%;
    }
}
