/* --- Perusasetukset --- */
html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  min-height: 100%;
  overflow-x: auto; /* Salli vaakasuuntaiset scrollit tarvittaessa */
  font-family: sans-serif;
  background: #eef4f8;
  color: #003366;
  box-sizing: border-box;
}

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

/* --- Header --- */
header {
  width: 100vw; /* Koko selainikkunan leveys */
  background: #005588;
  color: white;
  padding: 1em;
  text-align: center;
  white-space: normal; /* Sallii rivityksen */
  overflow-x: auto;
}

/* --- Navigaatio --- */
nav {
  width: 100vw;
  background: #0077aa;
  padding: 1em 0;
  text-align: center;
  white-space: normal; /* Sallii rivityksen */
  overflow-x: auto;
}

nav a {
  color: white;
  margin: 0 10px;
  text-decoration: none;
  display: inline-block;
  white-space: nowrap; /* Linkit eivät rivity itsessään */
}

nav a:hover {
  text-decoration: underline;
}

/* --- Pääsisältö --- */
main {
  padding: 2em 1em 4em 1em;
  max-width: 100vw;
  margin: 0 auto;
  overflow-x: auto;
  box-sizing: border-box;
  background: transparent;
}

/* --- Lomake --- */
form {
  background: white;
  padding: 1.5em;
  border-radius: 8px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
  max-width: 420px;
  margin: 1em auto;
  box-sizing: border-box;
}

.form-row {
  display: flex;
  flex-direction: column;
  margin-bottom: 1.2em;
}

.form-row label {
  font-weight: bold;
  margin-bottom: 0.5em;
  color: #003366;
}

.form-row input[type="text"],
.form-row input[type="number"],
.form-row input[type="datetime-local"],
.form-row select,
.form-row input[type="file"],
.form-row datalist {
  padding: 0.6em;
  font-size: 1em;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-family: inherit;
  box-sizing: border-box;
}

.form-row input[type="file"] {
  padding: 0.3em;
}

input[type="submit"] {
  background-color: #0077aa;
  color: white;
  padding: 0.8em 1.5em;
  border: none;
  font-size: 1em;
  border-radius: 4px;
  cursor: pointer;
  width: 100%;
  max-width: 300px;
  align-self: center;
  transition: background-color 0.3s ease;
}

input[type="submit"]:hover {
  background-color: #005f88;
}

form input,
form datalist {
  display: block;
  margin: 10px 0;
  padding: 8px;
  width: 100%;
  max-width: 400px;
  box-sizing: border-box;
}

/* --- Taulukko --- */
table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 1.5em;
  background: white;
  box-sizing: border-box;
  overflow-x: auto;
}

th, td {
  padding: 0.6em 0.8em;
  border: 1px solid #ccc;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 0.95em;
  color: #003366;
  font-family: inherit;
}

th:nth-child(1), td:nth-child(1) { width: 20%; }
th:nth-child(2), td:nth-child(2) { width: 15%; }
th:nth-child(3), td:nth-child(3) { width: 15%; }
th:nth-child(4), td:nth-child(4) { width: 12%; }
th:nth-child(5), td:nth-child(5) { width: 12%; }
th:nth-child(6), td:nth-child(6) { width: 26%; }

td button {
  white-space: nowrap;
  padding: 0.3em 0.6em;
  font-size: 0.9em;
  background-color: #0077aa;
  border: none;
  border-radius: 4px;
  color: white;
  cursor: pointer;
  transition: background-color 0.3s ease;
  margin-right: 0.3em;
  font-family: inherit;
}

td button:hover {
  background-color: #005f88;
}

/* --- Responsiivisuus pienillä näytöillä --- */
@media (max-width: 600px) {
  table {
    display: block;
    overflow-x: auto;
    white-space: nowrap;
  }

  main {
    padding: 1em;
  }

  .form-row {
    margin-bottom: 1em;
  }

  input[type="submit"] {
    width: 100%;
  }
}

/* --- Footer --- */
footer {
  background: #005588;
  color: white;
  text-align: center;
  padding: 1em;
  position: fixed;
  bottom: 0;
  width: 100vw;
  box-sizing: border-box;
  white-space: normal;
}
#sisalto {
  background-color: #cfdce4;  /* Tummempi sävy kuin tausta (#eef4f8) */
  border: 1px solid #000000;  /* Ohut musta reuna */
  border-radius: 8px;         /* Pyöristetyt kulmat */
  padding: 1.5em;             /* Sisätyhjennys */
  margin: 2em auto;           /* Ympärillä tilaa */
  max-width: 900px;           /* Maksimileveys */
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.1); /* Kevyt varjo */
}
