/* ===============================
   GLOBAL NORMALIZATION
================================*/

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

/* Normalizzazione controlli (Chrome + Firefox) */
button,
input,
select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none !important; /* Firefox fix */
  border-radius: 0;
}

/* ===============================
   BODY & LAYOUT
================================*/

body {
  font-family: Arial, sans-serif;
  max-width: 900px;
  margin: 0 auto;
  padding: 20px;
}

.form-group {
  margin-bottom: 15px;
}

label {
  display: block;
  margin-bottom: 5px;
  font-weight: bold;
}

input,
select,
button {
  width: 100%;
  padding: 10px;
  margin-bottom: 10px;
  font-size: 16px;
  line-height: 1.2;
}

/* ===============================
   BUTTONS
================================*/

button {
  background: #007bff;
  color: white;
  border: none;
  cursor: pointer;
  border-radius: 6px;
  transition: background 0.15s ease;
  display: block;
  text-align: center;

  /* Firefox normalizzazione finale */
  padding: 12px !important;
  line-height: 1 !important;
  min-width: 0 !important;
}

button:hover {
  background: #0056b3;
}

.collapse-btn {
  padding: 8px 12px;
  background: #666;
  border-radius: 5px;
}

.collapse-btn:hover {
  background: #444;
}

/* HIDDEN */
.hidden {
  display: none !important;
}

/* ===============================
   RESULTS AREA
================================*/

#resultContent {
  margin-top: 20px;
  text-align: center;
}

/* ===============================
   TABLE PREVIEW
================================*/

.table-container {
  width: 100%;
  overflow-x: auto;
  margin: 0 auto 30px auto;
}

table {
  border-collapse: collapse;
  width: 100%;
  max-width: 100%;
}

table,
th,
td {
  border: 1px solid #ddd;
  padding: 8px;
}

th {
  background: #f4f4f4;
  text-align: center;
}

td {
  text-align: center;
}

/* PREVIEW TABLE */

#preview-container table {
  border-collapse: collapse;
  width: 100%;
  font-size: 0.9rem;
}

#preview-container th,
#preview-container td {
  border: 1px solid #ccc;
  padding: 6px 8px;
  text-align: left;
}

#preview-container th {
  background-color: #f3f3f3;
  font-weight: bold;
}

/* ===============================
   PREVIEW BOX
================================*/

.preview-box {
  margin-top: 20px;
  border: 1px solid #ddd;
  padding: 15px;
  border-radius: 6px;
  background: #fafafa;
}

.preview-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

/* ===============================
   ERROR BOX
================================*/

.error-box {
  margin-top: 20px;
  padding: 15px;
  border: 1px solid red;
  background: #ffe6e6;
}

#loader {
  text-align: center;
  font-size: 1.2em;
  color: #007bff;
  margin-top: 20px;
}

/* ===============================
   FIREFOX INPUT FIXES
================================*/

input[type="file"] {
  padding: 8px;
  border: 1px solid #aaa;
  background: white;
  font-size: 15px;
}

select {
  border: 1px solid #aaa;
  background-color: #fff;
  background-image: none !important; /* rimuove freccia nativa Firefox */
}
