/* ═══════════════════════════════════════════════════════════════════════════
   ME7.5 ESKONF Editor — Dark Theme
   ═══════════════════════════════════════════════════════════════════════════ */

:root {
    --bg-app:        #151520;
    --bg-sidebar:    #1e1e2e;
    --bg-card:       #1a2535;
    --bg-input:      #252538;
    --bg-hex:        #0d0d18;
    --bg-preset:     #2c3e50;
    --bg-row:        rgba(255,255,255,0.02);

    --border:        #2d2d45;
    --border-hi:     #5dade2;

    --txt-primary:   #dde3ee;
    --txt-secondary: #8892a4;
    --txt-muted:     #505568;

    --blue:          #5dade2;
    --green:         #2ecc71;
    --yellow:        #f1c40f;
    --red:           #e74c3c;
    --gray:          #95a5a6;

    --sidebar-w:     258px;
    --mono:          'Courier New', Courier, monospace;
    --sans:          'Segoe UI', Arial, sans-serif;
    --radius:        8px;
}

/* ── Reset ────────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
    height: 100%;
    overflow: hidden;
    background: var(--bg-app);
    color: var(--txt-primary);
    font-family: var(--sans);
    font-size: 14px;
    line-height: 1.4;
}

/* ── Layout ───────────────────────────────────────────────────────────────── */
.app-container {
    display: flex;
    height: 100vh;
}

/* ═══════════════════════════════════════════════════
   SIDEBAR
═══════════════════════════════════════════════════ */
.sidebar {
    width: var(--sidebar-w);
    flex-shrink: 0;
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 18px 14px;
    overflow-y: auto;
    gap: 4px;
}

/* Brand */
.sidebar-brand {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 14px;
}
.brand-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--blue);
    text-align: center;
    letter-spacing: 0.3px;
}
.brand-version {
    font-size: 11px;
    color: var(--txt-muted);
}

/* Section */
.sidebar-section {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 6px;
}
.section-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: var(--txt-secondary);
}
.sidebar-sep {
    height: 1px;
    background: var(--border);
    margin: 10px 0;
}

/* Drop zone */
.drop-zone {
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 12px 10px;
    cursor: pointer;
    text-align: center;
    color: var(--txt-secondary);
    font-size: 13px;
    font-weight: 600;
    transition: border-color .2s, color .2s, background .2s;
    user-select: none;
}
.drop-zone input[type="file"] { display: none; }
.drop-zone:hover,
.drop-zone.drag-over {
    border-color: var(--blue);
    color: var(--blue);
    background: rgba(93,173,226,.06);
}

.file-info {
    font-size: 11px;
    color: var(--green);
    word-break: break-all;
}

/* Select */
.select-ctrl {
    width: 100%;
    background: var(--bg-input);
    color: var(--txt-primary);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 7px 10px;
    font-size: 13px;
    cursor: pointer;
    outline: none;
    appearance: auto;
}
.select-ctrl:focus { border-color: var(--blue); }

/* Toggle checkbox */
.toggle-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 12px;
    color: var(--txt-secondary);
}
.toggle-label input[type="checkbox"] {
    width: 15px; height: 15px;
    accent-color: var(--blue);
    cursor: pointer;
    flex-shrink: 0;
}

/* Mono input */
.input-mono {
    width: 100%;
    background: var(--bg-input);
    color: var(--txt-primary);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 7px 10px;
    font-family: var(--mono);
    font-size: 13px;
    outline: none;
    letter-spacing: 1px;
}
.input-mono:focus     { border-color: var(--blue); }
.input-mono::placeholder { color: var(--txt-muted); }

/* Checksum warning */
.checksum-warning {
    font-size: 12px;
    font-weight: 700;
    color: var(--red);
    text-align: center;
    padding: 6px 4px;
    border: 1px solid rgba(231,76,60,.4);
    border-radius: 6px;
    background: rgba(231,76,60,.08);
}

/* About */
.sidebar-about {
    margin-top: auto;
    padding-top: 18px;
    text-align: center;
    font-size: 11px;
    color: var(--txt-secondary);
    line-height: 1.8;
}
.about-version { color: var(--txt-muted); }

/* ═══════════════════════════════════════════════════
   BUTTONS
═══════════════════════════════════════════════════ */
.btn {
    display: block;
    width: 100%;
    padding: 9px 14px;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    text-align: center;
    text-decoration: none;
    transition: background .18s, opacity .18s;
    letter-spacing: 0.2px;
}
.btn:disabled      { opacity: .35; cursor: not-allowed; pointer-events: none; }

.btn-primary       { background: var(--blue);    color: #fff; }
.btn-primary:hover { background: #3498db; }

.btn-secondary       { background: transparent; color: var(--txt-primary); border: 1px solid var(--border); }
.btn-secondary:hover { border-color: var(--blue); color: var(--blue); }

.btn-danger          { background: #c0392b; color: #fff; }
.btn-danger:hover    { background: #a93226; }

.btn-download        { background: #27ae60; color: #fff; margin-top: 6px; }
.btn-download:hover  { background: #229954; }

/* Inline copy button */
.btn-copy {
    display: inline-block;
    width: auto;
    padding: 4px 14px;
    font-size: 12px;
    background: var(--blue);
    color: #fff;
    border-radius: 5px;
    border: none;
    cursor: pointer;
    font-weight: 700;
    transition: background .18s;
}
.btn-copy:hover { background: #3498db; }

/* Preset button */
.btn-preset {
    display: inline-block;
    width: auto;
    padding: 5px 11px;
    font-size: 11px;
    background: #34495e;
    color: var(--txt-primary);
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-weight: 700;
    transition: background .15s, color .15s;
}
.btn-preset:hover    { background: #2c3e50; color: var(--yellow); }
.btn-preset:disabled { opacity: .3; cursor: not-allowed; }

/* ═══════════════════════════════════════════════════
   MAIN CONTENT
═══════════════════════════════════════════════════ */
.main-content {
    flex: 1;
    padding: 22px 24px;
    overflow-y: auto;
    min-width: 0;
}

.main-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--blue);
    margin-bottom: 14px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--border);
}

/* Status bar */
.status-bar {
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 7px 12px;
    margin-bottom: 10px;
    font-size: 13px;
    color: var(--txt-secondary);
}
.status-bar.ok    { color: var(--green);  border-color: rgba(46,204,113,.4); }
.status-bar.err   { color: var(--red);    border-color: rgba(231,76,60,.4); }

/* Scan info */
.scan-info {
    background: rgba(93,173,226,.08);
    border: 1px solid rgba(93,173,226,.3);
    border-radius: 6px;
    padding: 7px 12px;
    margin-bottom: 10px;
    font-size: 13px;
    color: var(--blue);
}

/* Disclaimer */
.disclaimer {
    background: rgba(231,76,60,.07);
    border: 1px solid rgba(231,76,60,.3);
    border-radius: 6px;
    padding: 8px 12px;
    margin-bottom: 18px;
    font-size: 12px;
    color: #e57168;
}

/* ═══════════════════════════════════════════════════
   ESKONF SLOT
═══════════════════════════════════════════════════ */
.eskonf-slot {
    background: var(--bg-card);
    border: 2px solid var(--border);
    border-radius: 10px;
    margin-bottom: 28px;
    overflow: hidden;
}

.slot-header {
    background: rgba(0,0,0,.25);
    padding: 11px 20px;
    border-bottom: 1px solid var(--border);
}
.slot-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--blue);
}

/* Top controls row */
.slot-top {
    display: flex;
    gap: 14px;
    padding: 14px 18px;
    align-items: flex-start;
    flex-wrap: wrap;
}

/* HEX display box */
.hex-box {
    flex: 1;
    min-width: 220px;
    background: var(--bg-hex);
    border-radius: var(--radius);
    padding: 11px 14px;
}
.hex-orig {
    font-family: var(--mono);
    font-size: 12px;
    color: var(--txt-secondary);
    margin-bottom: 5px;
    word-break: break-all;
}
.hex-mod {
    font-family: var(--mono);
    font-size: 14px;
    font-weight: 700;
    color: var(--blue);
    margin-bottom: 9px;
    word-break: break-all;
}

/* Preset box */
.preset-box {
    background: var(--bg-preset);
    border-radius: var(--radius);
    padding: 10px 12px;
    min-width: 200px;
}
.preset-title {
    font-size: 11px;
    font-weight: 700;
    color: var(--txt-secondary);
    text-align: center;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}
.preset-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    justify-content: center;
}

/* ═══════════════════════════════════════════════════
   COMPONENT GRID
═══════════════════════════════════════════════════ */
.component-grid {
    padding: 6px 18px 18px;
}

.byte-row {
    display: flex;
    align-items: flex-start;
    gap: 6px;
    margin-bottom: 6px;
}

.byte-label {
    font-family: var(--mono);
    font-size: 11px;
    font-weight: 700;
    color: var(--txt-secondary);
    width: 78px;
    flex-shrink: 0;
    padding-top: 9px;
    white-space: nowrap;
}

.byte-comps {
    display: flex;
    gap: 6px;
    flex: 1;
    flex-wrap: nowrap;
}

.comp-cell {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
    min-width: 90px;
}

/* Component select */
.comp-sel {
    width: 100%;
    padding: 6px 2px;
    border: none;
    border-radius: 5px;
    font-size: 12px;
    font-weight: 700;
    color: #111;
    cursor: pointer;
    text-align: center;
    outline: none;
    appearance: auto;
    transition: background .15s;
}
.comp-sel option { background: #1e1e2e; color: var(--txt-primary); }

/* Value color states */
.v0 { background: var(--green);  }  /* Y (00) */
.v1 { background: var(--gray);   }  /* ? (01) */
.v2 { background: var(--yellow); color: #1a1a1a !important; } /* S (10) */
.v3 { background: var(--red);    }  /* N (11) */

/* Component name label */
.comp-name {
    font-size: 9.5px;
    color: var(--txt-secondary);
    text-align: center;
    margin-top: 3px;
    line-height: 1.25;
    word-break: break-word;
    max-width: 120px;
}
.comp-name.changed {
    color: var(--yellow);
    font-weight: 700;
}

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

/* Scrollbar */
::-webkit-scrollbar              { width: 5px; }
::-webkit-scrollbar-track        { background: var(--bg-app); }
::-webkit-scrollbar-thumb        { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover  { background: #444; }

/* ═══════════════════════════════════════════════════
   RESPONSIVE
═══════════════════════════════════════════════════ */
@media (max-width: 960px) {
    .slot-top    { flex-direction: column; }
    .byte-comps  { flex-wrap: wrap; }
    .comp-cell   { min-width: 80px; }
}
@media (max-width: 680px) {
    :root        { --sidebar-w: 100%; }
    .app-container { flex-direction: column; height: auto; }
    .sidebar       { width: 100%; overflow-y: visible; }
    html, body     { overflow: auto; }
}
