/* ================================================================
   SOA JSON ↔ YAML — v1.0.0
   ================================================================ */

/* ── Largeur / Breakout ────────────────────────────────────────── */
.soa-jy {
    /* défaut = Medium */
    width: min(1100px, 100%);
    margin-left: auto;
    margin-right: auto;
    transition: width .25s ease, max-width .25s ease, transform .25s ease, left .25s ease;
}
/* Small — suit la colonne de contenu du thème */
.soa-jy--w-s {
    width: 100%;
    max-width: 760px;
    left: auto;
    transform: none;
    position: relative;
}
/* Medium */
.soa-jy--w-m {
    width: min(1100px, 100%);
    max-width: 1100px;
    left: auto;
    transform: none;
    position: relative;
}
/* Large — breakout pleine largeur viewport */
.soa-jy--w-l {
    width:  100vw;
    max-width: 100vw;
    position: relative;
    left: 50%;
    transform: translateX(-50%);
}

/* ── Variables ─────────────────────────────────────────────────── */
.soa-jy {
    --soa-purple:     #6c63ff;
    --soa-blue:       #4a90d9;
    --soa-green:      #27ae60;
    --soa-bg:         #0f0f1a;
    --soa-surface:    #1a1a2e;
    --soa-surface2:   #16213e;
    --soa-border:     rgba(108,99,255,.22);
    --soa-text:       #e8e8f0;
    --soa-muted:      #8888aa;
    --soa-radius:     14px;
    --soa-radius-sm:  8px;
    --soa-shadow:     0 8px 40px rgba(0,0,0,.55);

    /* JSON syntax */
    --jy-key:   #79b8ff;
    --jy-str:   #85e89d;
    --jy-num:   #f8c555;
    --jy-bool:  #ff9e64;
    --jy-null:  #a0a0b0;
    --jy-punc:  #8b8baa;

    /* YAML syntax */
    --jy-yk:    #79b8ff;   /* clé YAML */
    --jy-ys:    #85e89d;   /* valeur string */
    --jy-yc:    #6a9955;   /* commentaire */
    --jy-ya:    #c792ea;   /* ancre/alias */
    --jy-yd:    #ff9e64;   /* directive / --- */

    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    color: var(--soa-text);
    box-sizing: border-box;
}
.soa-jy *, .soa-jy *::before, .soa-jy *::after { box-sizing: inherit; }

/* ── Hero Card ─────────────────────────────────────────────────── */
.soa-jy__card {
    background: radial-gradient(ellipse at top left, #1a1a2e 0%, #16213e 40%, #0f3460 100%);
    border: 1px solid var(--soa-border);
    border-radius: var(--soa-radius);
    padding: 2.5rem 2.8rem 2.2rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--soa-shadow);
    position: relative;
    overflow: hidden;
}
.soa-jy__card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at 80% 20%, rgba(108,99,255,.12) 0%, transparent 60%);
    pointer-events: none;
}
.soa-jy__eyebrow {
    display: inline-block;
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: var(--soa-purple);
    margin-bottom: .55rem;
}
.soa-jy__title {
    margin: 0 0 .5rem;
    font-size: clamp(1.5rem, 3vw, 2rem);
    font-weight: 800;
    background: linear-gradient(135deg, #fff 30%, var(--soa-purple));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1.2;
}
.soa-jy__subtitle {
    margin: 0;
    font-size: .9rem;
    color: var(--soa-muted);
    line-height: 1.55;
}

/* ── Workbench ─────────────────────────────────────────────────── */
.soa-jy__workbench {
    background: var(--soa-surface);
    border: 1px solid var(--soa-border);
    border-radius: var(--soa-radius);
    box-shadow: var(--soa-shadow);
    overflow: hidden;
}

/* ── Topbar ────────────────────────────────────────────────────── */
.soa-jy__topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    padding: .7rem 1rem;
    background: rgba(255,255,255,.03);
    border-bottom: 1px solid var(--soa-border);
    flex-wrap: wrap;
}
.soa-jy__topbar-convert,
.soa-jy__topbar-utils {
    display: flex;
    align-items: center;
    gap: .45rem;
    flex-wrap: wrap;
}

/* Boutons topbar communs */
.soa-jy__topbar button {
    padding: .38rem .85rem;
    border: 1px solid var(--soa-border);
    border-radius: var(--soa-radius-sm);
    background: rgba(255,255,255,.055);
    color: var(--soa-text);
    font-size: .8rem;
    font-weight: 600;
    cursor: pointer;
    transition: background .18s, border-color .18s, transform .12s;
    white-space: nowrap;
}
.soa-jy__topbar button:hover {
    background: rgba(108,99,255,.22);
    border-color: var(--soa-purple);
}
.soa-jy__topbar button:active { transform: scale(.96); }

/* ── Groupe largeur ────────────────────────────────────────────── */
.soa-jy__width-group {
    display: flex;
    align-items: center;
    gap: .3rem;
}
.soa-jy__topbar-lbl {
    font-size: .72rem;
    color: var(--soa-muted);
    white-space: nowrap;
    margin-right: .1rem;
}
.soa-jy__w-btn {
    padding: .28rem .55rem;
    border: 1px solid var(--soa-border);
    border-radius: var(--soa-radius-sm);
    background: rgba(255,255,255,.04);
    color: var(--soa-muted);
    font-size: .75rem;
    font-weight: 700;
    cursor: pointer;
    transition: background .15s, color .15s, border-color .15s;
    min-width: 26px;
    text-align: center;
}
.soa-jy__w-btn:hover {
    background: rgba(108,99,255,.18);
    color: var(--soa-text);
    border-color: var(--soa-purple);
}
.soa-jy__w-btn--active {
    background: rgba(108,99,255,.28) !important;
    border-color: var(--soa-purple) !important;
    color: #d0ccff !important;
}

/* ── Séparateur vertical ───────────────────────────────────────── */
.soa-jy__topbar-sep {
    width: 1px;
    height: 22px;
    background: var(--soa-border);
    margin: 0 .15rem;
    flex-shrink: 0;
}

.soa-jy__btn-j2y {
    background: rgba(108,99,255,.18) !important;
    border-color: var(--soa-purple) !important;
    color: #c2bfff !important;
}
.soa-jy__btn-j2y:hover { background: rgba(108,99,255,.32) !important; }

.soa-jy__btn-y2j {
    background: rgba(74,144,217,.18) !important;
    border-color: var(--soa-blue) !important;
    color: #a8d0f5 !important;
}
.soa-jy__btn-y2j:hover { background: rgba(74,144,217,.32) !important; }

/* ── Infobar ───────────────────────────────────────────────────── */
.soa-jy__infobar {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: .42rem 1rem;
    background: rgba(0,0,0,.18);
    border-bottom: 1px solid var(--soa-border);
    font-size: .78rem;
    flex-wrap: wrap;
    min-height: 34px;
}
.soa-jy__validity {
    font-weight: 700;
    font-size: .78rem;
    padding: .15rem .55rem;
    border-radius: 20px;
}
.soa-jy__validity--empty  { color: var(--soa-muted); background: transparent; }
.soa-jy__validity--valid  { color: #34d399; background: rgba(52,211,153,.12); }
.soa-jy__validity--invalid{ color: #f87171; background: rgba(248,113,113,.12); }

.soa-jy__stats { display: flex; align-items: center; gap: .65rem; }
.soa-jy__stat  { color: var(--soa-muted); font-size: .76rem; white-space: nowrap; }
.soa-jy__stat strong { color: var(--soa-text); font-weight: 600; }

.soa-jy__auto-hint {
    margin-left: auto;
    font-size: .73rem;
    color: var(--soa-purple);
    opacity: 0;
    transition: opacity .3s;
    white-space: nowrap;
}
.soa-jy__auto-hint--visible { opacity: 1; }

/* ── Error ─────────────────────────────────────────────────────── */
.soa-jy__error {
    margin: .6rem 1rem;
    padding: .6rem .9rem;
    background: rgba(231,76,60,.12);
    border: 1px solid rgba(231,76,60,.35);
    border-left: 3px solid #e74c3c;
    border-radius: var(--soa-radius-sm);
    color: #fca5a5;
    font-size: .82rem;
    font-family: 'Fira Code', 'Cascadia Code', Consolas, monospace;
    line-height: 1.5;
}

/* ── Split layout ──────────────────────────────────────────────── */
.soa-jy__split {
    display: flex;
    align-items: stretch;
    height: 520px;
}

/* ── Panes ─────────────────────────────────────────────────────── */
.soa-jy__pane {
    flex: 1 1 0;
    min-width: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.soa-jy__pane-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: .4rem .8rem;
    background: rgba(255,255,255,.03);
    border-bottom: 1px solid var(--soa-border);
    flex-shrink: 0;
}
.soa-jy__pane--json .soa-jy__pane-header {
    border-right: none;
}

.soa-jy__pane-label {
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--soa-muted);
}
.soa-jy__pane--json .soa-jy__pane-label { color: #c2bfff; }
.soa-jy__pane--yaml .soa-jy__pane-label { color: #a8d0f5; }

.soa-jy__pane-actions {
    display: flex;
    gap: .35rem;
}
.soa-jy__pane-actions button {
    padding: .22rem .6rem;
    border: 1px solid var(--soa-border);
    border-radius: var(--soa-radius-sm);
    background: rgba(255,255,255,.05);
    color: var(--soa-muted);
    font-size: .72rem;
    font-weight: 600;
    cursor: pointer;
    transition: background .15s, color .15s;
    white-space: nowrap;
}
.soa-jy__pane-actions button:hover {
    background: rgba(108,99,255,.22);
    color: var(--soa-text);
    border-color: var(--soa-purple);
}
.soa-jy__pane-actions button.soa-jy--copied {
    color: #34d399;
    border-color: rgba(52,211,153,.4);
    background: rgba(52,211,153,.1);
}

/* ── Editor wrap (line-nums + textarea) ────────────────────────── */
.soa-jy__editor-wrap {
    flex: 1;
    display: flex;
    overflow: hidden;
    position: relative;
}

.soa-jy__line-nums {
    width: 38px;
    flex-shrink: 0;
    background: rgba(0,0,0,.25);
    border-right: 1px solid var(--soa-border);
    padding: .8rem 0;
    overflow: hidden;
    text-align: right;
    user-select: none;
    font-family: 'Fira Code', 'Cascadia Code', Consolas, monospace;
    font-size: .78rem;
    line-height: 1.6;
    color: #555570;
}
.soa-jy__line-nums span {
    display: block;
    padding-right: 6px;
}

.soa-jy__ta {
    flex: 1;
    min-width: 0;
    resize: none;
    border: none;
    outline: none;
    background: rgba(0,0,0,.22);
    color: var(--soa-text);
    font-family: 'Fira Code', 'Cascadia Code', Consolas, monospace;
    font-size: .82rem;
    line-height: 1.6;
    padding: .8rem .9rem;
    white-space: pre;
    overflow-wrap: normal;
    overflow: auto;
    transition: border-left .2s;
}
.soa-jy__ta::placeholder { color: #44445a; }
.soa-jy__ta:focus { outline: none; box-shadow: inset 0 0 0 1px rgba(108,99,255,.35); }
.soa-jy__ta--error { border-left: 3px solid #e74c3c !important; }

/* ── Resize handle ─────────────────────────────────────────────── */
.soa-jy__resize-handle {
    width: 6px;
    flex-shrink: 0;
    background: var(--soa-border);
    cursor: col-resize;
    position: relative;
    transition: background .18s;
    z-index: 2;
}
.soa-jy__resize-handle:hover,
.soa-jy__resize-handle--dragging {
    background: var(--soa-purple);
}
.soa-jy__resize-handle::after {
    content: '⋮';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: rgba(255,255,255,.25);
    font-size: 1rem;
    letter-spacing: -2px;
    pointer-events: none;
}

/* ── Responsive ────────────────────────────────────────────────── */
@media (max-width: 700px) {
    .soa-jy__split {
        flex-direction: column;
        height: auto;
    }
    .soa-jy__pane {
        height: 260px;
    }
    .soa-jy__resize-handle {
        width: 100%;
        height: 5px;
        cursor: row-resize;
    }
    .soa-jy__resize-handle::after { content: '···'; }
    .soa-jy__topbar {
        flex-direction: column;
        align-items: flex-start;
    }
    .soa-jy__btn-j2y,
    .soa-jy__btn-y2j { font-size: .72rem; padding: .3rem .6rem; }
}
