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

html {
    scroll-behavior: auto;
    scroll-padding-top: 0;
    overflow-anchor: none;
}

body {
    background: #000000;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    display: flex;
    justify-content: center;
    min-height: 100vh;
    overflow-anchor: none;
    overflow-x: hidden;
}

.container {
    width: 100%;
    max-width: 600px;
    background: #000000;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    overflow-anchor: none;
    scroll-margin-top: 0;
}

header {
    background: #1a1a1a;
    color: #e0e0e0;
    padding: 16px 20px;
    text-align: center;
    border-bottom: 1px solid #333333;
    position: relative;
    z-index: 10;
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
}

.logo-icon {
    width: 28px;
    height: 28px;
    background: #2c2c2c;
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: bold;
    color: #00aaff;
    box-shadow: 0 0 2px #00aaff88;
}

header h1 {
    font-size: 22px;
    font-weight: 500;
    margin: 0;
    line-height: 1;
}

main {
    flex: 1;
    padding: 12px;
}

.main-menu {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-top: 16px;
}

.menu-button {
    background: #1a1a1a;
    border: 2px solid #333333;
    border-radius: 12px;
    padding: 24px 20px;
    color: #e0e0e0;
    font-size: 22px;
    font-weight: 500;
    text-align: center;
    text-decoration: none;
    display: block;
    width: 100%;
    transition: all 0.2s ease;
    cursor: pointer;
}

.menu-button:hover {
    background: #262626;
    border-color: #4a6a8a;
}

.menu-button .menu-sub {
    display: block;
    font-size: 12px;
    font-weight: 400;
	color: #ff884d;
    margin-top: 4px;
    text-transform: lowercase;
    letter-spacing: 0.3px;
}

.back-button {
    background: #1a1a1a;
    border: 1px solid #333333;
    border-radius: 8px;
    padding: 12px;
    color: #e0e0e0;
    font-size: 16px;
    text-align: center;
    text-decoration: none;
    display: block;
    width: 100%;
    margin-top: 24px;
    transition: all 0.2s ease;
    cursor: pointer;
}

.back-button:hover {
    background: #262626;
}

.search-box {
    margin-bottom: 16px;
}

#searchInput {
    width: 100%;
    padding: 12px;
    font-size: 16px;
    background: #1a1a1a;
    border: 2px solid #333333;
    border-radius: 8px;
    color: #e0e0e0;
    outline: none;
}

#searchInput:focus {
    border-color: #4a4a4a;
}

#searchInput::placeholder {
    color: #666666;
}

.results-container {
    background: #0d0d0d;
    border: 1px solid #333333;
    border-radius: 8px;
    overflow: hidden;
    max-height: 400px;
    overflow-y: auto;
    overscroll-behavior: contain;
}

.meal-item {
    padding: 12px 16px;
    border-bottom: 1px solid #333333;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
}

.meal-item:hover {
    background: #1a1a1a;
}

.meal-name {
    color: #e0e0e0;
    font-size: 16px;
}

.meal-code {
    background: #262626;
    color: #ffffff;
    font-size: 18px;
    font-weight: bold;
    padding: 4px 12px;
    border-radius: 20px;
    letter-spacing: 1px;
}

.empty-state {
    color: #666666;
    text-align: center;
    padding: 40px 20px;
    font-style: italic;
}

.guides-menu {
    background: transparent;
    overflow: visible;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    width: 100%;
}

.guide-item {
    background: #0d0d0d;
    border: 1px solid #333333;
    border-radius: 12px;
    padding: 6px 10px;
    color: #e0e0e0;
    font-size: 17px;
    font-weight: 500;
    text-decoration: none;
    display: block;
    width: 100%;
    max-width: 400px;
    margin: 0 auto;
    text-align: center;
    transition: all 0.2s ease;
    letter-spacing: 0.3px;
    cursor: pointer;
}

.guide-item:hover {
    background: #1f2a2f;
    border-color: #00aaff;
    color: #ffffff;
    transform: translateY(-1px);
}

@media (max-width: 480px) {
    .guide-item {
        max-width: 96%;
        padding: 12px 16px;
        font-size: 16px;
    }
}

.guide-section {
    width: 100%;
    background: #0d0d0d;
    border-radius: 10px;
    border: 1px solid #333333;
    margin-top: 16px;
    overflow: hidden;
}

.guide-title {
    background: #1a1a1a;
    color: #00aaff;
    padding: 12px 16px;
    font-size: 18px;
    font-weight: 600;
    border-bottom: 2px solid #00aaff;
    text-align: center;
    letter-spacing: 0.5px;
}

.guide-text {
    width: 100%;
    background: #ffffff;
    color: #000000;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica Neue', sans-serif;
    font-size: 14px;
    padding: 16px;
    line-height: 1.5;
    white-space: pre-wrap;
    word-wrap: break-word;
    font-weight: 400;
}

.guide-image {
    width: 100%;
    background: #ffffff;
    min-height: 180px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.guide-image img {
    width: 100%;
    height: auto;
    display: block;
}

.image-placeholder {
    color: #999;
    text-align: center;
    padding: 30px;
    font-family: sans-serif;
    font-size: 13px;
}

.page {
    display: none;
}

.page.active-page {
    display: block;
}

.double-back {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 16px;
}

.double-back .back-button {
    margin-top: 0;
}

footer {
    padding: 12px 16px;
    background: #1a1a1a;
    border-top: 1px solid #333333;
    color: #999999;
    text-align: center;
    font-size: 12px;
}

:focus {
    outline: none;
}

/* BNA page styling */
#bna-error-leds-page .guide-section {
    background: #0a0c10;
    border: 1px solid #2a2e3a;
    border-radius: 18px;
    overflow: hidden;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.4);
    margin-top: 0;
    width: 100%;
}

#bna-error-leds-page .guide-title {
    background: linear-gradient(135deg, #121620 0%, #0d1117 100%);
    color: #ff884d;
    border-bottom: 1px solid #ff884d;
    font-size: 20px;
    font-weight: 700;
    padding: 12px 16px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

#bna-error-leds-page .guide-text {
    background: #0a0c10;
    color: #e8edf5;
    padding: 14px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 16px;
    line-height: 1.4;
    white-space: normal;
    width: 100%;
    overflow-x: hidden;
}

#bna-error-leds-page .bna-led-panel {
    background: #0d1017;
    border-radius: 12px;
    padding: 10px 12px;
    margin-bottom: 12px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: space-between;
    align-items: center;
    border: 1px solid #252a34;
    width: 100%;
}

.led-status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 14px;
    font-weight: 600;
}

.led-bulb {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    box-shadow: 0 0 2px currentColor;
    flex-shrink: 0;
}

.led-bulb.green-off {
    background: #1a3a1a;
    box-shadow: none;
    border: 1px solid #2a5a2a;
}

.led-bulb.red-flash {
    background: #ff3300;
    animation: fastPulse 0.8s infinite;
    box-shadow: 0 0 4px #ff4411;
}

@keyframes fastPulse {
    0%   { opacity: 1; transform: scale(1);    background: #ff3300; }
    50%  { opacity: 0.5; transform: scale(0.85); background: #cc2200; }
    100% { opacity: 1; transform: scale(1);    background: #ff3300; }
}

.model-badge-container {
    display: flex;
    justify-content: center;
    width: 100%;
    margin-top: 4px;
    margin-bottom: 10px;
}

.model-badge {
    font-weight: 700;
    font-size: 13px;
    background: #1a1f2a;
    padding: 5px 14px;
    border-radius: 24px;
    color: #ffaa66;
    white-space: nowrap;
    display: inline-block;
    text-align: center;
    letter-spacing: 0.5px;
}

.error-grid {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 8px;
    width: 100%;
}

.error-row {
    background: #0f1219;
    border-radius: 10px;
    padding: 8px 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    transition: all 0.1s ease;
    border-left: 3px solid #ff884d;
    border: 1px solid #20242e;
    width: 100%;
}

.flash-badge {
    background: #cc2200;
    color: #ffffff;
    font-weight: 800;
    font-size: 15px;
    min-width: 70px;
    text-align: center;
    padding: 4px 8px;
    border-radius: 20px;
    font-family: monospace;
    letter-spacing: 0.5px;
    box-shadow: 0 0 3px rgba(220, 60, 20, 0.5);
    flex-shrink: 0;
}

.error-desc {
    font-size: 15px;
    font-weight: 600;
    color: #dce5f0;
    white-space: nowrap;
    flex: 1;
}

.error-action {
    font-size: 14px;
    background: #1e232e;
    padding: 4px 8px;
    border-radius: 18px;
    color: #ffaa77;
    font-weight: 600;
    white-space: nowrap;
    flex-shrink: 0;
    text-align: right;
}

@media (max-width: 480px) {
    .error-row    { padding: 6px 8px; gap: 5px; }
    .flash-badge  { font-size: 14px; min-width: 62px; padding: 3px 6px; }
    .error-desc   { font-size: 13px; }
    .error-action { font-size: 12px; padding: 3px 6px; }
}

@media (max-width: 400px) {
    .flash-badge  { font-size: 13px; min-width: 56px; }
    .error-desc   { font-size: 12px; }
    .error-action { font-size: 11px; }
}

#bna-error-leds-page .guide-image  { display: none; }
#bna-error-leds-page .double-back  { margin-top: 12px; }
#bna-error-leds-page               { width: 100%; overflow-x: hidden; }

/* Protocol page consistent styling */
.protocol-page .guide-section { background: #0d0d0d; }
.protocol-page .guide-title   { background: #1a1a1a; color: #00aaff; }
.protocol-page .guide-image   { background: #ffffff; min-height: 220px; padding: 20px 0; }

/* Faults page styling */
.faults-content {
    padding: 16px 0;
    color: #e0e0e0;
}

.faults-placeholder {
    background: #0d0d0d;
    border: 1px solid #333333;
    border-radius: 10px;
    padding: 40px 20px;
    text-align: center;
    margin-top: 16px;
}

.faults-placeholder .fault-icon {
    font-size: 48px;
    margin-bottom: 16px;
    display: block;
}

.faults-placeholder h2 {
    color: #00aaff;
    font-size: 20px;
    margin-bottom: 8px;
}

.faults-placeholder p {
    color: #666666;
    font-size: 14px;
}
