/* ==========================================================================
   Stile del sito – ripreso da oldsito/stile.css (stessi colori e impaginazione:
   titolo, barra lilla, menu a sinistra su crema, pagina bianca, barra in fondo).
   Bootstrap 3 resta sotto per i componenti dell'area riservata.
   ========================================================================== */

/* ---------- BASE (come stile.css) ---------- */

html {
    height: 100%;
}

body {
    display: flex;
    flex-direction: column;
    /* 100% e non 100vh: 100vh conta anche lo spazio delle barre di scorrimento
       e su mobile la barra dell'indirizzo, facendo comparire lo scroll */
    min-height: 100%;
    font-size: 15px;
    margin: 0;
    font-family: "Sans serif", Arial, Verdana, sans-serif;
    color: #222;
    background-color: #fffaf5;
}

hr {
    border: 0;
    border-top: 1px solid orange;
    border-bottom: 1px solid orange;
    margin: 8px 0;
}

/* solo "a", senza :visited: copre già anche i link visitati e resta più debole
   delle classi dei pulsanti (un <a class="btn btn-primary"> visitato restava rosso su rosso) */
a {
    color: #ff4444;
}

a:hover,
a:focus {
    color: #cc2222;
}

.codice,
.sito-pagina pre {
    border: 1px dotted green;
    font-size: 14px;
    background-color: #eeeeff;
    padding: 2px 4px;
    margin: 2px 0;
    border-radius: 0;
}

.codice code,
.sito-pagina pre code {
    color: black;
    background: transparent;
    padding: 0;
}

.grande {
    font-size: 25px;
}
.medio  {
    font-size: 19px;
}
.piccolo {
    font-size: 13px;
}

/* ---------- IMPAGINAZIONE ---------- */

#TDtitolo {
    padding: 5px;
    background-color: #fff;
}

#TDtitolo .sito-nome {
    display: inline-block;
    padding: 10px 5px;
    font-size: 34px;
    font-weight: bold;
    color: #aa3300;
    text-decoration: none;
}

#TDtitolo .sito-nome img {
    max-height: 112px;
    width: auto;
}

#TDlingua {
    background-color: #f0f0ff;
    padding: 4px 6px;
    text-align: right;
    color: #aa3300;
}

#TDlingua a {
    font-weight: bold;
    text-decoration: none;
}

#TDlingua a:hover {
    text-decoration: underline;
}

#TDlingua a.attiva {
    color: green;
}

.sito-sep {
    margin: 0 8px;
    color: #ccaa99;
}

#TD {
    flex: 1 0 auto;
    display: flex;
    background-color: #fffaf5;
}

#TDmenu {
    flex: 0 0 185px;
    width: 185px;
    padding: 10px 0 10px 10px;
    background-color: #fffaf5;
}

#TDmenu a {
    display: inline-block;
    line-height: 1.75;
}

.sito-crediti img {
    border: 0;
    margin: 1px 0;
}

#TDmenu .sito-crediti a {
    line-height: 1.2;
}

#TDmenu a.attiva {
    font-weight: bold;
    color: #aa3300;
}

#TDpagina {
    flex: 1 1 auto;
    min-width: 0;
    margin-left: 10px;
    /* 15px = margine negativo delle .row di Bootstrap: così non sbordano */
    padding: 12px 15px;
    /* contenuti troppo larghi (tabelle, pre, immagini) scorrono dentro la pagina, non tutta la finestra */
    overflow-x: auto;
    background-color: white;
}

#TDsotto {
    flex-shrink: 0;
    background-color: #f0f0ff;
    padding: 4px 6px;
}

/* ---------- CONTENUTO DELLE PAGINE ---------- */

.sito-pagina {
    line-height: 1.55;
}

.sito-pagina h1.sito-titolo {
    font-size: 25px;
    margin: 0;
    font-weight: normal;
}

.sito-pagina h2,
.sito-pagina h3 {
    font-size: 19px;
    font-weight: normal;
    margin: 14px 0 8px;
}

.sito-pagina img {
    max-width: 100%;
    height: auto;
}

.sito-modifica {
    float: right;
    margin-left: 10px;
}

.sito-404 {
    padding: 40px 0;
}

/* ---------- RITOCCHI A BOOTSTRAP (stessi colori del sito) ---------- */

.btn {
    border-radius: 0;
    font-size: 14px;
}

.btn-primary,
.btn-primary:focus {
    background: #ff4444;
    border-color: #dd2222;
    color: #fff;
}

.btn-primary:hover,
.btn-primary:active {
    background: #dd2222;
    border-color: #bb1111;
    color: #fff;
}

.btn-default {
    background: #f0f0ff;
    border-color: #ccccee;
}

.form-control {
    border-radius: 0;
    font-size: 15px;
    box-shadow: none;
    /* Bootstrap 3 fissa l'altezza (34px / 30px): con i caratteri del sito il testo
       delle <select> veniva tagliato in basso. L'altezza segue il contenuto. */
    height: auto;
    min-height: 34px;
    line-height: 1.4;
}

/* campi e select "piccoli" (input-sm, input-group-sm): un po' più bassi ma leggibili */
.input-sm,
.input-group-sm > .form-control,
.input-group-sm > .input-group-addon {
    height: auto;
    min-height: 32px;
    font-size: 14px;
    line-height: 1.4;
    padding-top: 5px;
    padding-bottom: 5px;
}

.input-group-sm > .input-group-btn > .btn {
    font-size: 14px;
    line-height: 1.4;
    padding-top: 5px;
    padding-bottom: 5px;
}

.form-control:focus {
    border-color: orange;
    box-shadow: none;
}

.input-group-addon {
    border-radius: 0;
    background: #f0f0ff;
}

.alert {
    border-radius: 0;
    padding: 8px 12px;
}

.panel {
    border-radius: 0;
    box-shadow: none;
    border-color: #f0d9c0;
}

.panel-default > .panel-heading {
    background: #fffaf5;
    border-color: #f0d9c0;
    color: #aa3300;
    border-radius: 0;
}

.panel-footer {
    background: #fffaf5;
}

.nav-tabs {
    border-bottom-color: orange;
}

.nav-tabs > li > a {
    border-radius: 0;
    color: #ff4444;
}

.nav-tabs > li.active > a,
.nav-tabs > li.active > a:hover,
.nav-tabs > li.active > a:focus {
    border-color: orange orange #fff;
    color: #aa3300;
    font-weight: bold;
}

.table > thead > tr > th {
    border-bottom: 1px solid orange;
    color: #aa3300;
    font-weight: normal;
    font-size: 14px;
}

.label {
    border-radius: 0;
}

.thumbnail {
    border-radius: 0;
    border-color: #f0d9c0;
}

code {
    color: green;
    background: #eeeeff;
    border-radius: 0;
}

/* ---------- AREA RISERVATA ---------- */

.sito-titolo-admin {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 6px;
}

.sito-titolo-admin::before,
.sito-titolo-admin::after {
    display: none;
}

.sito-titolo-admin h1 {
    margin: 0;
    font-size: 25px;
    font-weight: normal;
}

.sito-tabella td {
    vertical-align: middle !important;
}
.sito-azioni {
    white-space: nowrap;
}
.sito-azioni form {
    display: inline-block;
    margin: 0;
}
.sito-mancante {
    opacity: .45;
}

.sito-schede {
    border: 1px solid orange;
    border-top: 0;
    padding: 12px;
    background: #fff;
}

.sito-editor {
    font-family: ui-monospace, Menlo, Consolas, "Courier New", monospace;
    font-size: 14px;
    line-height: 1.5;
    tab-size: 2;
    resize: vertical;
    background: #fdfdff;
}

.sito-strumenti {
    margin-top: -4px;
}

.sito-anteprima {
    border: 1px dotted green;
    padding: 10px;
    min-height: 200px;
    background: #fff;
}

.sito-filelist {
    max-height: 420px;
    overflow-y: auto;
}

.sito-filelist .list-group-item {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    text-align: left;
    border-radius: 0 !important;
}

.sito-filelist img {
    width: 32px;
    height: 32px;
    object-fit: cover;
    flex-shrink: 0;
}

.sito-filelist span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sito-form-stretto {
    max-width: 520px;
}
.sito-spazio-sotto {
    margin-bottom: 6px;
}
.sito-spazio-sopra {
    margin-top: 8px;
}

.sito-upload-area {
    display: block;
    border: 1px dotted green;
    padding: 20px;
    text-align: center;
    font-weight: normal;
    cursor: pointer;
    background: #eeeeff;
}

.sito-upload-area:hover,
.sito-upload-area.trascina {
    border-style: dashed;
    border-color: orange;
    background: #fffaf5;
}

.sito-upload-area input[type=file] {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
}

.sito-upload-scelti {
    display: block;
    margin-top: 6px;
}

.sito-griglia-file .thumbnail {
    margin-bottom: 16px;
}

.sito-file-anteprima {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 120px;
    background: #fffaf5;
    overflow: hidden;
}

.sito-file-anteprima img {
    max-height: 120px;
    max-width: 100%;
    object-fit: contain;
}

.sito-file-nome {
    font-weight: bold;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ---------- SCHERMI PICCOLI: il menu va sopra la pagina ---------- */

@media (max-width: 767px) {
    #TD {
        flex-direction: column;
    }

    #TDlingua {
        text-align: left;
    }

    #TDmenu {
        flex: 0 0 auto;
        width: auto;
        padding: 8px 10px;
        border-bottom: 1px solid orange;
    }

    #TDmenu br {
        display: none;
    }

    #TDmenu a {
        margin-right: 12px;
    }

    #TDmenu .medio {
        display: block;
        font-size: 15px;
    }

    /* su telefono i crediti occupano troppo spazio sopra la pagina */
    #TDmenu .sito-crediti {
        display: none;
    }

    #TDpagina {
        margin-left: 0;
    }

    /* tabelle dell'area riservata: ogni riga diventa una scheda, campi uno sotto l'altro */
    .sito-tabella thead {
        display: none;
    }

    .sito-tabella,
    .sito-tabella > tbody,
    .sito-tabella > tbody > tr,
    .sito-tabella > tbody > tr > td {
        display: block;
        width: 100%;
    }

    .sito-tabella > tbody > tr {
        border: 1px solid #f0d9c0;
        background: #fff;
        margin-bottom: 10px;
        padding: 8px 10px;
    }

    .sito-tabella > tbody > tr > td {
        border: 0 !important;
        padding: 3px 0 !important;
        text-align: left !important;
    }

    .sito-tabella td[data-etichetta]::before {
        content: attr(data-etichetta) ": ";
        color: #aa3300;
        font-size: 13px;
        margin-right: 4px;
    }

    .sito-tabella .sito-cella-titolo {
        font-size: 17px;
    }

    .sito-tabella td.sito-azioni {
        padding-top: 8px !important;
        white-space: normal;
    }

    .sito-tabella td.sito-azioni .btn-xs {
        padding: 5px 12px;
        font-size: 14px;
    }

    /* legenda dell'editor: nome, esempio e codice uno sotto l'altro */
    .sito-legenda-tabella,
    .sito-legenda-tabella > tbody,
    .sito-legenda-tabella > tbody > tr,
    .sito-legenda-tabella > tbody > tr > th,
    .sito-legenda-tabella > tbody > tr > td {
        display: block;
        width: 100% !important;
    }

    .sito-legenda-tabella > tbody > tr {
        border-top: 1px solid #f0d9c0;
        padding: 6px 0;
    }

    .sito-legenda-tabella > tbody > tr > th,
    .sito-legenda-tabella > tbody > tr > td {
        border: 0 !important;
        padding: 3px 0 !important;
    }
}

/* ---------- VALIDAZIONE HTML NELL'EDITOR ---------- */

.sito-validazione ul {
    list-style: none;
    margin: 8px 0 0;
    padding: 0;
    max-height: 260px;
    overflow-y: auto;
}

.sito-validazione li {
    padding: 5px 6px;
    border-top: 1px dotted rgba(0, 0, 0, .15);
    cursor: pointer;
}

.sito-validazione li:hover {
    background: rgba(255, 255, 255, .6);
}

.sito-validazione li code {
    display: block;
    margin-top: 3px;
    white-space: pre-wrap;
    word-break: break-word;
    font-size: 12px;
}

.sito-errori-lingua {
    background: #ff4444;
    margin-left: 4px;
}

/* ---------- LEGENDA STILI NELL'EDITOR ---------- */

.sito-legenda {
    margin-top: 16px;
    border: 1px solid #f0d9c0;
    background: #fffaf5;
    padding: 8px 12px;
}

.sito-legenda summary {
    cursor: pointer;
    color: #aa3300;
    font-size: 17px;
}

.sito-legenda h2.sito-legenda-gruppo {
    font-size: 15px;
    font-weight: bold;
    color: #aa3300;
    margin: 16px 0 4px;
    padding-bottom: 3px;
    border-bottom: 1px solid orange;
}

.sito-legenda-tabella {
    margin-bottom: 0;
    background: #fff;
}

.sito-legenda-tabella th {
    width: 24%;
    font-weight: bold;
    vertical-align: top !important;
}

.sito-legenda-tabella th small {
    display: block;
    font-weight: normal;
}

.sito-legenda-esempio {
    width: 36%;
}

/* negli esempi i titoli non devono prendere troppo spazio */
.sito-legenda-esempio h2,
.sito-legenda-esempio h3 {
    margin: 0;
}

.sito-legenda-esempio .alert,
.sito-legenda-esempio .well,
.sito-legenda-esempio .table,
.sito-legenda-esempio blockquote,
.sito-legenda-esempio pre,
.sito-legenda-esempio p {
    margin-bottom: 0;
}

.sito-legenda-codice pre {
    margin: 0 0 4px;
    font-size: 12px;
    white-space: pre-wrap;
    word-break: break-word;
    background: #eeeeff;
    border: 1px dotted green;
    border-radius: 0;
    color: green;
}

/* ---------- EDITOR HTML COLORATO (js/libs/evidenziahtml.js) ---------- */

.eh-involucro {
    position: relative;
    background: #fdfdff;
}

/* strato colorato sotto: stesse misure del textarea (copiate via JS) */
.eh-strato {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    margin: 0;
    overflow: hidden;
    pointer-events: none;
    box-sizing: border-box;
    white-space: pre-wrap;
    overflow-wrap: break-word;
    word-break: normal;
    background: transparent;
    border-radius: 0;
    color: #222;
}

/* il textarea vero sta sopra: testo trasparente, si vedono solo cursore e selezione */
.sito-editor.eh-textarea {
    position: relative;
    background: transparent;
    color: transparent;
    caret-color: #222;
    white-space: pre-wrap;
    overflow-wrap: break-word;
    word-break: normal;
}

.sito-editor.eh-textarea::selection {
    background: rgba(255, 165, 0, .35);
    color: transparent;
}

.eh-tag      {
    color: #aa3300;
}
.eh-punt     {
    color: #b08060;
}
.eh-attr     {
    color: #d2691e;
}
.eh-valore   {
    color: #008000;
}
.eh-commento {
    color: #8a8a8a;
}
.eh-entita   {
    color: #7a3e9d;
}
.eh-codice   {
    color: #1f4e8c;
}

/* ---------- FILE: CARTELLE ---------- */

.sito-cartelle .list-group-item {
    border-radius: 0 !important;
    font-size: 14px;
    padding-top: 6px;
    padding-bottom: 6px;
}

.sito-cartelle .list-group-item.active,
.sito-cartelle .list-group-item.active:hover,
.sito-cartelle .list-group-item.active:focus {
    background: #fffaf5;
    border-color: #f0d9c0;
    color: #aa3300;
    font-weight: bold;
}

.sito-cartelle .list-group-item.active .badge {
    background: #aa3300;
    color: #fff;
}

.sito-upload-azioni {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}

.sito-upload-azioni label {
    margin: 0;
    font-weight: normal;
}

.sito-upload-azioni select {
    width: auto;
    min-width: 180px;
}

.sito-file-titolo {
    font-size: 19px;
    margin: 0 0 12px;
}

.sito-sql {
    margin: 6px 0;
    white-space: pre-wrap;
    word-break: break-all;
}

/* i pulsanti a tutta larghezza possono andare a capo invece di uscire dal bordo */
.btn-block {
    white-space: normal;
}

/* ---------- ICONE DEI FILE PER TIPO ---------- */

.sito-icona-file {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.sito-ext {
    font-size: 11px;
    font-weight: bold;
    letter-spacing: .05em;
    padding: 0 5px;
    border-radius: 2px;
    color: #fff;
    background: #888;
}

.sito-tipo-pdf        { color: #d32f2f; }
.sito-tipo-word       { color: #2b579a; }
.sito-tipo-excel      { color: #217346; }
.sito-tipo-powerpoint { color: #d24726; }
.sito-tipo-archivio   { color: #8d6e63; }
.sito-tipo-audio      { color: #7b1fa2; }
.sito-tipo-video      { color: #c2185b; }
.sito-tipo-testo      { color: #607d8b; }
.sito-tipo-codice     { color: #00897b; }
.sito-tipo-immagine   { color: #f57c00; }
.sito-tipo-file       { color: #9e9e9e; }

.sito-tipo-pdf .sito-ext        { background: #d32f2f; }
.sito-tipo-word .sito-ext       { background: #2b579a; }
.sito-tipo-excel .sito-ext      { background: #217346; }
.sito-tipo-powerpoint .sito-ext { background: #d24726; }
.sito-tipo-archivio .sito-ext   { background: #8d6e63; }
.sito-tipo-audio .sito-ext      { background: #7b1fa2; }
.sito-tipo-video .sito-ext      { background: #c2185b; }
.sito-tipo-testo .sito-ext      { background: #607d8b; }
.sito-tipo-codice .sito-ext     { background: #00897b; }
.sito-tipo-file .sito-ext       { background: #9e9e9e; }

/* nella colonna dell'editor l'icona colorata sta al posto della miniatura */
.sito-filelist .fa {
    font-size: 22px;
    width: 32px;
    text-align: center;
    flex-shrink: 0;
}
