/* Variabili */

:root {
  --font-size-small: 0.7rem;
  --font-size-base: clamp(0.85rem, 1vw, 10rem);

  --first-col-width: 20%;
  --page-max-width: 1000px;

  --page-pad: 16px;
  --page-pad-x: 10px;
  --page-pad-y: 16px;

  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --page-bottom-gap: calc(var(--page-pad) + var(--safe-bottom));

  --header-height: 60px;

  --separator: rgba(0, 0, 0, 0.2);
  --danger: #2f9b49;

  --z-header: 1;
  --z-overlay: 2;
  --z-popup: 3;
  --z-menu: 4;
}

/* Elementi strutturali base */
html {
  min-height: 100%;
}

body {
  margin: 0;
  text-align: center;
}

body#body {
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  font-family: "Barlow Condensed", sans-serif;
  font-size: var(--font-size-base);
}

* {
    -webkit-tap-highlight-color: transparent;
}

main {
  width: 100%;
  box-sizing: border-box;
}

.page-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}

.page-fixed {
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}

.page-shell {
  width: 100%;
  max-width: var(--page-max-width);
  margin: 0 auto;
  box-sizing: border-box;
}

.page-pad {
  padding: var(--page-pad);
  padding-bottom: var(--page-bottom-gap);
  box-sizing: border-box;
}

/* Header */

.header {
  position: sticky;
  top: 0;
  left: 0;
  width: 100%;
  min-height: var(--header-height);
  height: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--page-pad-x);
  box-sizing: border-box;
  z-index: var(--z-header);
}

.header h1 {
  font-size: 20px;
  margin: 0 0 0 -30px;
  flex-grow: 1;
  text-align: center;
  line-height: 1.1;
}

/* Tipografia ed elementi comuni della UI */

h2 {
  margin: 10px 0 5px 0;
}

.material-symbols-rounded {
  font-size: 34px !important;
  cursor: pointer;
}

.separator {
  position: relative;
  width: 100%;
  height: 1px;
  margin: 10px 0;
  background-color: var(--separator);
  opacity: 0.5;
}

.view {
  background: transparent;
  border: none;
}

.view .material-symbols-rounded {
  font-size: 20px !important;
  font-variation-settings: 'FILL' 1;
}

/* Tabelle */

.table-card {
  border-radius: 15px;
  overflow: hidden;
  -webkit-overflow-scrolling: touch;
  background: #fff;
  box-sizing: border-box;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  text-align: center;
  box-sizing: border-box;
}

/* Inputs comuni */

input,
select,
button,
textarea {
  font: inherit;
}

input:focus,
select:focus,
textarea:focus,
button:focus {
  outline: none;
  box-shadow: none;
}

input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button,
input[type="number"] {
  margin: 0;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: textfield;
}

/* Popup e layers di overlay */

.overlay {
  position: fixed;
  inset: 0;
  z-index: var(--z-overlay);
}

.popup {
  position: fixed;
  inset: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: var(--z-popup);
  background-color: rgba(0, 0, 0, 0.8);
}

.popup-content {
  position: relative;
  width: 80%;
  padding: 15px;
  border-radius: 10px;
}

.chiudi-popup {
  position: absolute;
  top: 10px;
  right: 10px;
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
}

/* Tweaks comuni per i select */

#gruppo-select,
#cloud-group-select {
  text-align: center;
  border-radius: 7px;
}

/* Media queries globali */

@supports (height: 100svh) {
  body#body {
    min-height: 100svh;
  }
}

@media (max-width: 600px) {
  th,
  td {
    padding: 3px;
  }
}

@media (max-width: 400px) {
  #score-table th,
  #score-table td {
    padding: 3px;
    font-size: calc(var(--font-size-base) + 0.5rem);
    zoom: 0.83;
  }

  #elenco-partite th,
  #elenco-partite td {
    padding: 2px;
    font-size: calc(var(--font-size-base) + 0.2rem);
    zoom: 0.83;
  }
}