/* === Grundlayout === */
body {
  font-size: 22px;
  line-height: 1.5;
  font-family: sans-serif;
  background: #f8f9fa;
  margin: 0;
  padding: 0;
}

.wrapper {
  max-width: 1000px;
  margin: 0 auto;
  padding: 20px;
}

h1 {
  text-align: center;
  margin-top: 20px;
  font-size: 56px;
}

/* === Sökfält + knappar === */
.top-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  align-items: center;
  margin-bottom: 20px;
}

.search-input {
  flex: 1 1 250px;
  max-width: 300px;
  padding: 10px;
  font-size: 26px;
}

.top-bar .btn {
  flex: 0 0 auto;
  padding: 10px 14px;
  font-size: 16px;
  white-space: nowrap;
  background-color: #007BFF;
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: background-color 0.3s ease;
}

.top-bar .btn:hover {
  background-color: #0056b3;
}

/* === Kolumnväljare === */
.column-selector {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
  margin-bottom: 20px;
  font-size: 22px;
}

.column-selector label {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* === Tabell === */
.table-wrapper {
  overflow-x: auto;
}

table {
  width: 100%;
  max-width: 1200px;
  margin: 10px auto;
  border-collapse: collapse;
  background: white;
}

th, td {
  font-size: 26px;
  padding: 4px;
  text-align: left;
  border-bottom: 1px solid #ccc;
}

th {
  background: #e9ecef;
  cursor: pointer;
  user-select: none;
}

.sort-icon {
  margin-left: 6px;
  font-size: 14px;
  color: #555;
}

/* === Färgkodning för bäst före === */
.row-expired {
  background-color: #f8d7da;
}

.row-warning {
  background-color: #fff3cd;
}

.row-ok {
  background-color: #d4edda;
}

/* === Formulär === */
form {
  max-width: 1200px;
  margin: 20px auto;
  padding: 10px;
  background: #fff;
  border: 1px solid #ccc;
  border-radius: 6px;
}

#formTable {
  width: 100%;
  border-collapse: collapse;
}

#formTable td {
  padding: 10px;
  vertical-align: top;
}

.form-input {
  width: 100%;
  padding: 10px;
  font-size: 22px;
  box-sizing: border-box;
  border: 1px solid #ccc;
  border-radius: 4px;
}

.form-label {
  font-weight: bold;
  font-size: 22px;
  margin-bottom: 10px;
  color: #28a745;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.cancel-edit {
  font-size: 14px;
  text-decoration: none;
  color: #dc3545;
  background: #fcebea;
  padding: 4px 8px;
  border-radius: 4px;
}

.cancel-edit:hover {
  background: #f8d7da;
}

/* === Knappar === */
.btn, .edit-btn, #showBtn {
  padding: 10px 10px;
  font-size: 22px;
  background-color: #28a745;
  color: white;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  display: block;
  margin: 20px auto;
  transition: background-color 0.3s ease, transform 0.2s ease;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  text-align: center;
}

.btn:hover, .edit-btn:hover, #showBtn:hover {
  background-color: #218838;
  transform: scale(1.03);
}

.edit_btn, .del_btn {
  display: inline-block;
  padding: 6px 10px;
  color: white;
  border-radius: 4px;
  text-decoration: none;
  font-size: 14px;
}

.edit_btn {
  background: #007BFF;
}

.del_btn {
  background: #dc3545;
}

.edit_btn:hover {
  background: #0056b3;
}

.del_btn:hover {
  background: #c82333;
}

/* === Färglegend === */
.legend {
  max-width: 1000px;
  margin: 30px auto;
  padding: 20px;
  background: #ffffff;
  border: 1px solid #ccc;
  border-radius: 6px;
  font-size: 16px;
  line-height: 1.6;
  box-sizing: border-box;
}

.legend p {
  font-weight: bold;
  margin-bottom: 12px;
  text-align: center;
}

.legend ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.legend li {
  padding: 10px;
  border-radius: 4px;
  color: #212529;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* === Mobilanpassning === */
@media (max-width: 600px) {
  .wrapper,
  form {
    padding: 10px;
    max-width: 100%;
  }

  .top-bar,
  .column-selector {
    flex-direction: column;
    align-items: stretch;
  }

  .search-input,
  .top-bar .btn,
  .column-selector label {
    width: 100%;
    max-width: none;
  }

  table, thead, tbody, th, td, tr {
    display: block;
  }

  thead {
    display: none;
  }

  tr {
    margin-bottom: 15px;
    border: 1px solid #ccc;
    padding: 10px;
    background: white;
  }

  td {
    position: relative;
    padding-left: 50%;
    font-size: 18px;
    border: none;
  }

  td::before {
    content: attr(data-label);
    position: absolute;
    left: 10px;
    top: 10px;
    font-weight: bold;
    color: #333;
  }

  #formTable td {
    display: block;
    width: 100%;
    margin-bottom: 12px;
  }

  #formTable td:before {
    content: attr(data-label);
    font-weight: bold;
    display: block;
    margin-bottom: 4px;
    color: #333;
  }

  .btn, .edit-btn, .del_btn, #showBtn {
    width: 100%;
    margin-top: 8px;
  }
}

/* === Formulärrubriker === */
#formTable thead th {
  background-color: #f0f0f0;
  font-size: 22px;
  padding: 8px;
  text-align: left;
  font-weight: bold;
  border-bottom: 2px solid #ccc;
}

/* === Formulärfält === */
#formTable input[type="text"],
#formTable input[type="number"],
#formTable input[type="date"] {
  width: 100%;
  font-size: 22px;
  padding: 4px;
  box-sizing: border-box;
  border: 1px solid #ccc;
  border-radius: 6px;
}

/* === Formulärknappar === */
#formTable .btn,
#formTable .edit-btn {
  padding: 8px 12px;
  background-color: #007bff;
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
}

#formTable .btn:hover,
#formTable .edit-btn:hover {
  background-color: #0056b3;
  
}

/* === Avbryt-länk === */
.cancel-edit {
  margin-left: 10px;
  font-size: 0.9em;
  color: #dc3545;
  text-decoration: none;
}

.cancel-edit:hover {
  text-decoration: underline;
}

.message-box {
  background-color: #d4edda;
  color: #155724;
  padding: 10px 15px;
  margin: 10px auto;
  width: fit-content;
  border: 1px solid #c3e6cb;
  border-radius: 4px;
  font-weight: bold;
}

.del_btn {
  color: white;
  background-color: #dc3545;
  padding: 6px 10px;
  border-radius: 4px;
  text-decoration: none;
}

.del_btn:hover {
  background-color: #c82333;
}


