/* Bulle flash-app — wizard styles */

* {
    box-sizing: border-box;
}

[x-cloak] {
    display: none !important;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    margin: 0;
    padding: 0;
    background: #f5f5f7;
    color: #1d1d1f;
    line-height: 1.5;
}

main {
    max-width: 720px;
    margin: 0 auto;
    padding: 2rem 1rem;
}

.header h1 {
    font-size: 1.75rem;
    margin: 0 0 1.5rem;
    color: #0066cc;
}

/* --- Steps progress bar --- */

.steps {
    display: flex;
    list-style: none;
    padding: 0;
    margin: 0 0 2rem;
    gap: 0.5rem;
    overflow-x: auto;
}

.steps li {
    flex: 1;
    min-width: 0;
    padding: 0.75rem 0.5rem;
    background: #fff;
    border: 1px solid #d2d2d7;
    border-radius: 6px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.8rem;
    color: #86868b;
    transition: all 0.2s;
}

.steps li.active {
    border-color: #0066cc;
    background: #e6f0ff;
    color: #0066cc;
    font-weight: 600;
}

.steps li.done {
    border-color: #34c759;
    background: #d4f5dd;
    color: #248a3d;
}

.step-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: currentColor;
    color: #fff;
    font-size: 0.75rem;
    font-weight: 600;
}

.step-label {
    text-align: center;
    line-height: 1.2;
}

/* --- Cards --- */

.card {
    background: #fff;
    border: 1px solid #d2d2d7;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.card h2 {
    margin: 0 0 1rem;
    font-size: 1.25rem;
}

.card h3 {
    margin: 1rem 0 0.5rem;
    font-size: 0.95rem;
    color: #515154;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* --- Firmware selection --- */

.firmware-group {
    margin-bottom: 1rem;
}

.firmware-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.firmware-list li {
    border: 1px solid #d2d2d7;
    border-radius: 8px;
    margin-bottom: 0.5rem;
    transition: border-color 0.2s;
}

.firmware-list li:hover {
    border-color: #0066cc;
}

.firmware-list label {
    display: block;
    padding: 0.75rem 1rem;
    cursor: pointer;
}

.firmware-list input[type=radio] {
    margin-right: 0.5rem;
}

.firmware-list .version {
    color: #515154;
    font-size: 0.9rem;
    margin-left: 0.5rem;
}

.firmware-list .size {
    color: #86868b;
    font-size: 0.85rem;
    margin-left: 0.5rem;
}

.firmware-list .badge {
    display: inline-block;
    background: #34c759;
    color: #fff;
    padding: 0.1rem 0.5rem;
    border-radius: 4px;
    font-size: 0.7rem;
    font-style: normal;
    margin-left: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.firmware-list .notes {
    margin: 0.5rem 0 0;
    font-size: 0.85rem;
    color: #515154;
    font-style: italic;
}

/* --- Buttons --- */

.actions {
    margin-top: 1.5rem;
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    align-items: center;
}

button, .btn-primary {
    background: #0066cc;
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 0.6rem 1.2rem;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s;
}

button:hover {
    background: #004a99;
}

button:disabled {
    background: #d2d2d7;
    color: #86868b;
    cursor: not-allowed;
}

.btn-secondary {
    background: #fff;
    color: #0066cc;
    border: 1px solid #0066cc;
}

.btn-secondary:hover {
    background: #e6f0ff;
}

/* esp-web-install-button slot=activate styling */
esp-web-install-button button[slot="activate"] {
    background: #ff6b35;
    font-size: 1.05rem;
    padding: 0.75rem 1.5rem;
}

esp-web-install-button button[slot="activate"]:hover {
    background: #e0541c;
}

/* --- Messages --- */

.alert {
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
}

.alert-error {
    background: #ffebeb;
    color: #8b0000;
    border: 1px solid #ff9595;
}

.success {
    color: #248a3d;
    font-weight: 500;
}

.placeholder {
    background: #fffbeb;
    border-left: 4px solid #ff9500;
    padding: 0.75rem 1rem;
    border-radius: 4px;
    color: #515154;
    font-style: italic;
}

.empty {
    padding: 2rem;
    text-align: center;
    color: #86868b;
}

.loading {
    padding: 2rem;
    text-align: center;
    color: #86868b;
}

.firmware-info,
.device-info {
    background: #f5f5f7;
    padding: 0.75rem 1rem;
    border-radius: 6px;
    margin: 1rem 0;
    font-size: 0.95rem;
}

.instructions {
    margin: 1rem 0;
    padding-left: 1.5rem;
}

.instructions li {
    margin-bottom: 0.5rem;
}

code {
    background: #f5f5f7;
    padding: 0.1rem 0.4rem;
    border-radius: 4px;
    font-family: 'SF Mono', Monaco, 'Cascadia Code', monospace;
    font-size: 0.9em;
}

/* --- Flash flows (Step 1) --- */

.flash-flow {
    border: 1px solid #d2d2d7;
    border-radius: 8px;
    padding: 1rem;
    margin: 1rem 0;
}

.flash-flow.flow-auto {
    border-color: #0066cc;
    background: #e6f0ff;
}

.flash-flow.flow-manual {
    background: #fff8e6;
    border-color: #ff9500;
}

.flash-flow h3 {
    margin: 0 0 0.5rem;
    text-transform: none;
    letter-spacing: normal;
    color: inherit;
}

.flash-flow-hint {
    margin: 0.5rem 0;
    font-size: 0.9rem;
    color: #515154;
}

.flash-flow ol {
    margin: 0.5rem 0;
    padding-left: 1.5rem;
}

.flash-flow ol li {
    margin-bottom: 1rem;
}

.flash-flow ol li > p {
    margin: 0.5rem 0 0;
}

/* --- Console série page --- */

.console-page {
    padding: 1.5rem;
}

.console-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.console-header h2 {
    margin: 0;
}

.console-status {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin: 1rem 0;
    padding: 0.75rem 1rem;
    background: #f5f5f7;
    border-radius: 6px;
    font-size: 0.9rem;
}

.badge-ok {
    color: #248a3d;
    font-weight: 500;
}

.badge-off {
    color: #86868b;
}

.loading-inline {
    color: #86868b;
    font-style: italic;
}

.console-cmd-groups {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin: 1.5rem 0;
}

@media (max-width: 600px) {
    .console-cmd-groups {
        grid-template-columns: 1fr;
    }
}

.console-cmd-stack {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin: 1.5rem 0;
}

.cmd-group {
    border: 1px solid #d2d2d7;
    border-radius: 8px;
    padding: 1rem;
}

.cmd-group h3 {
    margin: 0 0 0.75rem;
    font-size: 0.95rem;
    color: #515154;
    text-transform: none;
    letter-spacing: normal;
}

.cmd-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-bottom: 0.5rem;
}

.cmd-buttons button {
    padding: 0.4rem 0.8rem;
    font-size: 0.85rem;
}

.cmd-hint {
    color: #86868b;
    font-style: italic;
    font-size: 0.75rem;
}

.btn-danger {
    background: #ff3b30;
    color: white;
    border: none;
}

.btn-danger:hover {
    background: #d70015;
}

.console-custom {
    display: flex;
    gap: 0.5rem;
    margin: 1rem 0;
}

.console-custom input {
    flex: 1;
    padding: 0.6rem 0.8rem;
    border: 1px solid #d2d2d7;
    border-radius: 6px;
    font-family: 'SF Mono', Monaco, monospace;
    font-size: 0.9rem;
}

.console-custom input:focus {
    outline: none;
    border-color: #0066cc;
}

.serial-log {
    background: #1d1d1f;
    color: #f5f5f7;
    font-family: 'SF Mono', Monaco, 'Cascadia Code', monospace;
    font-size: 0.85rem;
    padding: 1rem;
    border-radius: 8px;
    height: 400px;
    overflow-y: auto;
    margin-top: 1rem;
    line-height: 1.4;
}

.serial-line {
    display: flex;
    gap: 0.5rem;
    white-space: pre-wrap;
    word-break: break-all;
}

.serial-line .ts {
    color: #8e8e93;
    flex-shrink: 0;
    font-size: 0.75rem;
    padding-top: 0.05rem;
}

.serial-line .serial-text {
    flex: 1;
}

.serial-empty {
    color: #86868b;
    font-style: italic;
    text-align: center;
    padding: 2rem 0;
}

.console-actions {
    display: flex;
    gap: 1rem;
    align-items: center;
    margin-top: 0.75rem;
    font-size: 0.85rem;
}

.console-actions label {
    cursor: pointer;
}

/* --- Footer --- */

footer {
    text-align: center;
    padding: 2rem 1rem;
    color: #86868b;
    font-size: 0.85rem;
}

footer a {
    color: #0066cc;
    text-decoration: none;
}

footer a:hover {
    text-decoration: underline;
}
