/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Color Palette */
    --primary-600: #7c3aed;
    --primary-500: #8b5cf6;
    --primary-400: #a78bfa;
    --primary-300: #c4b5fd;
    --accent-500: #06b6d4;
    --accent-400: #22d3ee;
    --success-500: #10b981;
    --warning-500: #f59e0b;
    --error-500: #ef4444;

    /* Light Theme */
    --bg-primary: #f8fafc;
    --bg-secondary: #ffffff;
    --bg-tertiary: #f1f5f9;
    --bg-elevated: #e2e8f0;

    /* Text Colors */
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-tertiary: #64748b;

    /* Borders */
    --border-color: #e2e8f0;
    --border-accent: rgba(139, 92, 246, 0.2);
    --border-radius: 12px;

    /* Shadows */
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.07), 0 2px 4px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1), 0 4px 6px rgba(0, 0, 0, 0.05);
    --shadow-glow: 0 0 20px rgba(139, 92, 246, 0.15);
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    min-height: 100vh;
    overflow-x: hidden;
}

.app-container {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    width: 100%;
}

/* Header */
.header {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    padding: 0.875rem 2rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(10px);
}

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

.logo-section {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.header h1 {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

.separator {
    color: var(--border-color);
    font-weight: 300;
    font-size: 1.25rem;
}

.subtitle {
    font-size: 0.813rem;
    color: var(--text-tertiary);
    font-weight: 400;
}

.header-actions {
    display: flex;
    gap: 0.75rem;
}

/* Buttons */
.btn-primary,
.btn-secondary,
.btn-icon,
.btn-text {
    border: none;
    cursor: pointer;
    font-family: inherit;
    font-weight: 500;
    transition: all var(--transition-normal);
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-600), var(--primary-500));
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-size: 0.875rem;
    box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-glow);
}

.btn-primary svg {
    width: 18px;
    height: 18px;
}

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    padding: 0.75rem 1.25rem;
    border-radius: 8px;
    font-size: 0.875rem;
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: var(--bg-elevated);
    border-color: var(--primary-400);
}

.btn-secondary svg {
    width: 18px;
    height: 18px;
}

.btn-icon {
    background: transparent;
    color: var(--text-secondary);
    padding: 0.5rem;
    border-radius: 6px;
}

.btn-icon:hover {
    background: var(--bg-tertiary);
    color: var(--primary-500);
}

.btn-icon svg {
    width: 20px;
    height: 20px;
}

.btn-text {
    background: transparent;
    color: var(--primary-500);
    padding: 0.5rem;
    font-size: 0.875rem;
}

.btn-text:hover {
    color: var(--primary-600);
}

.btn-large {
    width: 100%;
    padding: 1rem;
    font-size: 1rem;
    justify-content: center;
}

.btn-sim {
    padding: 0.75rem 1.5rem;
    font-size: 0.9375rem;
    font-weight: 600;
}

.btn-sim svg {
    width: 20px;
    height: 20px;
}

/* Instructions Box */
.instructions-container {
    max-width: 1800px;
    margin: 0 auto;
    padding: 1.5rem 2rem 0;
    animation: slideIn 0.4s ease-out;
}

.instructions-content {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.08) 0%, rgba(6, 182, 212, 0.08) 100%);
    border: 1px solid var(--border-accent);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
}

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

.instructions-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.instructions-actions {
    display: flex;
    gap: 0.5rem;
}

.instructions-icon {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, var(--primary-600), var(--primary-400));
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    flex-shrink: 0;
}

.instructions-icon svg {
    width: 18px;
    height: 18px;
}

.instructions-header h3 {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
    flex: 1;
    margin: 0;
}

.instructions-steps {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 0.75rem;
    overflow: hidden;
    transition: all 0.4s ease-in-out;
    opacity: 1;
    max-height: 1000px;
}

.instructions-steps.collapsed {
    max-height: 0 !important;
    opacity: 0 !important;
    margin-top: 0 !important;
    gap: 0 !important;
    pointer-events: none;
}

.instruction-step {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: white;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    transition: all var(--transition-fast);
}

.instruction-step:hover {
    transform: translateX(4px);
    border-color: var(--primary-400);
    box-shadow: var(--shadow-sm);
}

.step-number {
    width: 28px;
    height: 28px;
    background: linear-gradient(135deg, var(--primary-600), var(--primary-500));
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.875rem;
    font-weight: 700;
    flex-shrink: 0;
}

.step-text {
    font-size: 0.875rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

.instructions-container.hidden {
    display: none;
}

/* Main Content */
.main-content {
    flex: 1;
    max-width: 1800px;
    margin: 0 auto;
    padding: 2rem;
    display: grid;
    grid-template-columns: 380px 1fr 400px;
    gap: 1.5rem;
    width: 100%;
}

/* Panels */
.panel {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    box-shadow: var(--shadow-md);
    display: flex;
    flex-direction: column;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.panel-header h2 {
    font-size: 1.25rem;
    font-weight: 600;
}

/* Config Panel */
.config-panel {
    overflow-y: auto;
    max-height: calc(100vh - 140px);
}

.config-section {
    margin-bottom: 2rem;
}

.section-title {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--text-secondary);
}

.config-label {
    display: block;
    margin-bottom: 1rem;
}

.label-text {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.tooltip-icon {
    cursor: help;
    color: var(--primary-500);
    font-size: 0.875rem;
}

/* Device Selector */
.device-selector {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}

.device-card {
    background: var(--bg-tertiary);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    padding: 1rem;
    cursor: pointer;
    transition: all var(--transition-normal);
    text-align: center;
}

.device-card:hover {
    border-color: var(--primary-400);
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}

.device-card.active {
    background: linear-gradient(135deg, rgba(124, 58, 237, 0.1), rgba(139, 92, 246, 0.05));
    border-color: var(--primary-500);
    box-shadow: var(--shadow-glow);
}

.device-icon {
    font-size: 1.25rem;
    font-weight: 700;
    font-family: 'JetBrains Mono', monospace;
    margin-bottom: 0.5rem;
    color: var(--primary-600);
}

.device-specs {
    font-size: 0.75rem;
    color: var(--text-tertiary);
}

/* Input Groups */
.input-group {
    margin-bottom: 1.25rem;
}

.input-group label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.input-with-action {
    display: flex;
    gap: 0.5rem;
}

input[type="text"],
.select-input {
    width: 100%;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 0.75rem;
    color: var(--text-primary);
    font-size: 0.875rem;
    font-family: inherit;
    transition: all var(--transition-fast);
}

input[type="text"]:focus,
.select-input:focus {
    outline: none;
    border-color: var(--primary-500);
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.1);
}

.mono-input {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.8rem;
}

/* Slider */
.slider {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: var(--bg-elevated);
    outline: none;
    -webkit-appearance: none;
    appearance: none;
}

.slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--primary-500);
    cursor: pointer;
    box-shadow: var(--shadow-sm);
}

.slider::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--primary-500);
    cursor: pointer;
    border: none;
}

.range-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    color: var(--text-tertiary);
    margin-top: 0.5rem;
}

/* Toggle Switch */
.toggle-switch {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
    padding: 0.75rem;
    border-radius: 6px;
    transition: background var(--transition-fast);
}

.toggle-switch:hover {
    background: var(--bg-tertiary);
}

.toggle-switch input {
    display: none;
}

.toggle-slider {
    position: relative;
    width: 44px;
    height: 24px;
    background: var(--bg-elevated);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    transition: all var(--transition-normal);
}

.toggle-slider::before {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: white;
    top: 2px;
    left: 2px;
    transition: all var(--transition-normal);
    box-shadow: var(--shadow-sm);
}

.toggle-switch input:checked+.toggle-slider {
    background: var(--primary-500);
    border-color: var(--primary-500);
}

.toggle-switch input:checked+.toggle-slider::before {
    transform: translateX(20px);
}

.toggle-label {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.sensor-toggles {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

/* Status Badge */
.status-badge {
    padding: 0.375rem 0.75rem;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    background: var(--bg-tertiary);
    color: var(--text-tertiary);
    border: 1px solid var(--border-color);
}

.status-badge.active {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success-500);
    border-color: var(--success-500);
}

/* Network Visualization */
.visualization-panel {
    position: relative;
}

.network-canvas {
    flex: 1;
    position: relative;
    background: linear-gradient(135deg, #fafbff 0%, #f0f4ff 100%);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 2rem;
    min-height: 400px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1.5rem;
}

.esp-display {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.esp-image-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
    animation: fadeIn 0.5s ease;
}

.esp-image {
    max-width: 100%;
    max-height: 450px;
    width: auto;
    height: auto;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.esp-image:hover {
    transform: scale(1.02);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.15);
}

.esp-label {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
    text-align: center;
    padding: 0.75rem 1.5rem;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: var(--shadow-sm);
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.network-node {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    position: relative;
    z-index: 2;
}

.node-icon {
    width: 80px;
    height: 80px;
    background: white;
    border: 2px solid var(--border-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary-500);
    transition: all var(--transition-normal);
    box-shadow: var(--shadow-sm);
}

.node-icon svg {
    width: 40px;
    height: 40px;
}

.device-node .node-icon {
    border-color: var(--primary-500);
    box-shadow: 0 0 20px rgba(124, 58, 237, 0.2);
}

.gateway-node .node-icon {
    border-color: var(--accent-500);
    color: var(--accent-500);
}

.server-node .node-icon,
.app-node .node-icon {
    border-color: var(--success-500);
    color: var(--success-500);
}

.node-label {
    font-size: 0.875rem;
    font-weight: 600;
    text-align: center;
}

.node-sublabel {
    font-size: 0.75rem;
    color: var(--text-tertiary);
}

.connection-lines {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

.connection-line {
    fill: none;
    stroke: rgba(139, 92, 246, 0.3);
    stroke-width: 2;
    stroke-dasharray: 5, 5;
}

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

/* Transmission Log */
.transmission-log {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
}

.log-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border-color);
}

.log-header h3 {
    font-size: 0.875rem;
    font-weight: 600;
}

.log-content {
    max-height: 200px;
    overflow-y: auto;
    padding: 0.75rem;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.75rem;
    background: var(--bg-primary);
}

.log-entry {
    display: flex;
    gap: 0.75rem;
    padding: 0.5rem;
    border-radius: 4px;
    margin-bottom: 0.25rem;
}

.log-time {
    color: var(--text-tertiary);
    flex-shrink: 0;
}

.log-message {
    color: var(--text-secondary);
}

.log-info {
    background: rgba(6, 182, 212, 0.08);
    border-left: 3px solid var(--accent-500);
}

.log-success {
    background: rgba(16, 185, 129, 0.08);
    border-left: 3px solid var(--success-500);
}

.log-warning {
    background: rgba(245, 158, 11, 0.08);
    border-left: 3px solid var(--warning-500);
}

.log-error {
    background: rgba(239, 68, 68, 0.08);
    border-left: 3px solid var(--error-500);
}

/* Dashboard */
.dashboard-panel {
    overflow-y: auto;
    max-height: calc(100vh - 140px);
}

.data-count {
    font-size: 0.875rem;
    color: var(--text-tertiary);
}

.readings-grid {
    display: grid;
    gap: 1rem;
    margin-bottom: 2rem;
}

.reading-card {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1.25rem;
    display: flex;
    gap: 1rem;
    align-items: flex-start;
    transition: all var(--transition-fast);
}

.reading-card:hover {
    box-shadow: var(--shadow-sm);
    transform: translateY(-1px);
}

.reading-icon {
    width: 48px;
    height: 48px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.reading-icon svg {
    width: 24px;
    height: 24px;
}

.temp-icon {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

.humidity-icon {
    background: rgba(6, 182, 212, 0.1);
    color: #06b6d4;
}

.pressure-icon {
    background: rgba(139, 92, 246, 0.1);
    color: var(--primary-500);
}

.light-icon {
    background: rgba(245, 158, 11, 0.1);
    color: #f59e0b;
}

.reading-info {
    flex: 1;
}

.reading-label {
    font-size: 0.875rem;
    color: var(--text-tertiary);
    margin-bottom: 0.25rem;
}

.reading-value {
    font-size: 2rem;
    font-weight: 700;
    font-family: 'JetBrains Mono', monospace;
    line-height: 1;
}

.reading-unit {
    font-size: 0.875rem;
    color: var(--text-tertiary);
    margin-top: 0.25rem;
}

/* Stats */
.stats-section {
    margin-bottom: 2rem;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

.stat-item {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1rem;
}

.stat-label {
    font-size: 0.75rem;
    color: var(--text-tertiary);
    margin-bottom: 0.5rem;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    font-family: 'JetBrains Mono', monospace;
    color: var(--primary-600);
}

/* Packet Details */
.packet-details {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1.25rem;
}

.packet-info {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.875rem;
}

.info-label {
    color: var(--text-tertiary);
}

.info-value {
    color: var(--text-primary);
    font-weight: 500;
}

.mono {
    font-family: 'JetBrains Mono', monospace;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(5px);
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.modal-body {
    padding: 1.5rem;
}

.modal-body h3 {
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
    color: var(--primary-600);
}

.modal-body h3:first-child {
    margin-top: 0;
}

.modal-body p,
.modal-body li {
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 0.75rem;
}

.modal-body ol,
.modal-body ul {
    padding-left: 1.5rem;
}

/* Animations */
@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideOut {
    from {
        opacity: 1;
        transform: translateY(0);
    }

    to {
        opacity: 0;
        transform: translateY(-10px);
    }
}

.signal-indicator {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--success-500);
    animation: pulse 2s infinite;
    box-shadow: 0 0 10px var(--success-500);
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-tertiary);
}

::-webkit-scrollbar-thumb {
    background: var(--bg-elevated);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary-400);
}

/* Responsive Design */
@media (max-width: 1400px) {
    .main-content {
        grid-template-columns: 1fr;
        gap: 1.5rem;
        padding: 1.5rem;
    }

    .network-canvas {
        grid-template-columns: repeat(2, 1fr);
        grid-template-rows: repeat(2, 1fr);
    }

    .instructions-steps {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 1024px) {
    .main-content {
        grid-template-columns: 1fr;
        padding: 1rem;
    }

    .header {
        padding: 0.75rem 1rem;
    }

    .header h1 {
        font-size: 1rem;
    }

    .subtitle {
        display: none;
    }

    .panel {
        padding: 1rem;
    }

    .instructions-steps {
        grid-template-columns: repeat(2, 1fr);
    }

    .readings-grid {
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .network-canvas {
        min-height: 300px;
    }
}

@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        gap: 0.75rem;
        align-items: flex-start;
    }

    .header-actions {
        width: 100%;
        justify-content: space-between;
    }

    .main-content {
        padding: 0.75rem;
        gap: 1rem;
    }

    .panel {
        padding: 0.875rem;
    }

    .device-selector {
        flex-direction: column;
    }

    .device-card {
        width: 100%;
    }

    .config-section {
        margin-bottom: 1rem;
    }

    .stats-grid {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }

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

    .network-canvas {
        min-height: 250px;
    }

    .esp-image {
        max-height: 300px;
    }

    .log-content {
        max-height: 200px;
    }

    .instructions-container {
        margin: 0.75rem;
    }
}

@media (max-width: 480px) {
    .header {
        padding: 0.5rem 0.75rem;
    }

    .header h1 {
        font-size: 0.875rem;
    }

    .logo-section {
        gap: 0.5rem;
    }

    .main-content {
        padding: 0.5rem;
    }

    .panel {
        padding: 0.75rem;
    }

    .panel-header h2 {
        font-size: 1rem;
    }

    .config-label {
        font-size: 0.813rem;
    }

    .btn-primary,
    .btn-secondary {
        padding: 0.5rem 1rem;
        font-size: 0.813rem;
    }

    .device-card {
        padding: 0.75rem;
    }

    .device-icon {
        font-size: 0.875rem;
    }

    .input-field {
        font-size: 0.75rem;
        padding: 0.5rem;
    }

    .stat-item {
        padding: 0.75rem;
    }

    .stat-value {
        font-size: 1.25rem;
    }

    .reading-card {
        padding: 0.875rem;
    }

    .reading-value {
        font-size: 1.5rem;
    }

    .network-canvas {
        min-height: 200px;
    }

    .esp-image {
        max-height: 250px;
    }

    .instructions-container {
        margin: 0.5rem;
    }

    .instruction-step {
        padding: 0.5rem 0.75rem;
        font-size: 0.813rem;
    }

    .step-number {
        width: 1.75rem;
        height: 1.75rem;
        font-size: 0.75rem;
    }
}