/* =====================================================================
   Tema Geolander.it per osTicket 1.18 - PORTALE CLIENTI
   Stessa grafica del Portal (tema Keycloak "geolander"):
   testata scura, accento lime, carattere Titillium Web.
   Caricato da include/client/header.inc.php DOPO theme.css.
   ===================================================================== */

@import url("https://fonts.googleapis.com/css2?family=Titillium+Web:wght@300;400;600;700&display=swap");

:root {
  --gl-bg: #0b1618;
  --gl-bg-2: #0d1f22;
  --gl-ink: #f2f5f4;
  --gl-ink-2: #b7c3c2;
  --gl-ink-3: #869a99;
  --gl-line-dark: rgba(255, 255, 255, .09);
  --gl-lime: #c0d105;
  --gl-lime-2: #b8e210;
  --gl-lime-soft: #ebffcb;
  --gl-forest: #264027;
  --gl-page: #eef1f0;
  --gl-card: #ffffff;
  --gl-text: #1c2b2d;
  --gl-text-2: #4a5a5c;
  --gl-line: #d9e0df;
  --gl-danger: #e36588;
  --gl-warn: #f2a541;
  --gl-radius: 8px;
  --gl-font: "Titillium Web", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

/* ---- Base ---------------------------------------------------------- */
body {
  background: var(--gl-page) !important;
  color: var(--gl-text);
  font-family: var(--gl-font) !important;
  letter-spacing: 0;
}
input, select, textarea, button, .button { font-family: var(--gl-font); }

a { color: var(--gl-forest); }
a:hover { color: #3b6b3d; }

/* Pagina a tutto schermo */
html, body { margin: 0; }
#container {
  width: 100% !important;
  max-width: none !important;
  margin: 0 !important;
  background: var(--gl-card);
  border-radius: 0;
  box-shadow: none;
  min-height: calc(100vh - 90px);
}

/* Testo con il carattere del Portal anche dove la pagina ha stili propri
   (es. testo di benvenuto scritto in Gestione > Pagine). Esclude le icone. */
/* (esclusi: icone <i>, classi icona, barra dell'editor di testo: usano caratteri-icona) */
#content *:not(i):not([class*="icon"]):not(pre):not(code):not(.redactor-toolbar *):not(.re-button):not(.re-button *) {
  font-family: var(--gl-font) !important;
}
#content a:not(.button):not(.btn) { color: var(--gl-forest) !important; }
#content a:not(.button):not(.btn):hover { color: #3b6b3d !important; }

/* Home: testo a sinistra che occupa lo spazio, pulsanti a destra */
#landing_page .sidebar { width: 280px; }
#landing_page .main-content {
  width: auto !important;
  float: none !important;
  overflow: hidden;
  padding-right: 48px;
  font-size: 16px;
  line-height: 1.6;
}

/* ---- Testata scura con logo bianco --------------------------------- */
#header {
  background: var(--gl-bg-2);
  color: var(--gl-ink-2);
  height: auto;
  min-height: 76px;
  padding: 0 40px;
  border-bottom: 3px solid var(--gl-lime);
}
#header #logo { display: flex; align-items: center; height: 76px; }
#header #logo img { max-height: 40px; max-width: 320px; }
#header p { color: var(--gl-ink-2); }
#header p a { color: var(--gl-lime); text-decoration: none; }
#header p a:hover { color: var(--gl-lime-2); text-decoration: underline; }
#header p b, #header p strong { color: var(--gl-ink); }

/* Parte destra della testata: bandierine e "Accedi" sulla stessa riga,
   centrate in verticale con il logo (bandierine a sinistra del pulsante) */
#header .pull-right {
  display: flex;
  flex-direction: row-reverse;
  align-items: center;
  gap: 18px;
  height: 76px;
}
#header .pull-right p {
  width: auto;
  padding: 0;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 6px;
  line-height: 1;
}
#header .pull-right p a.flag { opacity: .85; }
#header .pull-right p a.flag:hover { opacity: 1; }

/* "Accedi" come pulsante lime (si nasconde il testo "Ospite |") */
#header p:has(a[href*="login.php"]) { font-size: 0; }
#header p a[href*="login.php"] {
  display: inline-block;
  font-size: 15px;
  font-weight: 600;
  background: var(--gl-lime);
  color: var(--gl-bg) !important;
  border-radius: var(--gl-radius);
  padding: 7px 20px;
  text-decoration: none !important;
  transition: background-color .15s;
}
#header p a[href*="login.php"]:hover { background: var(--gl-lime-2); }

/* ---- Menu: chiaro, voce attiva con barra lime ---------------------- */
#nav {
  background: #f6f8f7;
  border-top: 0;
  box-shadow: inset 0 -1px 0 var(--gl-line);
  height: auto;
  margin: 0 !important;
  padding: 0 0 0 32px;
  line-height: 44px;
}
#nav li a {
  height: auto;
  color: var(--gl-text-2);
  border: 0 !important;
  border-radius: 0;
  background-color: transparent !important;
  box-shadow: none;
  font-weight: 600;
  padding: 0 14px 0 34px;
  border-bottom: 3px solid transparent !important;
}
#nav li a:hover {
  color: var(--gl-text);
  border-bottom-color: var(--gl-line) !important;
}
#nav li a.active {
  color: var(--gl-text);
  border-bottom-color: var(--gl-lime) !important;
}

/* ---- Contenuto ----------------------------------------------------- */
#content { padding: 32px 40px 48px; }
#content h1, #content h2, #content h3 {
  font-family: var(--gl-font);
  color: var(--gl-text);
  font-weight: 600;
}
#content h1 { font-size: 26px; }

/* Campi dei moduli */
#content input[type="text"],
#content input[type="email"],
#content input[type="password"],
#content input[type="tel"],
#content input[type="number"],
#content input[type="search"],
#content select,
#content textarea {
  border: 1px solid var(--gl-line);
  border-radius: 6px;
  padding: 6px 10px;
  background: #fff;
  color: var(--gl-text);
  transition: border-color .15s, box-shadow .15s;
}
#content input:focus,
#content select:focus,
#content textarea:focus {
  outline: none;
  border-color: var(--gl-lime);
  box-shadow: 0 0 0 3px rgba(192, 209, 5, .25);
}

/* Pulsanti: principale lime, secondario scuro */
.button, .button:visited,
#content input[type="submit"],
#content button[type="submit"] {
  background: var(--gl-lime) !important;
  color: var(--gl-bg) !important;
  border: 0 !important;
  border-radius: var(--gl-radius) !important;
  box-shadow: none !important;
  text-shadow: none !important;
  font-weight: 600;
  padding: 8px 18px;
  cursor: pointer;
  transition: background-color .15s;
}
.button:hover,
#content input[type="submit"]:hover,
#content button[type="submit"]:hover {
  background: var(--gl-lime-2) !important;
  color: var(--gl-bg) !important;
}
#content input[type="reset"],
#content input[type="button"] {
  background: transparent;
  color: var(--gl-text);
  border: 1px solid var(--gl-line);
  border-radius: var(--gl-radius);
  padding: 8px 18px;
  font-weight: 600;
  cursor: pointer;
}
#content input[type="reset"]:hover,
#content input[type="button"]:hover { border-color: var(--gl-text-2); }

/* Home: "Apri un nuovo ticket" lime, "Stato del ticket" scuro */
.front-page-button .button,
.front-page-button a.button { width: 100%; box-sizing: border-box; text-align: center; padding: 12px 18px; font-size: 17px; }
.blue.button, .blue.button:visited {
  background: var(--gl-lime) !important;
  color: var(--gl-bg) !important;
}
.green.button, .green.button:visited {
  background: var(--gl-bg-2) !important;
  color: var(--gl-ink) !important;
}
.green.button:hover { background: var(--gl-forest) !important; color: #fff !important; }

/* Riquadri laterali e pagine */
.sidebar .content,
#landing_page .sidebar .content {
  border: 1px solid var(--gl-line);
  border-radius: var(--gl-radius);
  background: #fafbfb;
}

/* Messaggi */
#msg_notice { background: var(--gl-lime-soft); border: 1px solid #c9e07a; color: var(--gl-forest); border-radius: 6px; }
#msg_warning { border-radius: 6px; }
#msg_error { border-radius: 6px; }

/* Tabelle elenco ticket */
#ticketTable th, table.list th {
  background: #f6f8f7 !important;
  color: var(--gl-text-2);
  font-weight: 600;
}

/* ---- Piè di pagina ------------------------------------------------- */
#footer {
  color: var(--gl-text-2);
  font-size: 13px;
  padding: 22px 0 40px;
}
#footer a { color: var(--gl-text-2); }
#footer #poweredBy { opacity: .45; }

/* =====================================================================
   PAGINE INTERNE: tutto a piena larghezza e caratteri più grandi
   (osTicket fissa tabelle e moduli a 800 pixel)
   ===================================================================== */
#content { font-size: 16px; }
#content table[width="800"],
#ticketTable,
#ticketInfo,
#ticketForm > table,
#clientLogin { width: 100% !important; max-width: none !important; }
#content form, #reply, .thread-entry, #ticketThread,
#content table, #content input, #content select, #content textarea { box-sizing: border-box; }
#content img { max-width: 100%; height: auto; }

/* Elenco "I miei ticket" */
#ticketSearchForm {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  background: var(--gl-soft, #f6f8f7);
  border: 1px solid var(--gl-line);
  border-radius: var(--gl-radius);
  padding: 10px 14px;
  margin-bottom: 18px;
}
#ticketSearchForm input[type="text"] { min-width: 240px; }
#ticketTable {
  border-collapse: separate !important;
  border-spacing: 0 !important;
  border: 1px solid var(--gl-line) !important;
  border-radius: var(--gl-radius);
  overflow: hidden;
  font-size: 15px;
}
#ticketTable caption {
  text-align: left;
  padding: 0 0 8px;
  font-weight: 600;
  color: var(--gl-text-2);
}
#ticketTable th {
  background: #f6f8f7 !important;
  border: 0 !important;
  border-bottom: 1px solid var(--gl-line) !important;
  color: var(--gl-text-2) !important;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: .03em;
  padding: 10px 12px !important;
  width: auto;
}
#ticketTable th a { color: var(--gl-text-2) !important; text-decoration: none; }
#ticketTable td {
  border: 0 !important;
  border-bottom: 1px solid #edf1f0 !important;
  padding: 11px 12px !important;
  background: #fff;
}
#ticketTable tr:nth-child(2n) td { background: #fafcfb; }
#ticketTable tr:hover td { background: #f6f9e6; }
#ticketTable .truncate { max-width: 60vw !important; }

/* Dettaglio ticket: riquadri informazioni */
#ticketInfo h1, #content h1 { font-size: 26px; }
#ticketInfo .infoTable,
#ticketInfo .custom-data {
  background: #f6f8f7;
  border: 1px solid var(--gl-line);
  border-radius: var(--gl-radius);
  border-collapse: separate;
  margin-bottom: 12px;
  font-size: 15px;
}
#ticketInfo .infoTable th,
#ticketInfo .custom-data th {
  color: var(--gl-text-2);
  font-weight: 600;
  text-align: left;
  background: transparent !important;
}
#ticketInfo .infoTable th[colspan],
#ticketInfo .custom-data th[colspan],
#ticketInfo .infoTable thead th,
#ticketInfo .custom-data thead th {
  color: var(--gl-text);
  border-bottom: 1px solid var(--gl-line);
  padding: 8px 6px;
}
#ticketInfo > tbody > tr > td { vertical-align: top; padding: 0 6px; }

/* etichette su una riga sola, colonna fissa e uguale in tutti i riquadri;
   il valore parte subito dopo invece che a metà pagina */
#ticketInfo .infoTable,
#ticketInfo .custom-data { table-layout: auto; width: 100% !important; }
#ticketInfo .infoTable th:not([colspan]),
#ticketInfo .custom-data th:not([colspan]),
#ticketInfo .custom-data td.label,
#ticketInfo .custom-data tbody td:first-child:not(:only-child) {
  width: 190px !important;
  min-width: 190px;
  white-space: nowrap;
  padding: 5px 10px !important;
}
#ticketInfo .infoTable td,
#ticketInfo .custom-data td { width: auto !important; padding: 5px 10px !important; }

/* Pulsanti "Stampa" e "Modifica" */
#content .action-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #fff;
  border: 1px solid var(--gl-line);
  border-radius: 6px;
  color: var(--gl-text) !important;
  padding: 6px 12px;
  font-size: 14px;
  text-decoration: none !important;
}
#content .action-button:hover { border-color: var(--gl-lime); box-shadow: 0 0 0 2px rgba(192, 209, 5, .25); }

/* Discussione: cliente verde acqua, risposta operatore lime tenue */
.thread-entry { max-width: 100%; }
.thread-entry .header { border-radius: var(--gl-radius) var(--gl-radius) 0 0 !important; font-size: 15px; }
.thread-entry.message .header { background: #e3f1ef !important; border-color: #b9d8d3 !important; }
.thread-entry.message { border-color: #b9d8d3 !important; }
.thread-entry.response .header { background: #f3f8d6 !important; border-color: #d5e07e !important; }
.thread-entry.response { border-color: #d5e07e !important; }
.thread-entry .thread-body { font-size: 15px; line-height: 1.6; }

/* Modulo di risposta e "Apri un nuovo ticket" */
#reply, #ticketForm { width: 100%; }
#reply table, #ticketForm table { width: 100% !important; }
#content .redactor-box, #content .redactor-in { max-width: 100%; }
#content input[type="text"],
#content input[type="email"],
#content input[type="tel"],
#content select { font-size: 15px; max-width: 100%; }
#content textarea { width: 100%; font-size: 15px; }
#content .select2-container { max-width: 100%; }
#content p.buttons { text-align: right !important; margin-top: 24px; }

/* Pagina di accesso clienti */
#clientLogin {
  background: #f6f8f7 !important;
  border: 1px solid var(--gl-line) !important;
  border-radius: var(--gl-radius);
  box-shadow: none !important;
  padding: 28px !important;
}
#clientLogin input[type="text"],
#clientLogin input[type="password"] { width: 100%; max-width: 360px; padding: 10px 12px; }

/* =====================================================================
   TABLET E TELEFONO
   ===================================================================== */
@media (max-width: 900px) {
  #header { padding: 0 16px; }
  #content { padding: 24px 16px 36px; }
  #nav { padding-left: 8px; }

  /* menu orizzontale scorrevole invece che su più righe */
  #nav {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    white-space: nowrap;
    scrollbar-width: none;
  }
  #nav::-webkit-scrollbar { display: none; }
  #nav li { flex: 0 0 auto; }

  /* home: pulsanti sopra, testo sotto, a tutta larghezza */
  #landing_page .sidebar { width: auto !important; float: none !important; margin-bottom: 20px; }
  #landing_page .main-content { padding-right: 0; }

  /* dettaglio ticket: le due colonne di informazioni una sotto l'altra */
  #ticketInfo > tbody > tr > td { display: block; width: 100% !important; padding: 0; }
}

@media (max-width: 600px) {
  /* testata: logo in alto, sotto i link dell'utente, tutto sul fondo scuro */
  #header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    height: auto !important;
    min-height: 0;
    padding: 10px 14px;
    row-gap: 6px;
  }
  #header #logo { order: 1; float: none; height: 44px; }
  #header #logo img { max-height: 30px; max-width: 170px; }
  #header .pull-right {
    order: 2;
    float: none;
    height: auto;
    gap: 10px;
    flex: 1 1 auto;
    justify-content: flex-start;
    flex-direction: row-reverse;
    flex-wrap: wrap;
  }
  /* utente collegato: i link vanno su una riga intera sotto il logo */
  #header .pull-right:has(a[href*="logout"]),
  #header .pull-right:has(a[href*="profile.php"]) {
    flex: 1 1 100%;
    justify-content: space-between;
    border-top: 1px solid var(--gl-line-dark);
    padding-top: 8px;
  }
  #header p { font-size: 14px; }
  #header p a[href*="login.php"] { padding: 6px 14px; font-size: 14px; }

  /* menu: tre riquadri affiancati con l'icona sopra il testo, niente barra di scorrimento */
  #nav {
    display: grid !important;
    grid-template-columns: repeat(auto-fit, minmax(0, 1fr));
    overflow: visible;
    white-space: normal;
    padding: 0 !important;
    line-height: 1.25;
  }
  #nav li { display: block; }
  #nav li a {
    display: block;
    height: 100%;
    box-sizing: border-box;
    padding: 30px 6px 10px !important;
    background-position: 50% 9px !important;
    text-align: center;
    font-size: 13px;
    white-space: normal;
  }

  /* dettaglio ticket: titolo e pulsanti Stampa/Modifica uno sotto l'altro */
  #ticketInfo h1 { font-size: 22px; }
  #ticketInfo h1 .pull-right {
    float: none !important;
    display: flex;
    gap: 8px;
    margin: 10px 0 0;
  }

  #content { font-size: 15px; padding: 18px 12px 28px; }
  #content h1 { font-size: 22px; }

  /* elenco ticket: la tabella scorre di lato invece di uscire dallo schermo */
  #ticketTable { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; white-space: nowrap; }
  #ticketSearchForm input[type="text"] { min-width: 0; flex: 1 1 100%; }

  /* etichetta e valore restano sulla stessa riga, colonna etichette più stretta */
  #ticketInfo .infoTable th:not([colspan]),
  #ticketInfo .custom-data th:not([colspan]),
  #ticketInfo .custom-data td.label,
  #ticketInfo .custom-data tbody td:first-child:not(:only-child) {
    width: 132px !important;
    min-width: 132px;
    padding: 5px 8px !important;
  }
  #ticketInfo .infoTable td,
  #ticketInfo .custom-data td { padding: 5px 8px !important; overflow-wrap: anywhere; }

  /* discussione: niente spazio per l'avatar */
  .thread-entry.avatar { margin-left: 0 !important; }
  .thread-entry .avatar { display: none !important; }

  /* Accesso e "Verifica stato ticket": campi sopra, istruzioni sotto, a tutta larghezza */
  #clientLogin { padding: 18px !important; }
  #clientLogin > div { display: block !important; }
  #clientLogin .login-box,
  #clientLogin .instructions,
  #clientLogin > div > div {
    display: block !important;
    width: auto !important;
    box-shadow: none !important;
    padding: 0 !important;
  }
  #clientLogin > div > div:not(.login-box) {
    border-top: 1px solid var(--gl-line);
    margin-top: 18px;
    padding-top: 16px !important;
  }
  #clientLogin input[type="text"],
  #clientLogin input[type="email"],
  #clientLogin input[type="password"] { width: 100% !important; max-width: none !important; }
  #clientLogin input[type="submit"] { width: 100%; }
  #clientLogin hr { display: none; }

  /* moduli (nuovo ticket, risposta, profilo): etichetta sopra e campo sotto,
     campi a tutta larghezza */
  /* tabella, righe e celle diventano tutte blocchi impilati: se si cambiano
     solo le celle il browser sovrappone le righe */
  #content form table:not(#ticketTable),
  #content form table:not(#ticketTable) > thead,
  #content form table:not(#ticketTable) > tbody,
  #content form table:not(#ticketTable) > tfoot,
  #content form table:not(#ticketTable) > * > tr,
  #content form table:not(#ticketTable) > * > tr > td,
  #content form table:not(#ticketTable) > * > tr > th {
    display: block !important;
    width: auto !important;
    height: auto !important;
    position: static !important;
    float: none !important;
  }
  #content form table:not(#ticketTable) > * > tr { margin-bottom: 10px; }
  #content form table:not(#ticketTable) > * > tr > td,
  #content form table:not(#ticketTable) > * > tr > th { padding: 2px 0 !important; text-align: left !important; }
  #content form table:not(#ticketTable) hr { margin: 14px 0 8px; }
  #content form input[type="text"]:not([name*="ext"]),
  #content form input[type="email"],
  #content form input[type="password"],
  #content form input[type="tel"],
  #content form select { width: 100% !important; max-width: none !important; }
  #content form .select2-container { width: 100% !important; }
  #content p.buttons { text-align: center !important; }
  #content p.buttons input { width: 100%; margin: 6px 0; }

  .front-page-button .button,
  .front-page-button a.button { font-size: 16px; }
}
