/**
 * firmware-panel.css
 * Estils per la finestra FirmwarePanel de iotvSim.
 * Inspirat en l'estil d'iot02sim (TokyoNight palette) però integrat
 * dins el sistema de finestres de sAh (fons fosc #1e1e1e).
 */

/* ── Contenidor principal ── */
.fw-panel {
    display: flex;
    flex-direction: column;
    gap: 0;
    height: 100%;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-size: 13px;
    color: #ecf0f1;
    background: #1e1e1e;
}

/* ── Barra d'estat superior ── */
.fw-status-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: #16213e;
    border-bottom: 1px solid #2c3e50;
    flex-wrap: wrap;
    min-height: 34px;
}

.fw-conn-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
    transition: background 0.4s, box-shadow 0.4s;
}

.fw-conn-dot.connected {
    background: #2ecc71;
    box-shadow: 0 0 6px #2ecc71;
}

.fw-conn-dot.disconnected {
    background: #e74c3c;
}

.fw-conn-text {
    font-size: 12px;
    color: #90a4ae;
    min-width: 80px;
}

.fw-sep {
    color: rgba(255,255,255,0.15);
    user-select: none;
}

.fw-label {
    font-size: 12px;
    color: #7f8c8d;
    flex-shrink: 0;
}

.fw-mac-input {
    background: #0f3460;
    border: 1px solid #3b4261;
    border-radius: 3px;
    color: #90caf9;
    font-family: 'JetBrains Mono', 'Consolas', monospace;
    font-size: 11px;
    padding: 2px 6px;
    width: 100px;
}

.fw-session-id {
    background: #0f3460;
    border: 1px solid #3b4261;
    border-radius: 3px;
    color: #7aa2f7;
    font-family: 'JetBrains Mono', 'Consolas', monospace;
    font-size: 11px;
    padding: 2px 6px;
}

.fw-icon-btn {
    background: none;
    border: none;
    color: #7f8c8d;
    cursor: pointer;
    font-size: 14px;
    padding: 0 2px;
    line-height: 1;
    border-radius: 3px;
}

.fw-icon-btn:hover {
    color: #ecf0f1;
    background: rgba(255,255,255,0.1);
}

#fw-capacity {
    font-size: 12px;
    color: #90a4ae;
}

/* ── Seccions genèriques ── */
.fw-section {
    padding: 12px 14px;
    border-bottom: 1px solid #2c3e50;
    flex-shrink: 0;
}

.fw-section-title {
    font-size: 13px;
    font-weight: 600;
    color: #90caf9;
    margin: 0 0 10px;
}

/* ── Upload zone ── */
.fw-upload-zone {
    border: 2px dashed #3b4261;
    border-radius: 6px;
    padding: 18px 16px;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
    background: #12122a;
    user-select: none;
}

.fw-upload-zone:hover,
.fw-upload-zone.dragover {
    border-color: #7aa2f7;
    background: #1a1f3a;
}

.fw-upload-icon {
    font-size: 28px;
    display: block;
    margin-bottom: 8px;
}

.fw-upload-text {
    font-size: 13px;
    color: #c0caf5;
    margin: 0 0 4px;
}

.fw-upload-hint {
    font-size: 11px;
    color: #565f89;
    margin: 0;
}

/* ── Estat de compilació / upload ── */
.fw-compile-status {
    min-height: 20px;
    margin: 8px 0 0;
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ── Botons d'acció ── */
.fw-actions {
    display: flex;
    gap: 8px;
    margin-top: 10px;
    flex-wrap: wrap;
}

.fw-btn {
    padding: 6px 14px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    font-family: inherit;
    background: #3b4261;
    color: #c0caf5;
    transition: background 0.2s, opacity 0.2s;
    white-space: nowrap;
}

.fw-btn:hover:not(:disabled) {
    background: #4a5274;
}

.fw-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.fw-btn-green {
    background: #1a4731;
    color: #9ece6a;
    border: 1px solid #2ecc71;
}

.fw-btn-green:hover:not(:disabled) {
    background: #1e5c3a;
}

.fw-btn-red {
    background: #4a1a1a;
    color: #f7768e;
    border: 1px solid #e74c3c;
}

.fw-btn-red:hover:not(:disabled) {
    background: #5c2020;
}

.fw-btn-small {
    padding: 4px 10px;
    font-size: 11px;
}

.fw-btn-muted {
    background: #2c3e50;
    color: #7f8c8d;
}

.fw-btn-muted:hover:not(:disabled) {
    background: #34495e;
}

.fw-btn-download {
    background: #1a3a4a;
    color: #7aa2f7;
    border: 1px solid #3498db;
    display: inline-flex;
    align-items: center;
}

/* ── Serial Monitor ── */
.fw-serial-section {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0; /* permet shrink */
    padding-bottom: 10px;
}

.fw-serial-output {
    flex: 1;
    min-height: 80px;
    background: #0d0d1a;
    border: 1px solid #2c3e50;
    border-radius: 4px;
    padding: 8px 10px;
    overflow-y: auto;
    font-family: 'JetBrains Mono', 'Consolas', 'Courier New', monospace;
    font-size: 11px;
    color: #c0caf5;
    white-space: pre-wrap;
    word-break: break-all;
    line-height: 1.5;
}

.fw-serial-output::-webkit-scrollbar {
    width: 8px;
}
.fw-serial-output::-webkit-scrollbar-track {
    background: #0d0d1a;
}
.fw-serial-output::-webkit-scrollbar-thumb {
    background: #2c3e50;
    border-radius: 4px;
}

.fw-serial-input-row {
    display: flex;
    gap: 6px;
    margin-top: 8px;
    align-items: center;
}

.fw-serial-input {
    flex: 1;
    background: #12122a;
    border: 1px solid #3b4261;
    border-radius: 4px;
    color: #c0caf5;
    font-family: 'JetBrains Mono', 'Consolas', monospace;
    font-size: 12px;
    padding: 5px 10px;
    outline: none;
    transition: border-color 0.2s;
}

.fw-serial-input:focus {
    border-color: #7aa2f7;
}

/* ── Spinner ── */
.fw-spinner {
    display: inline-block;
    width: 12px;
    height: 12px;
    border: 2px solid rgba(255,255,255,0.2);
    border-top-color: #7aa2f7;
    border-radius: 50%;
    animation: fw-spin 0.8s linear infinite;
    flex-shrink: 0;
}

@keyframes fw-spin {
    to { transform: rotate(360deg); }
}
