/* ──────────────────────────────────────────────────────────────────
   Recipe edit page — tab + collapse + stato salvataggio pending
   Portato dal ramo AMRIZE. Tutto sotto .recipe-edit-page per non
   sporcare il resto dell'app.
   ────────────────────────────────────────────────────────────────── */

.recipe-edit-page {
    transition: background 0.12s ease;
}

/* Con i tab le due colonne originali non servono: pannelli a piena larghezza */
.recipe-edit-page .col-md-6 {
    width: 100%;
}

/* Colonna unica dei tab: ogni tab occupa tutta la larghezza */
.recipe-edit-page .re-tab-col {
    width: 100%;
    float: none;
    padding-left: 0;
    padding-right: 0;
}

/* Corpo pagina a tutto schermo: riempie l'altezza disponibile, scroll interno */
.recipe-edit-page .re-page-body {
    height: calc(100vh - 120px);
    overflow-y: auto;
    margin-bottom: 0;
}

/* ─── Collapse pannelli ─────────────────────────────────────────── */
.recipe-edit-page .cn-chevron {
    color: #1ab394;
    font-weight: 700;
    transition: transform .15s ease;
    display: inline-block;
    width: 1rem;
    text-align: center;
    margin-right: 0.25rem;
}
.recipe-edit-page .panel.panel-info > .panel-heading {
    cursor: pointer;
    position: relative;
    /* Title in absolute non riserva spazio: garantisco l'altezza di una riga
       così l'heading senza bottoni (Other info) non collassa. */
    min-height: 39px;
}
/* Titoli pannelli (Curves / Partialization / Other info) centrati e allineati.
   Title in absolute centrato orizzontalmente: fuori dal flusso, così né i bottoni
   pull-right né il chevron lo spostano, e non aggiunge altezza all'heading. */
.recipe-edit-page .panel.panel-info > .panel-heading > .panel-title {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
}
/* Chevron leggermente più a sinistra, senza spostare il titolo centrato. */
.recipe-edit-page .cn-chevron {
    margin-left: -0.5rem;
}
.recipe-edit-page .panel.panel-info.cn-collapsed > .panel-heading .cn-chevron {
    transform: rotate(-90deg);
}
.recipe-edit-page .panel.panel-info.cn-collapsed > .panel-body,
.recipe-edit-page .panel.panel-info.cn-collapsed > .table,
.recipe-edit-page .panel.panel-info.cn-collapsed > .panel-footer {
    display: none !important;
}
/* Stampa PDF: togli il clamp di altezza/scroll interno, altrimenti html2canvas cattura solo la parte visibile e taglia il resto */
.recipe-edit-page.re-printing .re-page-body {
    height: auto !important;
    overflow: visible !important;
}
/* Stampa PDF: solo il tab corrente, ma espandi i suoi pannelli collassati (altrimenti html2canvas taglia il body nascosto) */
.recipe-edit-page.re-printing .panel.panel-info.cn-collapsed > .panel-body,
.recipe-edit-page.re-printing .panel.panel-info.cn-collapsed > .table,
.recipe-edit-page.re-printing .panel.panel-info.cn-collapsed > .panel-footer {
    display: block !important;
}

/* ─── Strip dei tab ─────────────────────────────────────────────── */
.recipe-edit-page .re-tabs {
    display: flex;
    list-style: none;
    margin: 0 0 0.75rem 0;
    padding: 0 0.5rem;
    background: var(--surface-1);
    border-bottom: 2px solid var(--border-color);
    overflow-x: auto;
    overflow-y: hidden;
    white-space: nowrap;
    gap: 0.2rem;
    transition: background 0.12s ease, border-bottom-color 0.12s ease;
}
.recipe-edit-page .re-tabs li { flex: 0 0 auto; }
.recipe-edit-page .re-tabs li .re-tab-btn {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.6rem 1.1rem;
    color: var(--text-muted);
    font-size: 0.92rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    cursor: pointer;
    border: none;
    border-bottom: 3px solid transparent;
    border-radius: 3px 3px 0 0;
    background: transparent;
    outline: none;
    transition: color 0.12s ease, border-color 0.12s ease, background 0.12s ease;
}
.recipe-edit-page .re-tabs li .re-tab-btn:hover {
    color: var(--text-body);
    background: var(--surface-2);
    border-bottom-color: var(--border-strong);
}
.recipe-edit-page .re-tabs li.active .re-tab-btn {
    color: #1ab394;
    background: var(--surface-0);
    border-bottom-color: #1ab394;
}
/* Print unico spinto a destra sulla strip dei tab, allineato verticalmente */
.recipe-edit-page .re-tabs li.re-tab-print {
    margin-left: auto;
    display: flex;
    align-items: center;
}

/* ─── Stato "modifiche non salvate" ─────────────────────────────── */
.recipe-edit-page.re-is-dirty {
    background: #ffe3c2;
}
.recipe-edit-page .re-dirty-hint {
    background: #f0b400;
    color: #5a3e00;
    font-weight: 600;
    padding: 6px 12px;
    border-radius: 4px;
    margin-bottom: 8px;
}
.recipe-edit-page.re-is-dirty .re-tabs {
    background: #fffbeb;
    border-bottom-color: #f0b400;
}
.recipe-edit-page.re-is-dirty .re-tabs li.active .re-tab-btn {
    background: #fffbeb;
}

/* ─── Bottone salva: macchina a stati ───────────────────────────── */
.recipe-edit-page .btn-save-recipe {
    min-width: 7rem;
    transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}
.recipe-edit-page .btn-save-recipe[disabled] {
    opacity: 0.55;
    cursor: not-allowed;
}
.recipe-edit-page .btn-save-recipe.state-saved {
    background: #18a689;
    border-color: #18a689;
}
.recipe-edit-page .re-dirty-dot {
    display: inline-block;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #f0b400;
    vertical-align: middle;
    margin-left: 4px;
    animation: re-dirty-pulse 1.5s ease-in-out infinite;
}
@keyframes re-dirty-pulse {
    0%, 100% { opacity: 1; }
    50%      { opacity: 0.4; }
}

/* ─── Sequenze (ritardi mixer + sequenza di carico) ─────────────── */
/* Layout a tabella chiaro, palette coerente con claude.css.        */

/* Selettore mixer */
.recipe-edit-page .re-seq-mixers {
    text-align: center;
    margin-bottom: 0.75rem;
}
.recipe-edit-page .re-seq-mixers-label {
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-right: 0.5rem;
    vertical-align: middle;
}

/* Contenitore a tutto schermo */
.recipe-edit-page .re-seq-wrap,
.recipe-edit-page .re-seq-loader {
    width: 100%;
}

/* Riquadro di spiegazione */
.recipe-edit-page .re-seq-hint {
    display: flex;
    gap: 0.6rem;
    align-items: flex-start;
    background: var(--accent-soft);
    border: 1px solid var(--accent-soft-border);
    border-left: 3px solid var(--accent);
    border-radius: 6px;
    padding: 0.7rem 0.9rem;
    margin: 0.25rem 0 1rem;
    text-align: left;
    color: var(--text-body);
    font-size: 1.12rem;
}
.recipe-edit-page .re-seq-hint > .fa {
    color: var(--accent-text);
    font-size: 1.4rem;
    margin-top: 0.15rem;
    flex-shrink: 0;
}
.recipe-edit-page .re-seq-hint p {
    margin: 0 0 0.35rem;
    font-weight: 700;
    color: var(--accent-text-strong);
}
.recipe-edit-page .re-seq-hint ul {
    margin: 0;
    padding-left: 1.1rem;
}
.recipe-edit-page .re-seq-hint li { margin-bottom: 0.15rem; }

/* Intestazione colonne + righe: stessa griglia */
.recipe-edit-page .re-seq-head,
.recipe-edit-page .re-seq-row {
    display: grid;
    grid-template-columns: 2.4rem 2.6rem 1fr 9rem 9rem 2.4rem;
    align-items: center;
    gap: 0.6rem;
}
.recipe-edit-page .re-seq-head {
    padding: 0 0.7rem 0.4rem;
    font-size: 0.86rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    text-align: left;
    border-bottom: 2px solid var(--border-color);
}

.recipe-edit-page .re-seq-list {
    list-style: none;
    margin: 0.6rem 0 0;
    padding: 0;
}

.recipe-edit-page .re-seq-row {
    background: var(--surface-0);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 0.55rem 0.7rem;
    margin-bottom: 0.5rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    transition: box-shadow 0.12s ease, border-color 0.12s ease;
}
.recipe-edit-page .re-seq-row:hover {
    border-color: var(--accent);
    box-shadow: 0 2px 8px rgba(37,99,235,0.12);
}
/* stato di trascinamento (classi aggiunte da ng-sortable) */
.recipe-edit-page .re-seq-row.as-sortable-dragging,
.recipe-edit-page .as-sortable-drag .re-seq-row {
    border-color: var(--accent);
    box-shadow: 0 6px 16px rgba(0,0,0,0.2);
    opacity: 0.97;
}
.recipe-edit-page .as-sortable-placeholder {
    border: 1px solid var(--accent);
    border-radius: 6px;
    background: var(--accent-soft);
    min-height: 3rem;
    margin-bottom: 0.5rem;
}

/* Colonna frecce su/giù */
.recipe-edit-page .re-seq-move {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.recipe-edit-page .re-seq-arrow {
    border: 1px solid var(--border-strong);
    background: var(--surface-1);
    color: var(--text-muted);
    border-radius: 4px;
    width: 1.9rem;
    height: 1.1rem;
    line-height: 1;
    font-size: 0.82rem;
    cursor: pointer;
    padding: 0;
    transition: background 0.12s, color 0.12s, border-color 0.12s;
}
.recipe-edit-page .re-seq-arrow:hover:not([disabled]) {
    background: var(--accent-soft);
    border-color: var(--accent);
    color: var(--accent-text);
}
.recipe-edit-page .re-seq-arrow[disabled] {
    opacity: 0.4;
    cursor: not-allowed;
}

/* Maniglia di trascinamento */
.recipe-edit-page .re-seq-handle {
    cursor: grab;
    color: var(--text-faint);
    text-align: center;
    font-size: 1rem;
}
.recipe-edit-page .re-seq-handle:hover { color: var(--accent-text); }
.recipe-edit-page .re-seq-handle:active { cursor: grabbing; }

/* Badge numero sequenza */
.recipe-edit-page .re-seq-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.9rem;
    height: 1.9rem;
    border-radius: 50%;
    background: var(--accent);
    color: #fff;
    font-weight: 700;
    font-size: 0.98rem;
    font-family: 'Share Tech Mono', monospace, sans-serif;
}

.recipe-edit-page .re-seq-name {
    font-weight: 600;
    font-size: 1.15rem;
    color: var(--text-strong);
    text-align: left;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Select tipo, colorata per significato */
.recipe-edit-page .re-seq-type-select { font-weight: 700; font-size: 1.1rem; }
.recipe-edit-page .re-type-start { color: var(--success-text); }
.recipe-edit-page .re-type-stop  { color: var(--danger-text); }
.recipe-edit-page .re-type-pct   { color: var(--warning-text); }

/* Valore con unità */
.recipe-edit-page .re-seq-val-wrap { position: relative; }
.recipe-edit-page .re-seq-val-input {
    padding-right: 1.8rem;
    text-align: right;
    font-size: 1.12rem;
    font-family: 'Share Tech Mono', monospace, sans-serif;
}
.recipe-edit-page .re-seq-val-unit {
    position: absolute;
    right: 0.6rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-faint);
    font-size: 0.92rem;
    pointer-events: none;
}

.recipe-edit-page .re-seq-empty {
    text-align: center;
    color: var(--text-muted);
    padding: 1.5rem;
    background: var(--surface-1);
    border: 1px dashed var(--border-strong);
    border-radius: 6px;
}
