html, body {
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
}

h1:focus {
    outline: none;
}

a, .btn-link {
    color: #0071c1;
}

.btn-primary {
    color: #fff;
    background-color: #1b6ec2;
    border-color: #1861ac;
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
  box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
}

.content {
    padding-top: 1.1rem;
}

.valid.modified:not([type=checkbox]) {
    outline: 1px solid #26b050;
}

.invalid {
    outline: 1px solid red;
}

.validation-message {
    color: red;
}

#blazor-error-ui {
    color-scheme: light only;
    background: lightyellow;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    box-sizing: border-box;
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

    #blazor-error-ui .dismiss {
        cursor: pointer;
        position: absolute;
        right: 0.75rem;
        top: 0.5rem;
    }

.blazor-error-boundary {
    background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZD0iY2xpcDAiPjxyZWN0IHg9IjIzNSIgeT0iNTEiIHdpZHRoPSI1NiIgaGVpZ2h0PSI0OSIvPjwvY2xpcFBhdGg+PC9kZWZzPjxnIGNsaXAtcGF0aD0idXJsKCNjbGlwMCkiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0yMzUgLTUxKSI+PHBhdGggZD0iTTI2My41MDYgNTFDMjY0LjcxNyA1MSAyNjUuODEzIDUxLjQ4MzcgMjY2LjYwNiA1Mi4yNjU4TDI2Ny4wNTIgNTIuNzk4NyAyNjcuNTM5I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I2My41NzYgODYuMDU0N1oiIGZpbGw9IiNGRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=) no-repeat 1rem/1.8rem, #b32121;
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
}

    .blazor-error-boundary::after {
        content: "An error has occurred."
    }

.loading-progress {
    position: absolute;
    display: block;
    width: 8rem;
    height: 8rem;
    inset: 20vh 0 auto 0;
    margin: 0 auto 0 auto;
}

    .loading-progress circle {
        fill: none;
        stroke: #e0e0e0;
        stroke-width: 0.6rem;
        transform-origin: 50% 50%;
        transform: rotate(-90deg);
    }

        .loading-progress circle:last-child {
            stroke: #1b6ec2;
            stroke-dasharray: calc(3.141 * var(--blazor-load-percentage, 0%) * 0.8), 500%;
            transition: stroke-dasharray 0.05s ease-in-out;
        }

.loading-progress-text {
    position: absolute;
    text-align: center;
    font-weight: bold;
    inset: calc(20vh + 3.25rem) 0 auto 0.2rem;
}

    .loading-progress-text:after {
        content: var(--blazor-load-percentage-text, "Loading");
    }

code {
    color: #c02d76;
}

.form-floating > .form-control-plaintext::placeholder, .form-floating > .form-control::placeholder {
    color: var(--bs-secondary-color);
    text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder, .form-floating > .form-control:focus::placeholder {
    text-align: start;
}
/* ── Page Création ─────────────────────────────────────────────────────────── */
.lead { color: #555; margin-bottom: 1.2rem; }

.creation-layout {
    display: grid;
    grid-template-columns: 260px minmax(320px, 1fr) minmax(300px, 1fr);
    gap: 1.1rem;
    align-items: start;
}

@media (max-width: 1100px) {
    .creation-layout { grid-template-columns: 1fr; }
}

.panel {
    background: #fff;
    border: 1px solid #e3e3e3;
    border-radius: 10px;
    padding: 1rem 1.1rem 1.2rem;
    box-shadow: 0 1px 3px rgba(0,0,0,.05);
}

.panel h2 {
    font-size: 1.05rem;
    font-weight: 600;
    margin: 0 0 .8rem;
    padding-bottom: .45rem;
    border-bottom: 1px solid #eee;
    color: #333;
}

/* Formulaire de paramètres */
.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem .7rem; }
.field-grid label, .checkbox {
    display: flex; flex-direction: column; font-size: .78rem; color: #555; gap: .2rem;
}
.field-grid input, .field-grid select {
    padding: .32rem .4rem; border: 1px solid #ccc; border-radius: 6px; font-size: .9rem;
}
.checkbox { flex-direction: row; align-items: center; gap: .45rem; margin-top: .9rem; font-size: .82rem; }
.checkbox input { width: auto; }

/* Tailles explicites de ligne/colonne */
.axis-sizes { margin-top: .7rem; }
.axis-sizes h3 { font-size: .78rem; font-weight: 600; text-transform: uppercase; letter-spacing: .02em; color: #666; margin: 0 0 .4rem; }
.axis-size { display: flex; align-items: center; gap: .4rem; font-size: .78rem; color: #555; margin-bottom: .3rem; }
.axis-size input[type=checkbox] { width: auto; }
.axis-size input[type=number] { width: 5.5rem; padding: .28rem .4rem; border: 1px solid #ccc; border-radius: 6px; font-size: .85rem; }
.axis-size input[type=number]:disabled { background: #f2f2f2; color: #999; }

/* Barre d'outils du dessin */
.toolbar { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .6rem; margin-bottom: .8rem; }
.size-controls, .mode-controls { display: flex; align-items: center; gap: .35rem; font-size: .82rem; color: #555; }
.size-controls button, .mode-controls button, .reset button, .actions button {
    cursor: pointer; border: 1px solid #ccc; background: #f7f7f7; border-radius: 6px; padding: .25rem .55rem; font-size: .85rem;
}
.size-controls button:disabled { opacity: .4; cursor: default; }
.mode-controls button.active { background: #1b6ec2; color: #fff; border-color: #1861ac; }
.ms-3 { margin-left: .8rem; }

/* Éditeur SVG */
.editor-host { display: flex; justify-content: center; padding: .5rem; background: #fafafa; border-radius: 8px; }
.grid-editor { max-width: 100%; height: auto; }
.grid-editor .cell { fill: #f0f4f8; }
.grid-editor .node { fill: #b8c2cc; }
.grid-editor .hit { stroke: transparent; stroke-width: 16; cursor: pointer; }
.grid-editor .edge { stroke-linecap: round; pointer-events: none; }
.grid-editor .edge.empty { stroke: #d3d9df; stroke-width: 2; stroke-dasharray: 3 5; }
.grid-editor .edge.wall { stroke: #d62828; stroke-width: 6; }
.grid-editor .edge.open { stroke: #1d4ed8; stroke-width: 3; stroke-dasharray: 7 5; }
.grid-editor .pull { fill: #fff; stroke: #d62828; stroke-width: 2.5; pointer-events: none; }

/* Légende */
.legend { list-style: none; display: flex; flex-wrap: wrap; gap: .8rem; padding: .8rem 0 0; margin: 0; font-size: .78rem; color: #555; }
.legend li { display: flex; align-items: center; gap: .35rem; }
.swatch { width: 22px; height: 0; border-top: 4px solid #ccc; display: inline-block; }
.swatch.wall { border-top-color: #d62828; }
.swatch.open { border-top: 3px dashed #1d4ed8; }
.swatch.empty { border-top: 2px dashed #d3d9df; }
.swatch.pull { width: 12px; height: 12px; border: 2px solid #d62828; border-radius: 50%; background: #fff; }
.hint { font-size: .76rem; color: #777; margin: .6rem 0 0; }
.reset { margin-top: .8rem; }

/* Aperçu */
.svg-frame { border: 1px solid #eee; border-radius: 8px; padding: .6rem; background:
    repeating-conic-gradient(#f6f6f6 0% 25%, #fff 0% 50%) 50% / 20px 20px; overflow: auto; }
.svg-frame svg { display: block; width: 100%; height: auto; max-height: 420px; }
/* Le plan est à l'échelle 1:1 avec un trait de 0,1 mm : sans cela il deviendrait invisible une
   fois réduit. On garde une épaisseur d'écran constante quelle que soit la mise à l'échelle. */
.svg-frame svg g { stroke-width: 1.3px; }
.svg-frame svg polygon { vector-effect: non-scaling-stroke; }
.actions { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .9rem; }
.actions button.primary { background: #1b6ec2; color: #fff; border-color: #1861ac; }
.actions button:disabled { opacity: .5; cursor: default; }
.error { background: #fff3f3; border: 1px solid #f0b8b8; color: #b32121; border-radius: 8px; padding: .7rem .8rem; font-size: .85rem; }
.source { background: #1e1e1e; color: #d4d4d4; padding: .8rem; border-radius: 8px; font-size: .78rem; margin-top: .8rem; overflow: auto; max-height: 300px; }

.app-tagline { color: #666; font-size: .85rem; }
