/* ==========================================================
   SE.GE.DI. - INTERFACCIA RESPONSIVE GENERALE
   ========================================================== */

/* Checkbox e radio non devono ereditare la larghezza dei campi. */
input[type="checkbox"],
input[type="radio"] {
  appearance: auto;
  width: 20px !important;
  min-width: 20px !important;
  max-width: 20px !important;
  height: 20px !important;
  min-height: 20px !important;
  max-height: 20px !important;
  padding: 0 !important;
  margin: 2px 6px 2px 0;
  vertical-align: middle;
}

/* Elementi utilizzabili dai singoli template. */
.mobile-only {
  display: none !important;
}

.desktop-only {
  display: initial;
}

@media (max-width: 700px) {
  html,
  body {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
  }

  body {
    font-size: 16px;
    line-height: 1.35;
  }

  main {
    width: 100%;
    max-width: 100%;
    margin: 10px 0;
    padding: 0 9px;
  }

  .mobile-only {
    display: initial !important;
  }

  .desktop-only,
  .hide-mobile {
    display: none !important;
  }

  .card {
    width: 100%;
    max-width: 100%;
    padding: 12px;
    margin-bottom: 11px;
    border-radius: 10px;
    overflow: hidden;
  }

  h1 {
    font-size: 22px;
    line-height: 1.2;
  }

  h2 {
    font-size: 20px;
    line-height: 1.2;
  }

  h3 {
    font-size: 18px;
    line-height: 1.25;
  }

  /*
   * I normali campi diventano grandi e facilmente utilizzabili.
   * Checkbox e radio sono esclusi esplicitamente.
   */
  input:not([type="checkbox"]):not([type="radio"]),
  select,
  textarea {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    min-height: 44px;
    padding: 9px 10px;
    font-size: 16px;
  }

  textarea {
    min-height: 90px;
  }

  input[type="checkbox"],
  input[type="radio"] {
    width: 22px !important;
    min-width: 22px !important;
    max-width: 22px !important;
    height: 22px !important;
    min-height: 22px !important;
    max-height: 22px !important;
    flex: 0 0 22px !important;
  }

  button,
  .btn {
    min-height: 44px;
    font-size: 15px;
    line-height: 1.2;
    white-space: normal;
  }

  /* Moduli generali: una colonna sul telefono. */
  .row,
  .grid {
    display: grid;
    grid-template-columns: 1fr !important;
    gap: 9px;
  }

  .row > *,
  .grid > * {
    grid-column: auto !important;
    width: 100%;
    min-width: 0;
  }

  /*
   * Applicare mobile-two-columns ai piccoli riepiloghi che devono
   * restare su due colonne anche dal telefono.
   */
  .mobile-two-columns {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 10px !important;
  }

  .mobile-two-columns > * {
    width: auto !important;
    min-width: 0 !important;
  }

  /* Tabelle: scorrono dentro la pagina senza deformarla. */
  .table-wrap {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  table {
    max-width: 100%;
  }

  .table-wrap table {
    min-width: 680px;
  }

  th,
  td {
    white-space: normal;
  }

  /* Gruppi di pulsanti compatti. */
  .mobile-actions {
    display: flex !important;
    flex-wrap: wrap;
    gap: 7px;
  }

  .mobile-actions .btn,
  .mobile-actions button {
    flex: 1 1 auto;
  }

  img,
  video,
  canvas,
  iframe {
    max-width: 100%;
  }

  form,
  fieldset {
    width: 100%;
    max-width: 100%;
    min-width: 0;
  }

  /* Modulo Enel X. */
  #enelPaloDetails,
  #enelQeDetails {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }

  #enelPaloWorks label,
  #enelQeWorks label {
    display: flex !important;
    align-items: flex-start !important;
    gap: 9px !important;
  }

  #enelPaloWorks label > span,
  #enelQeWorks label > span {
    min-width: 0;
    flex: 1;
  }

  #enelMiniMap iframe {
    height: 220px !important;
  }
}
