/*
 * Zeendoc Tools — styles conformes à la charte graphique Zeendoc (06/2025).
 *
 * Typographies : Raleway (titres, sous-titres), Nunito Sans (texte courant).
 * Couleurs : marine #000064 (dominante), corail #FA4641 (touche d'accent,
 * formes et grands textes uniquement), rose #FFDCD9, blanc.
 * Associations texte/fond limitées à celles déclarées accessibles.
 */

:root {
    --navy: #000064;
    --coral: #FA4641;
    --pink: #FFDCD9;
    --pink-strong: #FFC8C6;
    --white: #FFFFFF;
    --ink: #000064;
    --ink-soft: rgba(0, 0, 100, .68);
    --line: rgba(0, 0, 100, .14);
    --line-strong: rgba(0, 0, 100, .3);
    --surface: #FFFFFF;
    --page: #FFDCD9;
    --radius: 10px;
    --font-title: 'Raleway', 'Nunito Sans', Arial, sans-serif;
    --font-text: 'Nunito Sans', Arial, Helvetica, sans-serif;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    padding: 28px 16px 40px;
    font-family: var(--font-text);
    font-size: 15px;
    line-height: 1.45;
    background: var(--page);
    color: var(--ink);
    accent-color: var(--navy);
}

.container {
    max-width: 980px;
    margin: 0 auto;
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: 0 10px 30px rgba(0, 0, 100, .10);
    overflow: hidden;
}

/* ---------------------------------------------------------------- En-tête */

header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    /* zone de protection du logo : au moins 1/3 de sa hauteur */
    padding: 22px 30px;
    background: var(--navy);
    color: var(--white);
}

.brand { display: flex; align-items: center; gap: 22px; }

.logo {
    display: block;
    width: 170px;          /* taille minimale charte : 150 px */
    height: auto;
}

h1 {
    margin: 0;
    padding-left: 22px;
    border-left: 1px solid rgba(255, 255, 255, .35);
    font-family: var(--font-title);
    font-weight: 500;
    font-size: 24px;
    letter-spacing: .01em;
    color: var(--white);
}

#session-info {
    font-size: 13px;
    color: var(--white);
    opacity: .9;
    text-align: right;
}

/* ---------------------------------------------------------------- Onglets */

.tabs { display: flex; border-bottom: 1px solid var(--line); background: var(--white); }

.tab {
    flex: 1;
    padding: 16px 14px 13px;
    border: 0;
    border-bottom: 3px solid transparent;
    border-radius: 0;
    background: var(--white);
    color: var(--ink-soft);
    font-family: var(--font-title);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
}

.tab:hover { background: var(--white); color: var(--navy); }
.tab.active { color: var(--navy); border-bottom-color: var(--coral); }
.tab:disabled { cursor: not-allowed; opacity: .45; }

.panel { display: none; padding: 30px; }
.panel.active { display: block; }

/* ---------------------------------------------------------------- Formulaire */

fieldset {
    margin: 0 0 24px;
    padding: 18px 20px 8px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    min-width: 0;
}

legend {
    padding: 0 8px;
    font-family: var(--font-title);
    font-weight: 700;
    font-size: 16px;
    color: var(--navy);
}

legend label { cursor: pointer; }

.field { margin-bottom: 14px; }

label.block {
    display: block;
    margin-bottom: 6px;
    font-weight: 700;
    font-size: 14px;
}

input[type=text], input[type=password], input[type=number], select, textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--line-strong);
    border-radius: 6px;
    font-family: var(--font-text);
    font-size: 15px;
    color: var(--ink);
    background: var(--white);
}

input:focus-visible, select:focus-visible, button:focus-visible, .tab:focus-visible {
    outline: 2px solid var(--coral);
    outline-offset: 2px;
}

input[type=checkbox], input[type=radio] { width: 16px; height: 16px; vertical-align: -3px; }

.inline-input { width: 120px !important; padding: 4px 8px !important; }
.inline-select { width: auto !important; padding: 4px 8px !important; }

.row { display: flex; gap: 14px; flex-wrap: wrap; }
.row > * { flex: 1 1 190px; }

.help { margin-top: 6px; color: var(--ink-soft); font-size: 13px; }
.help code { background: var(--pink); color: var(--navy); padding: 1px 5px; border-radius: 4px; }

.spaced { margin-top: 12px; }
.spaced-bottom { margin-bottom: 10px; }
.block-line { display: block; }
[hidden] { display: none !important; }

.radio-line { display: flex; gap: 20px; flex-wrap: wrap; margin-bottom: 12px; }
.radio-line label { cursor: pointer; }

/* ---------------------------------------------- Colonnes et ordre (DnD) */

.columns-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr);
    gap: 18px;
}

.columns {
    height: 340px;
    overflow: auto;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 8px 12px;
}

.columns label {
    display: block;
    padding: 3px 0;
    font-size: 14px;
    cursor: pointer;
}

.columns code, .muted { color: var(--ink-soft); font-size: 12px; }

.columns h4 {
    margin: 8px 0 6px;
    font-family: var(--font-title);
    font-size: 13px;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--navy);
}

.slow { color: var(--navy); font-size: 12px; font-weight: 700; }
.slow::first-letter { color: var(--coral); }

.order-title {
    font-family: var(--font-title);
    font-weight: 700;
    font-size: 14px;
    margin: 6px 0 12px;
}

.order {
    height: 340px;
    overflow: auto;
    margin: 0;
    padding: 6px;
    list-style: none;
    counter-reset: col;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--white);
}

.order li {
    counter-increment: col;
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 4px;
    padding: 6px 6px 6px 8px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: var(--white);
    font-size: 13px;
    cursor: grab;
    user-select: none;
}

.order li:hover { border-color: var(--line-strong); }

.order li::before {
    content: counter(col);
    min-width: 20px;
    color: var(--ink-soft);
    font-size: 12px;
}

.order li .name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.order li.fixed { background: var(--pink); border-color: var(--pink-strong); }
.order li.dragging { opacity: .4; }
.order li.drop-before { box-shadow: 0 -3px 0 var(--coral); }
.order li.drop-after { box-shadow: 0 3px 0 var(--coral); }

.order li button {
    padding: 2px 7px;
    background: transparent;
    color: var(--ink-soft);
    font-size: 12px;
    font-weight: 400;
}

.order li button:hover { background: var(--pink); color: var(--navy); }
.order li button:disabled { background: transparent; opacity: .3; cursor: default; }

.criterion { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.criterion select, .criterion input { flex: 1 1 150px; width: auto; }

/* ---------------------------------------------------------------- Boutons */

button {
    padding: 11px 20px;
    border: 0;
    border-radius: 6px;
    background: var(--navy);
    color: var(--white);
    font-family: var(--font-title);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color .15s, color .15s;
}

button:hover { background: #2D2341; }
button:disabled { opacity: .5; cursor: wait; }
button.light { background: var(--pink); color: var(--navy); }
button.light:hover { background: var(--pink-strong); }
button.danger { background: var(--coral); color: var(--navy); }
button.danger:hover { background: #FFA2A0; }
button.small { padding: 6px 11px; font-size: 13px; }

.actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

/* ---------------------------------------------------------------- Retours */

#message { margin-top: 16px; font-weight: 600; white-space: pre-line; }

.error {
    padding: 10px 14px;
    border-left: 4px solid var(--coral);
    background: var(--pink);
    color: var(--navy);
    font-weight: 700;
    white-space: pre-line;
}

#message:not(.error):empty { display: none; }

progress {
    width: 100%;
    height: 10px;
    margin-top: 18px;
    border: 0;
    border-radius: 5px;
    background: var(--pink);
    overflow: hidden;
    appearance: none;
}

progress::-webkit-progress-bar { background: var(--pink); border-radius: 5px; }
progress::-webkit-progress-value { background: var(--coral); border-radius: 5px; }
progress::-moz-progress-bar { background: var(--coral); border-radius: 5px; }

.preview { margin-top: 16px; overflow: auto; max-height: 320px; border: 1px solid var(--line); border-radius: 8px; }
.preview table { border-collapse: collapse; font-size: 12px; min-width: 100%; }
.preview th, .preview td { padding: 6px 9px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; max-width: 280px; overflow: hidden; text-overflow: ellipsis; }
.preview th { position: sticky; top: 0; background: var(--navy); color: var(--white); font-family: var(--font-title); font-weight: 600; }

#update-box {
    display: none;
    margin-top: 18px;
    padding: 16px;
    border-left: 4px solid var(--coral);
    border-radius: 0 var(--radius) var(--radius) 0;
    background: var(--pink);
}

#update-summary { font-weight: 700; }

/* ---------------------------------------------------------- Test recherche */

.query-info {
    margin: 4px 0 14px;
    padding: 10px 14px;
    border-radius: 8px;
    background: var(--pink);
    font-size: 14px;
    white-space: pre-line;
}

.query-info strong { font-family: var(--font-title); }
.query-info.warn { border-left: 4px solid var(--coral); }

.query-info.alert {
    padding: 14px 16px;
    border: 2px solid var(--coral);
    border-left-width: 6px;
    background: var(--white);
    color: var(--navy);
    font-weight: 700;
}

/* ---------------------------------------------------------------- Import */

.notice {
    margin-bottom: 18px;
    padding: 12px 14px;
    border-left: 4px solid var(--coral);
    border-radius: 0 8px 8px 0;
    background: var(--pink);
    font-size: 14px;
}

.notice code { background: var(--white); padding: 1px 5px; border-radius: 4px; }

input[type=file] {
    width: 100%;
    padding: 14px;
    border: 2px dashed var(--line-strong);
    border-radius: 8px;
    font-family: var(--font-text);
    color: var(--ink);
    background: var(--white);
    cursor: pointer;
}

input[type=file]::file-selector-button {
    margin-right: 12px;
    padding: 8px 14px;
    border: 0;
    border-radius: 6px;
    background: var(--navy);
    color: var(--white);
    font-family: var(--font-title);
    font-weight: 600;
    cursor: pointer;
}

#imp-files-info { font-weight: 700; }

.table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: 8px; }

table.mapping { width: 100%; border-collapse: collapse; font-size: 14px; }

table.mapping th {
    padding: 8px 10px;
    background: var(--navy);
    color: var(--white);
    font-family: var(--font-title);
    font-weight: 600;
    text-align: left;
}

table.mapping td { padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.mapping td:first-child { width: 34%; }
table.mapping td:nth-child(2) { width: 36%; }
table.mapping select { padding: 7px 8px; font-size: 14px; }
table.mapping code { color: var(--ink-soft); font-size: 12px; }

.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 700;
    border: 1px solid var(--line-strong);
    color: var(--navy);
    background: var(--white);
}

.badge-label, .badge-saved, .badge-manual { background: var(--navy); border-color: var(--navy); color: var(--white); }
.badge-code, .badge-conflict { background: var(--coral); border-color: var(--coral); color: var(--navy); }

.map-status .muted { font-size: 12px; }

.problems { margin: 8px 0 12px; padding-left: 20px; font-size: 13px; }
.problems li { margin-bottom: 3px; }

pre.json {
    max-height: 260px;
    overflow: auto;
    margin: 0;
    padding: 12px;
    border-radius: 8px;
    background: var(--navy);
    color: var(--white);
    font-size: 12px;
}

.message { margin-top: 14px; font-weight: 600; white-space: pre-line; }
.message:not(.error):empty { display: none; }

textarea { font-family: var(--font-text); resize: vertical; }

.preview td.changed { font-weight: 700; }
#rx-pairs td { vertical-align: middle; }
#rx-types { white-space: pre-line; }
#rx-pairs td:nth-child(3), #rx-pairs td:nth-child(4) { width: 1%; white-space: nowrap; text-align: center; }
.pair-stats { margin: 6px 0 10px; font-size: 13px; }
.pair-stats td, .pair-stats th { padding: 4px 8px; border-bottom: 1px solid var(--line); text-align: left; }
.preview td.skip { color: var(--ink-soft); }

/* ---------------------------------------------------------------- Mobile */

@media (max-width: 700px) {
    body { padding: 0; }
    .container { border-radius: 0; }
    .panel { padding: 20px 16px; }
    header { flex-direction: column; align-items: flex-start; padding: 18px 16px; }
    .logo { width: 150px; }
    h1 { font-size: 20px; }
    #session-info { text-align: left; }
    .columns-layout { grid-template-columns: 1fr; }
    .columns, .order { height: 260px; }
}
