/* ==========================================================================
   ATECHNO EMBEDDED SOLUTION — 7-IN-1 SOIL INTEGRATED RS485 SENSOR STYLESHEET
   Aesthetics: Cyber-AgTech Dark Mode, Glassmorphism, Dynamic Micro-Animations
   Target Hardware: 7-in-1 NPK, pH, EC, Temp, Humidity Soil Sensor + Arduino UNO
   ========================================================================== */

:root {
    /* Color Palette */
    --bg-dark: #05070c;
    --bg-card: rgba(13, 19, 33, 0.82);
    --bg-card-hover: rgba(22, 32, 54, 0.9);
    --border-color: rgba(255, 255, 255, 0.08);
    --border-highlight: rgba(6, 182, 212, 0.35);
    --border-danger: rgba(239, 68, 68, 0.35);

    /* Text Colors */
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --text-dim: #64748b;

    /* ATECHNO Accent & State Colors */
    --emerald-500: #10b981;
    --emerald-400: #34d399;

    --cyan-500: #06b6d4;
    --cyan-400: #22d3ee;

    --blue-500: #3b82f6;
    --blue-600: #2563eb;

    --amber-500: #f59e0b;
    --amber-400: #fbbf24;
    
    --rose-500: #ef4444;
    --rose-400: #f87171;
    --rose-glow: rgba(239, 68, 68, 0.25);

    /* Typography */
    --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;

    /* Shadows & Effects */
    --shadow-glass: 0 8px 32px 0 rgba(0, 0, 0, 0.55);
    --glow-danger: 0 0 30px rgba(239, 68, 68, 0.15);
    --glow-brand: 0 0 30px rgba(6, 182, 212, 0.15);
    --transition-standard: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    font-family: var(--font-sans);
    min-height: 100vh;
    overflow-x: hidden;
    line-height: 1.5;
    position: relative;
}

/* Typography Helpers */
.font-mono { font-family: var(--font-mono); }
.tech-mono { font-family: var(--font-mono); font-size: 0.85rem; letter-spacing: 0.5px; }
.highlight { color: var(--cyan-400); font-weight: 600; }
.text-danger { color: var(--rose-400) !important; }
.text-warning { color: var(--amber-400) !important; }
.text-success { color: var(--emerald-400) !important; }

/* Background Overlay & Ambient Glows */
.bg-grid-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-image: 
        linear-gradient(to right, rgba(255, 255, 255, 0.025) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(255, 255, 255, 0.025) 1px, transparent 1px);
    background-size: 40px 40px;
    pointer-events: none;
    z-index: 0;
}

.ambient-glow {
    position: fixed;
    width: 600px;
    height: 600px;
    border-radius: 50%;
    filter: blur(140px);
    pointer-events: none;
    z-index: 0;
    opacity: 0.4;
}

.glow-1 {
    top: -200px;
    right: -100px;
    background: radial-gradient(circle, rgba(239, 68, 68, 0.25) 0%, transparent 70%);
}

.glow-2 {
    bottom: -200px;
    left: -100px;
    background: radial-gradient(circle, rgba(6, 182, 212, 0.2) 0%, transparent 70%);
}

/* Glassmorphism Panel */
.glass-panel {
    background: var(--bg-card);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    box-shadow: var(--shadow-glass);
    transition: var(--transition-standard);
}

/* ==========================================================================
   NAVIGATION BAR
   ========================================================================== */
.top-nav {
    position: relative;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.9rem 2rem;
    background: rgba(5, 7, 12, 0.92);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 0.85rem;
}

.brand-logo-img {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    background: #ffffff;
    padding: 3px;
    border: 1px solid var(--border-highlight);
    box-shadow: 0 0 15px rgba(6, 182, 212, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.brand-logo-img img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.brand-text {
    display: flex;
    flex-direction: column;
}

.brand-title {
    font-weight: 800;
    font-size: 1.15rem;
    letter-spacing: 1px;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.brand-tag {
    font-size: 0.65rem;
    background: rgba(6, 182, 212, 0.15);
    color: var(--cyan-400);
    padding: 2px 8px;
    border-radius: 4px;
    border: 1px solid rgba(6, 182, 212, 0.4);
    font-family: var(--font-mono);
    font-weight: 700;
}

.brand-subtitle {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.nav-center .location-badge {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.75rem;
    color: var(--text-muted);
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    padding: 0.4rem 0.8rem;
    border-radius: 20px;
    font-family: var(--font-mono);
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 1.25rem;
}

.node-id {
    font-size: 0.8rem;
    font-family: var(--font-mono);
}

.node-id .label { color: var(--text-dim); }
.node-id .value { color: var(--cyan-400); font-weight: 600; }

.system-status-pill {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.35rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
    font-family: var(--font-mono);
    letter-spacing: 0.5px;
}

.system-status-pill.status-loading {
    background: rgba(245, 158, 11, 0.15);
    border: 1px solid rgba(245, 158, 11, 0.3);
    color: var(--amber-400);
}

.system-status-pill.status-error {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.4);
    color: var(--rose-400);
    box-shadow: 0 0 12px rgba(239, 68, 68, 0.2);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: currentColor;
    animation: statusPulse 1.5s infinite;
}

@keyframes statusPulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.4; transform: scale(0.85); }
}

.clock-display {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* ==========================================================================
   APP VIEWPORT & STATES
   ========================================================================== */
.app-viewport {
    position: relative;
    z-index: 1;
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
}

.state-container {
    display: none;
    opacity: 0;
    transition: opacity 0.4s ease, transform 0.4s ease;
}

.state-container.active {
    display: block;
    opacity: 1;
    animation: fadeInState 0.5s ease forwards;
}

@keyframes fadeInState {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ==========================================================================
   PHASE 1: LOADING STATE
   ========================================================================== */
#loadingState {
    max-width: 820px;
    margin: 1.5rem auto;
}

.loader-card {
    padding: 2.25rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.75rem;
    border: 1px solid var(--border-highlight);
    box-shadow: var(--glow-brand);
}

/* ATECHNO Loader Brand Badge Header */
.loader-brand-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.4rem;
}

.loader-logo-badge {
    width: 64px;
    height: 64px;
    border-radius: 14px;
    background: #ffffff;
    padding: 5px;
    border: 2px solid var(--cyan-400);
    box-shadow: 0 0 25px rgba(6, 182, 212, 0.4);
}

.loader-brand-title {
    font-size: 0.85rem;
    font-weight: 800;
    letter-spacing: 1.5px;
    color: var(--cyan-400);
}

.loader-brand-sub {
    font-size: 0.7rem;
    font-family: var(--font-mono);
    color: var(--text-dim);
}

/* Scanner Radar Visual */
.scanner-visual {
    position: relative;
    width: 160px;
    height: 160px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.radar-rings {
    position: absolute;
    inset: 0;
}

.ring {
    position: absolute;
    border-radius: 50%;
    border: 1px solid rgba(6, 182, 212, 0.25);
    inset: 0;
}

.ring-1 { inset: 0; }
.ring-2 { inset: 20px; }
.ring-3 { inset: 40px; }

.radar-sweep {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: conic-gradient(from 0deg, transparent 0deg, transparent 270deg, rgba(6, 182, 212, 0.4) 360deg);
    animation: sweepSpin 2.5s linear infinite;
}

@keyframes sweepSpin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.probe-graphic {
    position: relative;
    z-index: 2;
    width: 90px;
    height: 90px;
}

.soil-probe-svg {
    width: 100%;
    height: 100%;
}

.probe-ping {
    position: absolute;
    top: 30%;
    left: 50%;
    width: 16px;
    height: 16px;
    background: var(--cyan-400);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    animation: pingRing 1.5s cubic-bezier(0, 0, 0.2, 1) infinite;
}

@keyframes pingRing {
    75%, 100% {
        transform: translate(-50%, -50%) scale(4);
        opacity: 0;
    }
}

.loader-content {
    width: 100%;
    text-align: center;
}

.loader-title {
    font-size: 1.25rem;
    font-weight: 800;
    letter-spacing: 1.5px;
    color: var(--text-main);
    margin-bottom: 0.5rem;
}

.loader-subtitle {
    font-size: 0.9rem;
    color: var(--cyan-400);
    font-family: var(--font-mono);
    margin-bottom: 1.5rem;
}

.progress-bar-container {
    position: relative;
    width: 100%;
    height: 10px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid var(--border-color);
    margin-bottom: 0.75rem;
}

.progress-bar-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--emerald-500), var(--cyan-500), var(--blue-500));
    border-radius: 10px;
    transition: width 0.3s ease-out;
}

.progress-meta {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    color: var(--text-muted);
    font-family: var(--font-mono);
}

/* Gauge Matrix */
.depth-gauge {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
    margin-top: 1.5rem;
    width: 100%;
}

.depth-level {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    padding: 0.6rem 0.8rem;
    border-radius: 8px;
    text-align: left;
    transition: var(--transition-standard);
}

.depth-level.active {
    border-color: var(--cyan-400);
    background: rgba(6, 182, 212, 0.08);
}

.depth-label {
    display: block;
    font-size: 0.7rem;
    color: var(--text-muted);
    font-weight: 700;
}

.depth-status {
    display: block;
    font-size: 0.75rem;
    font-family: var(--font-mono);
    color: var(--cyan-400);
    margin-top: 2px;
}

/* Boot Console Terminal */
.boot-terminal-box {
    width: 100%;
    background: #04060a;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    overflow: hidden;
}

.terminal-header {
    background: rgba(255, 255, 255, 0.04);
    padding: 0.5rem 0.8rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    border-bottom: 1px solid var(--border-color);
}

.terminal-dots {
    display: flex;
    gap: 4px;
}

.dot { width: 8px; height: 8px; border-radius: 50%; }
.dot.red { background: var(--rose-500); }
.dot.yellow { background: var(--amber-500); }
.dot.green { background: var(--emerald-500); }

.terminal-title {
    font-size: 0.7rem;
    font-family: var(--font-mono);
    color: var(--text-dim);
}

.terminal-body {
    padding: 0.8rem;
    height: 120px;
    overflow-y: auto;
    font-family: var(--font-mono);
    font-size: 0.78rem;
    color: #a5f3fc;
    text-align: left;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.terminal-line { line-height: 1.4; }
.terminal-line.warn { color: var(--amber-400); }
.terminal-line.err { color: var(--rose-400); }

/* ==========================================================================
   PHASE 2: ERROR STATE & DASHBOARD
   ========================================================================== */
#errorState {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* Error Banner Card */
.error-banner {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 1.5rem;
    align-items: center;
    padding: 1.75rem 2rem;
    border: 1px solid var(--border-danger);
    box-shadow: var(--glow-danger);
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.08) 0%, rgba(13, 19, 33, 0.88) 100%);
}

.error-icon-wrapper {
    width: 56px;
    height: 56px;
    border-radius: 12px;
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--rose-400);
    animation: iconPulse 2s infinite;
}

@keyframes iconPulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4); }
    50% { box-shadow: 0 0 0 10px rgba(239, 68, 68, 0); }
}

.error-code-badge {
    display: inline-block;
    font-size: 0.75rem;
    font-family: var(--font-mono);
    font-weight: 700;
    color: var(--rose-400);
    background: rgba(239, 68, 68, 0.15);
    padding: 0.2rem 0.6rem;
    border-radius: 4px;
    margin-bottom: 0.4rem;
}

.error-main-title {
    font-size: 1.4rem;
    font-weight: 800;
    letter-spacing: 0.5px;
    color: var(--text-main);
}

.error-description {
    font-size: 0.88rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

.error-meta-box {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    background: rgba(0, 0, 0, 0.35);
    padding: 0.8rem 1rem;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    font-size: 0.75rem;
}

.meta-row { display: flex; justify-content: space-between; gap: 1.5rem; }
.meta-row .lbl { color: var(--text-dim); }
.meta-row .val { font-weight: 600; }

/* 7-in-1 Sensor Hardware Showcase Panel */
.sensor-spec-card {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 1.5rem;
    padding: 1.5rem;
    align-items: center;
    border: 1px solid var(--border-highlight);
    background: linear-gradient(135deg, rgba(6, 182, 212, 0.05), rgba(13, 19, 33, 0.9));
}

.spec-img-col {
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.4);
    padding: 1rem;
    border-radius: 12px;
    border: 1px solid var(--border-color);
}

.sensor-hardware-img {
    max-width: 100%;
    max-height: 180px;
    object-fit: contain;
    filter: drop-shadow(0 0 15px rgba(6, 182, 212, 0.3));
}

.spec-info-col { display: flex; flex-direction: column; gap: 0.6rem; }

.spec-badge {
    font-size: 0.65rem;
    font-family: var(--font-mono);
    font-weight: 700;
    color: var(--cyan-400);
    background: rgba(6, 182, 212, 0.15);
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
}

.spec-header h3 { font-size: 1.1rem; font-weight: 800; color: var(--text-main); margin-top: 4px; }
.spec-intro { font-size: 0.82rem; color: var(--text-muted); }

.spec-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.6rem;
    margin-top: 0.4rem;
}

.spec-item {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    padding: 0.5rem 0.75rem;
    border-radius: 8px;
    font-size: 0.75rem;
}

.spec-item .lbl { display: block; color: var(--text-dim); font-size: 0.68rem; }
.spec-item .val { font-family: var(--font-mono); font-weight: 600; color: var(--text-main); }

/* Metrics Grid - 7 in 1 */
.metrics-grid.grid-7in1 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.25rem;
}

.metric-card {
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 180px;
    position: relative;
    overflow: hidden;
}

.error-card {
    border-color: rgba(239, 68, 68, 0.2);
}

.error-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: var(--rose-500);
}

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

.metric-label {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-muted);
    letter-spacing: 0.5px;
}

.card-status-badge {
    font-size: 0.65rem;
    font-family: var(--font-mono);
    font-weight: 700;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
}

.badge-danger {
    background: rgba(239, 68, 68, 0.15);
    color: var(--rose-400);
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.badge-warning {
    background: rgba(245, 158, 11, 0.15);
    color: var(--amber-400);
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.metric-value-wrapper {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
    margin: 0.75rem 0;
}

.metric-value {
    font-size: 2.2rem;
    font-weight: 800;
    font-family: var(--font-mono);
    line-height: 1;
}

.metric-value.offline-text {
    color: rgba(255, 255, 255, 0.25);
}

.metric-unit {
    font-size: 0.85rem;
    color: var(--text-dim);
    font-family: var(--font-mono);
}

/* Flatline Mini Chart Graphic */
.sensor-mini-chart {
    position: relative;
    height: 24px;
    display: flex;
    align-items: center;
    margin: 0.5rem 0;
}

.chart-flatline {
    width: 100%;
    height: 2px;
    background: repeating-linear-gradient(90deg, var(--rose-500) 0, var(--rose-500) 6px, transparent 6px, transparent 12px);
    opacity: 0.6;
}

.flatline-text {
    position: absolute;
    right: 0;
    font-size: 0.65rem;
    font-family: var(--font-mono);
    color: var(--rose-400);
    background: rgba(5, 7, 12, 0.9);
    padding: 0 4px;
}

.card-footer {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    color: var(--text-dim);
    border-top: 1px solid rgba(255, 255, 255, 0.04);
    padding-top: 0.6rem;
}

/* Diagnostics Panel */
.diagnostics-panel {
    display: grid;
    grid-template-columns: 1.5fr 1fr;
    gap: 1.5rem;
    padding: 1.75rem;
}

.panel-title-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.8rem;
}

.panel-title-bar h3 {
    font-size: 0.9rem;
    font-weight: 800;
    letter-spacing: 0.5px;
    color: var(--text-muted);
}

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

.diagnostic-log-body {
    background: #04060a;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 1rem;
    height: 240px;
    overflow-y: auto;
    font-size: 0.78rem;
    color: var(--text-muted);
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.log-entry { line-height: 1.4; }
.log-entry .ts { color: var(--text-dim); margin-right: 6px; }
.log-entry .lvl-err { color: var(--rose-400); font-weight: 700; margin-right: 6px; }
.log-entry .lvl-warn { color: var(--amber-400); font-weight: 700; margin-right: 6px; }
.log-entry .lvl-info { color: var(--cyan-400); font-weight: 700; margin-right: 6px; }

/* Panel Right & Actions */
.action-heading {
    font-size: 0.9rem;
    font-weight: 800;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    margin-bottom: 0.4rem;
}

.action-desc {
    font-size: 0.8rem;
    color: var(--text-dim);
    margin-bottom: 1.25rem;
}

.action-buttons-group {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

/* Buttons */
.btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    padding: 0.75rem 1.25rem;
    border-radius: 10px;
    font-weight: 700;
    font-size: 0.85rem;
    cursor: pointer;
    transition: var(--transition-standard);
    border: none;
    font-family: var(--font-sans);
}

.btn-primary {
    background: linear-gradient(135deg, var(--rose-500), #c026d3);
    color: #fff;
    box-shadow: 0 4px 15px rgba(239, 68, 68, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(239, 68, 68, 0.4);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-main);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
}

.btn-tertiary {
    background: transparent;
    color: var(--cyan-400);
    border: 1px solid var(--border-highlight);
}

.btn-tertiary:hover {
    background: rgba(6, 182, 212, 0.1);
}

.btn-sm {
    padding: 0.3rem 0.6rem;
    font-size: 0.75rem;
    border-radius: 6px;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-color);
    color: var(--text-muted);
}

.btn-sm:hover { color: var(--text-main); border-color: rgba(255, 255, 255, 0.2); }

.support-info-card {
    margin-top: 1.5rem;
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid var(--border-color);
    padding: 0.8rem 1rem;
    border-radius: 10px;
    font-size: 0.78rem;
}

.support-label { color: var(--text-dim); font-weight: 700; margin-bottom: 4px; }

/* Modal Brand Icon */
.modal-logo-icon {
    width: 20px;
    height: 20px;
    border-radius: 4px;
    background: #fff;
    padding: 1px;
}

/* ==========================================================================
   MODAL DIALOG (HARDWARE SELF-TEST)
   ========================================================================== */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.82);
    backdrop-filter: blur(8px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

.modal-backdrop.active {
    display: flex;
    animation: fadeInModal 0.3s ease;
}

@keyframes fadeInModal {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-window {
    width: 90%;
    max-width: 580px;
    padding: 1.5rem;
    border: 1px solid var(--border-danger);
}

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

.modal-title { font-size: 0.85rem; font-weight: 700; color: var(--rose-400); display: flex; align-items: center; gap: 0.5rem; }
.modal-close { background: none; border: none; font-size: 1.5rem; color: var(--text-dim); cursor: pointer; }
.modal-close:hover { color: var(--text-main); }

.modal-body { padding: 1.25rem 0; }
.modal-sub { font-size: 0.85rem; color: var(--text-muted); margin-bottom: 1rem; }

.test-steps-list { display: flex; flex-direction: column; gap: 0.75rem; }

.test-step {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    padding: 0.75rem;
    border-radius: 8px;
}

.step-name { display: block; font-size: 0.82rem; font-weight: 600; }
.step-result { display: block; font-size: 0.75rem; color: var(--text-dim); }

.test-summary-box {
    margin-top: 1.25rem;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid var(--border-danger);
    padding: 1rem;
    border-radius: 8px;
}

.summary-title { font-weight: 800; font-size: 0.85rem; margin-bottom: 4px; }
.summary-desc { font-size: 0.8rem; color: var(--text-muted); }

.modal-footer {
    display: flex;
    justify-content: flex-end;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

/* Responsive Adjustments */
@media (max-width: 900px) {
    .top-nav { flex-direction: column; gap: 1rem; align-items: flex-start; }
    .nav-actions { width: 100%; justify-content: space-between; }
    .error-banner { grid-template-columns: 1fr; text-align: center; }
    .error-icon-wrapper { margin: 0 auto; }
    .sensor-spec-card { grid-template-columns: 1fr; text-align: center; }
    .spec-grid { grid-template-columns: 1fr 1fr; }
    .diagnostics-panel { grid-template-columns: 1fr; }
}
