/* CasaStudenti - Extended Styles (non sovrascrive style.css lockato) */

/* Sortable table header links */
.sort-link {
  color: inherit;
  font-weight: inherit;
  text-transform: inherit;
  letter-spacing: inherit;
  font-size: inherit;
  text-decoration: none;
  white-space: nowrap;
  transition: color 0.15s;
}
.sort-link:hover {
  color: var(--primary);
}

/* Badge categoria fallback */
.badge-cat:not(.badge-cat-luce):not(.badge-cat-gas):not(.badge-cat-acqua):not(.badge-cat-internet):not(.badge-cat-condominio):not(.badge-cat-manutenzione):not(.badge-cat-pulizie):not(.badge-cat-tassa-rifiuti):not(.badge-cat-altro) {
  background-color: #f5f5dc; color: #6b6b4a;
}

/* Importo colorato per stato */
.importo-pagato strong { color: var(--money-positive); }
.importo-scaduto strong { color: var(--money-negative); }
.importo-da-pagare strong { color: #f59e0b; }

/* Riepilogo spese filtrate */
.spese-summary {
  display: flex; gap: 1rem; margin-top: 1.5rem;
  padding: 1rem 1.25rem;
  background: var(--surface_container_low);
  border: 1px solid var(--outline_variant);
  border-radius: 12px; flex-wrap: wrap;
}
.summary-item { flex: 1; min-width: 140px; text-align: center; padding: 0.5rem; }
.summary-label { display: block; font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--on_surface_variant); margin-bottom: 0.3rem; }
.summary-value { display: block; font-size: 1.25rem; font-weight: 700; color: var(--on-surface); }
.summary-sub { display: block; font-size: 0.7rem; color: var(--on_surface_variant); }
.summary-item.pagate .summary-value { color: var(--money-positive); }
.summary-item.da-pagare .summary-value { color: var(--money-negative); }

/* Link debito studentesse */
.debito-link { text-decoration: none; }
.debito-link:hover strong { text-decoration: underline; }

/* Incolla e trascina file: applicato automaticamente a tutti i campi file */
.file-paste-helper {
  margin-top: 0.65rem;
}

.file-paste-target {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-height: 64px;
  padding: 0.8rem 1rem;
  border: 2px dashed rgba(65, 85, 124, 0.24);
  border-radius: 12px;
  background: rgba(65, 85, 124, 0.035);
  color: var(--on_surface_variant);
  cursor: text;
  transition: border-color 0.15s ease, background-color 0.15s ease, box-shadow 0.15s ease;
  user-select: none;
}

.file-paste-target:focus {
  outline: none;
  border-color: var(--primary);
  background: rgba(65, 85, 124, 0.07);
  box-shadow: 0 0 0 4px rgba(65, 85, 124, 0.1);
}

.file-paste-target.is-dragging {
  border-color: var(--primary);
  background: rgba(65, 85, 124, 0.1);
}

.file-paste-target.has-success {
  border-color: var(--money-positive);
  background: var(--money-positive-bg);
}

.file-paste-target.has-error {
  border-color: var(--money-negative);
  background: var(--money-negative-bg);
}

.file-paste-target strong,
.file-paste-target small {
  display: block;
}

.file-paste-target strong {
  color: var(--on_surface);
  font-size: 0.88rem;
}

.file-paste-target small {
  margin-top: 0.15rem;
  font-size: 0.74rem;
  font-weight: 400;
}

.file-paste-icon {
  font-size: 1.35rem;
  line-height: 1;
}

.file-paste-status {
  min-height: 1.2em;
  margin-top: 0.3rem;
  color: var(--on_surface_variant);
  font-size: 0.75rem;
}

/* Ordinamento globale tabelle */
.table-sortable thead th:not(.table-sort-disabled),
.table-sortable thead th.table-sort-server {
  padding: 0;
}

.table-sort-button,
.table-sort-server .sort-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.55rem;
  width: 100%;
  min-height: 52px;
  padding: 0.75rem 1rem;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  font-weight: inherit;
  letter-spacing: inherit;
  text-align: left;
  text-transform: inherit;
  cursor: pointer;
}

.table-sort-button:hover,
.table-sort-button:focus-visible,
.table-sort-server .sort-link:hover,
.table-sort-server .sort-link:focus-visible {
  color: var(--primary);
  background: rgba(65, 85, 124, 0.06);
  outline: none;
}

.table-sort-button:focus-visible,
.table-sort-server .sort-link:focus-visible {
  box-shadow: inset 0 0 0 2px var(--primary);
}

.table-sort-indicator {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  min-width: 34px;
  min-height: 22px;
  padding: 0.15rem 0.35rem;
  border-radius: 999px;
  background: rgba(65, 85, 124, 0.08);
  color: var(--on_surface_variant);
  font-size: 0.62rem;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0;
  text-transform: none;
}

.table-sortable thead th.is-sorted .table-sort-indicator,
.table-sort-server[aria-sort="ascending"] .table-sort-indicator,
.table-sort-server[aria-sort="descending"] .table-sort-indicator {
  background: var(--primary);
  color: #fff;
}

.calendar-table .table-sort-button {
  justify-content: center;
  min-width: 58px;
  padding-right: 0.45rem;
  padding-left: 0.45rem;
}

.calendar-table th:first-child .table-sort-button {
  justify-content: space-between;
  padding-left: 1rem;
}

@media (max-width: 768px) {
  .table-sort-button,
  .table-sort-server .sort-link {
    min-height: 46px;
    padding: 0.65rem 0.75rem;
  }

  .table-sort-indicator {
    min-width: 30px;
    font-size: 0.58rem;
  }
}
