body {
    font-family: 'Share Tech Mono', 'Courier New', monospace;
    background-color: #0b0c10;
    color: #66fcf1;
    margin: 0;
    padding: 0;
    height: 100vh;
    display: grid;
    grid-template-rows: auto 1fr;
}

/* Import a technical font */
@import url('https://fonts.googleapis.com/css2?family=Share+Tech+Mono&display=swap');

header {
    background-color: #1f2833;
    border-bottom: 2px solid #45a29e;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 0 15px rgba(69, 162, 158, 0.3);
}

h1 {
    margin: 0;
    font-size: 1.8rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    text-shadow: 0 0 5px #45a29e;
}

#status-panel {
    display: flex;
    gap: 1.5rem;
    font-size: 1.1rem;
}

.status-item {
    background: rgba(31, 40, 51, 0.8);
    padding: 0.5rem 1rem;
    border: 1px solid #45a29e;
    border-radius: 4px;
}

.status-value {
    color: #fff;
    font-weight: bold;
}

button {
    background-color: #1f2833;
    color: #66fcf1;
    border: 1px solid #66fcf1;
    padding: 0.5rem 1.2rem;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.9rem;
    text-transform: uppercase;
    transition: all 0.2s ease;
    box-shadow: 0 0 5px rgba(102, 252, 241, 0.2);
}

button:hover {
    background-color: #45a29e;
    color: #0b0c10;
    box-shadow: 0 0 15px rgba(102, 252, 241, 0.6);
}

button:active {
    transform: scale(0.98);
}

main {
    padding: 2rem;
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto 1fr;
    gap: 2rem;
    overflow-y: auto;
}

section {
    background-color: #1f2833;
    padding: 1.5rem;
    border: 1px solid #45a29e;
    border-radius: 8px;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
    position: relative;
}

/* Add corner markers for tech look */
section::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    width: 20px;
    height: 20px;
    border-top: 2px solid #66fcf1;
    border-left: 2px solid #66fcf1;
}

section::after {
    content: '';
    position: absolute;
    bottom: -2px;
    right: -2px;
    width: 20px;
    height: 20px;
    border-bottom: 2px solid #66fcf1;
    border-right: 2px solid #66fcf1;
}

h2 {
    color: #c5c6c7;
    border-bottom: 1px solid #45a29e;
    padding-bottom: 0.5rem;
    margin-top: 0;
    font-size: 1.4rem;
}

.hex-dump {
    font-family: 'Consolas', monospace;
    white-space: pre-wrap;
    background-color: #0b0c10;
    padding: 1.5rem;
    margin-top: 1rem;
    border-radius: 4px;
    border: 1px solid #333;
    font-size: 1.2rem;
    line-height: 1.5;
    min-height: 100px;
}

.hex-byte {
    display: inline-block;
    margin-right: 0.5rem;
}

.hex-header {
    color: #45a29e;
}

.hex-data {
    color: #fff;
}

.hex-crc {
    color: #ff9900;
}

#bus-vis {
    width: 100%;
    height: 300px;
    background-color: #0b0c10;
    margin-top: 1rem;
    border: 1px solid #333;
}

.axis-label {
    color: #45a29e;
    fill: #45a29e;
    font-family: 'Share Tech Mono', monospace;
}

.grid-line {
    stroke: #333;
    stroke-opacity: 0.2;
}

.bus-path {
    stroke: #66fcf1;
    stroke-width: 2;
    fill: none;
    filter: url(#glow);
}

.bus-title {
    fill: #66fcf1;
    font-family: 'Share Tech Mono', monospace;
    text-anchor: middle;
    text-shadow: 0 0 5px #66fcf1;
}

#packet-details p {
    margin: 0.5rem 0;
    border-left: 3px solid #45a29e;
    padding-left: 10px;
}

.caption {
    font-size: 0.8rem;
    color: #888;
    text-align: center;
    margin-top: 10px;
}

/* Full width for bus analyzer */
#bus-analyzer {
    grid-column: 1 / -1;
}

/* Status Indicators */
.status-ok {
    color: #45a29e;
    text-shadow: 0 0 8px #45a29e;
}

.status-err {
    color: #ff4d4d;
    text-shadow: 0 0 8px #ff4d4d;
}

.status-warn {
    color: #ffcc00;
    text-shadow: 0 0 8px #ffcc00;
}

.val-highlight {
    color: #66fcf1;
}

/* Focus styles for accessibility */
button:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 2px;
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.5);
}

/* Accessibility: Skip Link */
.skip-link {
    position: absolute;
    top: -50px;
    left: 1rem;
    background: #45a29e;
    color: #0b0c10;
    padding: 0.5rem 1rem;
    z-index: 1000;
    font-weight: bold;
    text-decoration: none;
    border-radius: 0 0 4px 4px;
    transition: top 0.2s;
}

.skip-link:focus {
    top: 0;
    outline: 2px solid #fff;
}

/* Utility */
.hidden {
    display: none !important;
}

/* Hex Dump Copy Button */
.hex-wrapper {
    position: relative;
    margin-top: 1rem;
}

.hex-wrapper .hex-dump {
    margin-top: 0;
}

.copy-btn {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    padding: 0.3rem 0.6rem;
    font-size: 0.8rem;
    background: rgba(11, 12, 16, 0.8);
    border: 1px solid #333;
    color: #888;
    box-shadow: none;
    border-radius: 4px;
    z-index: 10;
}

.copy-btn:hover {
    background: #1f2833;
    color: #45a29e;
    border-color: #45a29e;
    box-shadow: 0 0 5px rgba(69, 162, 158, 0.3);
}

.copy-btn:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 2px;
}

/* FDIR Log Styles */
#fdir-logs-container {
    background: #0b0c10;
    padding: 1rem;
    border: 1px solid #333;
    height: 150px;
    overflow-y: auto;
    font-family: 'Share Tech Mono', monospace;
    scroll-behavior: smooth;
    margin-top: 10px;
}

#fdir-logs-container:focus-visible {
    outline: 2px solid #66fcf1;
    outline-offset: -2px;
}

/* Palette: Log Entry Animation */
@keyframes log-entry-slide {
    from {
        opacity: 0;
        transform: translateX(-10px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.log-entry {
    margin-bottom: 0.5rem;
    border-bottom: 1px solid #1f2833;
    padding-bottom: 0.2rem;
    display: flex;
    gap: 0.5rem;
    animation: log-entry-slide 0.3s ease-out;
}

@media (prefers-reduced-motion: reduce) {
    .log-entry {
        animation: none;
    }
}

.log-time {
    color: #666;
    font-size: 0.9em;
}

.log-level {
    font-weight: bold;
}

.log-info {
    color: #45a29e;
}

.log-warn {
    color: #ff9900;
}

.log-err {
    color: #ff4d4d;
}

.log-message {
    color: #ccc;
}

/* Keyboard Shortcut Hint */
.kbd {
    display: inline-block;
    padding: 0 5px;
    margin-left: 8px;
    font-size: 0.75em;
    border: 1px solid rgba(102, 252, 241, 0.4);
    border-radius: 3px;
    background: rgba(11, 12, 16, 0.5);
    color: rgba(102, 252, 241, 0.8);
    vertical-align: middle;
}

/* Palette: Status Update Animation */
@keyframes status-flash {
    0% {
        color: #fff;
        text-shadow: 0 0 10px #fff;
    }

    100% {
        color: inherit;
        text-shadow: inherit;
    }
}

.status-changed {
    animation: status-flash 0.5s ease-out;
}

/* Security Enhancement: Replaced inline style */
#btn-fetch-telemetry {
    margin-top: 1rem;
}
/* Palette: Disabled State Improvements */
button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    box-shadow: none;
}

button:disabled:active {
    transform: none;
}

/* Ensure feedback states remain visible even when disabled */
button:disabled.status-ok,
button:disabled.status-err {
    opacity: 1;
    cursor: default;
}
