/* apviewGo: cornice (header, menu, percorso) + card. I colori vengono dal
   menu PHP (loadwidgetInterfacciaProfiloWidget.php) e dal design system. */

:root {
    --font-size-base: 0.8rem; /* default di settapersonalizzazioneinterfaccia.php */
    --cf-blu: #004d91;
    --cf-arancio: #f66014;
    --cf-azzurro: #9fbcd5;
    --cf-header-h: 52px;
    --cf-menu-w: 260px;
}

html, body { height: 100%; }
body {
    margin: 0;
    background: #f3f4f6;
    font-family: "Roboto", Arial, sans-serif;
}

/* ---------- Header ---------- */
.cf-header {
    position: fixed; top: 0; left: 0; right: 0;
    height: var(--cf-header-h);
    z-index: 100;
    display: flex; align-items: center; gap: 16px;
    padding: 0 16px;
    background: var(--cf-blu);
    color: #fff;
}
.cf-logo { height: 26px; }
.cf-ditta { flex: 1; font-size: 15px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cf-esci { margin: 0; }
.cf-esci button {
    background: transparent; border: 1px solid rgba(255,255,255,.6); color: #fff;
    border-radius: 4px; padding: 4px 14px; font-size: 14px; cursor: pointer;
}
.cf-esci button:hover { background: rgba(255,255,255,.15); }

/* ---------- Corpo: menu + contenuto ---------- */
.cf-corpo { display: flex; padding-top: var(--cf-header-h); min-height: 100%; }

.cf-menu {
    position: fixed; top: var(--cf-header-h); bottom: 0; left: 0;
    width: var(--cf-menu-w);
    overflow-y: auto;
    background: #fff;
    border-right: 1px solid #d7d7d7;
    transition: transform .2s;
}
body.menu-chiuso .cf-menu { transform: translateX(-100%); }
.cf-menu-titolo {
    display: flex; align-items: center; justify-content: space-between;
    padding: 6px 8px 6px 10px;
    background: #e9e9e9;
    font: 400 14px "Roboto", Arial, sans-serif; color: #222;
}
.cf-menu-chiudi, .cf-menu-apri { border: 0; background: transparent; color: #737373; cursor: pointer; padding: 2px; }
.cf-menu-chiudi svg, .cf-menu-apri svg { fill: currentColor; }
.cf-menu-apri { display: none; margin-right: 6px; }
body.menu-chiuso .cf-menu-apri { display: inline-flex; }

.menu-toolbar {
    position: sticky; top: 0; z-index: 10;
    display: flex; align-items: center; gap: 10px;
    height: 42px; padding: 0 8px;
    background-color: #eeeeee;
    border-top: 1px solid #d7d7d7; border-bottom: 1px solid #d7d7d7;
}
.menu-toolbar a, .menu-toolbar button {
    display: inline-flex; align-items: center; justify-content: center;
    width: 36px; height: 38px; padding: 0; border: 0;
    background: transparent; color: #737373; cursor: pointer;
}
.menu-toolbar svg { width: 26px; height: 26px; fill: currentColor; }
.menu-toolbar a:hover, .menu-toolbar button:hover { color: var(--cf-blu); background-color: #e2e2e2; }

.menu-feedback {
    display: none; margin: 8px; padding: 9px 10px;
    background-color: #fff3e8; color: #4b4b4b; font-size: 13px; line-height: 18px;
}
.menu-feedback--visibile { display: block; }

.voce-arancione {
    display: flex; align-items: center; gap: 4px;
    margin: 0 8px 8px; padding-bottom: 8px;
    border-bottom: 2px solid #dfe3e6;
    color: #004d90; font: 500 14px "Roboto", Arial, sans-serif;
    cursor: pointer; user-select: none;
}
.voce-arancione svg { fill: var(--cf-azzurro); transition: transform .15s; }
.voce-arancione.chiusa svg { transform: rotate(-90deg); }
.voce-arancione:not(.chiusa) { border-bottom-color: #82aaca; box-shadow: 0 2px 0 #dfe3e6; }
.prima-voce-menu { margin-top: 12px; }
.voci-blu { margin-bottom: 12px; }
.voce-arancione.chiusa + .voci-blu { display: none; }

.voce-blu {
    display: flex; align-items: center; width: 100%;
    min-height: 24px; padding: 0 6px 0 32px;
}
.voce-blu__testo, .voce-blu__testo:visited {
    flex: 1; min-width: 0; color: var(--cf-blu);
    font-size: 14px; line-height: 24px; text-decoration: none;
}
.voce-blu__testo:hover { color: var(--cf-arancio); text-decoration: none; }
.voce-blu--attiva .voce-blu__testo { color: var(--cf-arancio); }
.voce-blu__nuova-scheda { flex: 0 0 20px; display: inline-flex; }
.voce-blu__nuova-scheda svg { fill: var(--cf-azzurro); }
.voce-blu__nuova-scheda:hover svg { fill: var(--cf-blu); }

.cf-contenuto {
    flex: 1; min-width: 0;
    margin-left: var(--cf-menu-w);
    transition: margin-left .2s;
}
body.menu-chiuso .cf-contenuto { margin-left: 0; }

.cf-titolo-pagina { padding: 12px 16px 0; font-size: 18px; color: #222; }
.cf-percorso {
    display: flex; align-items: center; gap: 4px;
    padding: 2px 16px 0;
    font-size: 15px; color: #555;
}

/* ---------- Card ---------- */
.card-header .btn { padding: 2px 4px; }
.card-header .btn svg { width: 22px; height: 22px; }
.cf-caricamento, .cf-nota { color: #6b7280; font-size: 14px; }
.pallino-vecchia {
    display: inline-block; width: 10px; height: 10px; margin-left: 4px;
    border-radius: 50%; background: #f5c400; vertical-align: middle;
}

/* ---------- Login ---------- */
.pagina-login { display: flex; align-items: center; justify-content: center; min-height: 100%; }
.login-box {
    width: 100%; max-width: 380px; margin: 16px;
    background: #fff; border-radius: 6px; overflow: hidden;
    box-shadow: 0 2px 12px rgba(0,0,0,.12);
}
.login-head { background: var(--cf-blu); padding: 18px; text-align: center; }
.login-head img { height: 32px; }
.login-corpo { padding: 20px 24px 24px; }
.login-corpo h2 { font: 700 22px "Roboto Condensed", Arial, sans-serif; color: #0c2136; margin-bottom: 16px; }
.btn-entra { background: #ff7200; border-color: #ff7200; color: #fff; font-weight: 500; }
.btn-entra:hover { background: #e56700; color: #fff; }

/* ---------- Schermi piccoli: il menu si sovrappone ---------- */
@media (max-width: 900px) {
    .cf-contenuto { margin-left: 0; }
    body:not(.menu-aperto) .cf-menu { transform: translateX(-100%); }
    body.menu-aperto .cf-menu { transform: none; z-index: 90; box-shadow: 2px 0 12px rgba(0,0,0,.2); }
    .cf-menu-apri { display: inline-flex; }
    .cf-ditta { font-size: 13px; }
}

/* ---------- Widget a tutta pagina ----------
   Come gldwidgetnew.php con la card in .fullscreen: il menù resta chiuso
   (si apre dalla striscia a sinistra) e la card occupa tutto il resto. */
.cf-titolo-link, .cf-titolo-link:visited { color: inherit; text-decoration: none; }
.cf-titolo-link:hover { color: var(--cf-blu); text-decoration: none; }
.cf-striscia { display: none; }
body.widget-pieno .cf-striscia {
    display: flex; justify-content: center; align-items: flex-start;
    position: fixed; top: var(--cf-header-h); bottom: 0; left: 0; width: 40px;
    padding-top: 14px; border: 0; background: #e9e9e9; color: #737373; cursor: pointer; z-index: 80;
}
body.widget-pieno .cf-striscia svg { fill: currentColor; }
body.widget-pieno .cf-striscia:hover { color: var(--cf-blu); }
body.widget-pieno .cf-menu { transform: translateX(-100%); z-index: 90; }
body.widget-pieno.menu-aperto .cf-menu { transform: none; box-shadow: 2px 0 12px rgba(0,0,0,.2); }
body.widget-pieno .cf-contenuto, body.widget-pieno.menu-chiuso .cf-contenuto { margin-left: 40px; }
body.widget-pieno .cf-titolo-pagina, body.widget-pieno .cf-percorso { display: none; }
body.widget-pieno .menu-feedback { position: fixed; top: calc(var(--cf-header-h) + 8px); right: 16px; z-index: 300; max-width: 420px; box-shadow: 0 2px 8px rgba(0,0,0,.15); }
.widget-a-tutta-pagina { border: 0; border-radius: 0; min-height: calc(100vh - var(--cf-header-h)); }
/* pagine elenco (vtab): come nel vecchio scorre solo il corpo della card. Intestazione della card fissa,
   .contenitore_header_pagina (testata, schede, barra) sticky a top:-13px (apview.css) e thead sticky
   sotto di lei (bloccaheadertabella di apview.js), tutto relativo al corpo che scorre */
.widget-a-tutta-pagina:has(> .card-body > .contenitore_header_pagina) {
    height: calc(100vh - var(--cf-header-h)); display: flex; flex-direction: column;
}
.widget-a-tutta-pagina:has(> .card-body > .contenitore_header_pagina) > .card-body {
    flex: 1 1 auto; min-height: 0; overflow: auto; padding-top: 13px;
}
.widget-a-tutta-pagina > .card-header { border-radius: 0; padding: 10px 16px; }
.widget-a-tutta-pagina > .card-body { padding: 0; }
.widget-a-tutta-pagina .backtosmall_v2 svg { width: 24px; height: 24px; }
.widget-a-tutta-pagina .azioni-widget { align-items: center; }
.widget-a-tutta-pagina .azioni_default_widget_v2 svg { width: 24px; height: 24px; }
.widget-a-tutta-pagina .daticostanti-v2 select { width: 100%; }
#tableNavElement td { vertical-align: top; }
#rowWithActions, #rowWithActionsBottom { align-items: flex-start; }
#totalerighe .progress { height: 1rem; min-width: 140px; }
.tr_vtab_v2_sorting .sort-ico { display: block; margin: 0 auto; }

body.widget-nido { background: #fff; padding: 8px; }

/* cambio scheda in corso (cambiaScheda): la tabella resta visibile ma attenuata */
.cf-scheda-in-caricamento > :not(.contenitore_header_pagina) { opacity: .5; pointer-events: none; transition: opacity .15s; }

/* bordo delle card: come php/widget/style.css del vecchio (caricato da gldwidgetnew.php), che toglie
   l'azzurro di Bootstrap a .border-primary */
.border-primary { border-color: #d5d5d5 !important; }

/* v110: la pagina resta nascosta finché non arriva questo CSS (vd. <style> nella head di layout.html e nido.html) */
html { visibility: visible; }
