/* Tarinan Karisma - varauskalenterin testityylit */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  width: 100%;
  overflow-x: hidden;
}

body {
  min-height: 100vh;
  margin: 0;
  padding: 32px 16px;
  overflow-x: hidden;
  background: #f4fbff;
  color: #12345a;
  font-family: Arial, Helvetica, sans-serif;
  line-height: 1.6;
}

button,
input,
select,
textarea {
  font: inherit;
}

/* Ylläpidon sivurakenne */

.admin-page {
  width: min(1000px, 100%);
  margin: 0 auto;
}

.admin-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  gap: 20px;
}

.eyebrow {
  margin: 0 0 4px;
  color: #0d6fb8;
  font-weight: 700;
}

/* Otsikot */

h1,
h2,
h3 {
  color: #0d3d7a;
}

h1 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2rem, 5vw, 3rem);
  line-height: 1.15;
}

h2 {
  margin: 0 0 20px;
}

/* Ylläpidon kortit */

.admin-panel {
  margin-bottom: 24px;
  padding: 28px;
  background: #ffffff;
  border: 1px solid #cde9fa;
  border-radius: 24px;
  box-shadow: 0 14px 36px rgba(13, 94, 160, 0.1);
}

/* Uuden ajan avaamisen lomake */

.slot-form {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.form-field {
  display: grid;
  min-width: 0;
  gap: 6px;
}

.form-field-wide {
  grid-column: 1 / -1;
}

.form-field label {
  color: #12345a;
  font-weight: 700;
}

.optional {
  color: #69829b;
  font-weight: 400;
}

.form-field input,
.form-field select {
  display: block;
  width: 100%;
  min-width: 0;
  min-height: 48px;
  padding: 12px 14px;
  background: #ffffff;
  color: #12345a;
  border: 1px solid #b9def5;
  border-radius: 12px;
}

.form-field input:focus,
.form-field select:focus {
  border-color: #0d6fb8;
  outline: 3px solid rgba(99, 185, 240, 0.3);
}

.form-actions {
  display: flex;
  justify-content: flex-start;
}

/* Painikkeet */

.primary-button,
.secondary-button,
.danger-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 12px 22px;
  border-radius: 999px;
  font-weight: 700;
  line-height: 1.3;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
}

.primary-button {
  background: #0d6fb8;
  color: #ffffff;
  -webkit-text-fill-color: #ffffff;
  border: 0;
}

.secondary-button {
  background: #ffffff;
  color: #0d6fb8;
  border: 1px solid #b9def5;
}

.danger-button {
  background: #ffffff;
  color: #a02929;
  border: 1px solid #e3bcbc;
}

.primary-button:hover {
  background: #0a5792;
}

.secondary-button:hover {
  background: #eef9ff;
}

.danger-button:hover {
  background: #fff2f2;
}

.primary-button:focus-visible,
.secondary-button:focus-visible,
.danger-button:focus-visible {
  outline: 3px solid rgba(99, 185, 240, 0.4);
  outline-offset: 3px;
}

/* Varausaikojen listat */

.slot-list {
  display: grid;
  gap: 14px;
}

.slot-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px;
  gap: 20px;
  background: #f9fdff;
  border: 1px solid #cde9fa;
  border-radius: 18px;
}

.slot-card-content {
  min-width: 0;
}

.slot-card h3 {
  margin: 8px 0 6px;
}

.slot-card p {
  margin: 4px 0;
}

.slot-card-muted {
  background: #f5f7f9;
  opacity: 0.85;
}

.slot-card-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  flex-wrap: wrap;
}

.slot-card-actions form {
  margin: 0;
}

/* Tilamerkinnät */

.status {
  display: inline-flex;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 700;
}

.status-available {
  background: #e5f7ed;
  color: #17653a;
}

.status-booked {
  background: #e7f1ff;
  color: #0d4f92;
}

.status-closed {
  background: #eef0f2;
  color: #52606c;
}

/* Ilmoitukset */

.message {
  margin-bottom: 24px;
  padding: 16px 20px;
  border-radius: 14px;
}

.message-success {
  background: #e5f7ed;
  color: #17653a;
  border: 1px solid #acdabb;
}

.message-error {
  background: #fff0f0;
  color: #8a2020;
  border: 1px solid #e3bcbc;
}

/* Päivämäärän valinta */

.date-choice-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.date-choice-button {
  display: grid;
  min-width: 0;
  padding: 16px;
  gap: 3px;
  background: #e7f4ff;
  color: #0d5797;
  border: 1px solid #b9def5;
  border-radius: 16px;
  text-decoration: none;
  transition:
    background-color 0.2s ease,
    border-color 0.2s ease;
}

.date-choice-button:hover {
  background: #d9efff;
  border-color: #77bdeb;
}

.date-choice-button:focus-visible {
  outline: 3px solid rgba(99, 185, 240, 0.45);
  outline-offset: 3px;
}

.date-choice-button-selected {
  background: #0d6fb8;
  color: #ffffff;
  border-color: #0d6fb8;
  box-shadow: 0 8px 20px rgba(13, 111, 184, 0.2);
}

.date-choice-date {
  font-size: 1.05rem;
  font-weight: 700;
}

.date-choice-count {
  font-size: 0.9rem;
  opacity: 0.86;
}

/* Varauksen tietojen admin-näkymä */

.booking-detail-list {
  display: grid;
  margin: 24px 0 0;
  gap: 0;
}

.booking-detail-list > div {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr);
  align-items: baseline;
  gap: 20px;
  padding: 12px 0;
  border-bottom: 1px solid #dce8f3;
}

.booking-detail-list > div:last-child {
  border-bottom: 0;
}

.booking-detail-list dt {
  margin: 0;
  color: #063f82;
  font-weight: 700;
}

.booking-detail-list dd {
  min-width: 0;
  margin: 0;
  overflow-wrap: anywhere;
  color: #12345a;
  font-weight: 400;
}

.booking-detail-list a {
  color: #0d6fb8;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.booking-detail-list a:hover {
  color: #0a5792;
}

/* Varauksen poistaminen */

.booking-delete-panel {
  margin-top: 48px;
  border-color: #e3bcbc;
  background: #fffafa;
}

.booking-delete-panel h2 {
  margin-bottom: 12px;
  color: #8a2020;
}

.booking-delete-panel p {
  margin: 0 0 20px;
  color: #6f4545;
}

/* Mobiilinäkymä */

@media (max-width: 700px) {
  body {
    padding: 20px 12px;
  }

  .admin-page {
    width: 100%;
    max-width: 100%;
    min-width: 0;
  }

  .admin-header {
    align-items: stretch;
    flex-direction: column;
  }

  .admin-header .secondary-button {
    width: 100%;
  }

  .admin-panel {
    position: relative;
    display: flow-root;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    height: auto;
    margin-bottom: 24px;
    padding: 18px 16px;
    overflow: hidden;
    border-radius: 16px;
  }

  /* Uuden ajan lomake yhtenä responsiivisena sarakkeena */

  .slot-form {
    position: static;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    width: 100%;
    max-width: 100%;
    min-width: 0;
    height: auto;
    gap: 16px;
  }

  .slot-form .form-field,
  .slot-form .form-field-wide,
  .slot-form .form-actions {
    position: static;
    grid-column: 1;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    height: auto;
  }

  .slot-form input,
  .slot-form select,
  .slot-form button {
    display: block;
    box-sizing: border-box;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    inline-size: 100%;
    max-inline-size: 100%;
    min-inline-size: 0;
  }

  /*
   * iOS- ja Android-selainten natiivit päivämäärä- ja
   * kellonaikakentät voivat muuten ylittää vanhemman leveyden.
   */

  .slot-form input[type="date"],
  .slot-form input[type="time"] {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    inline-size: 100%;
    max-inline-size: 100%;
    min-inline-size: 0;
    appearance: none;
    -webkit-appearance: none;
  }

  .slot-form .form-actions {
    display: flex;
    margin-top: 4px;
    padding: 0;
  }

  .slot-form .form-actions button {
    width: 100%;
    max-width: 100%;
    min-width: 0;
  }

  /* Varauskortit */

  .slot-card {
    align-items: stretch;
    flex-direction: column;
  }

  .slot-card form,
  .slot-card button,
  .slot-card .secondary-button,
  .slot-card .danger-button {
    width: 100%;
    max-width: 100%;
  }

  .slot-card-actions {
    width: 100%;
    align-items: stretch;
    flex-direction: column;
  }

  .slot-card-actions form {
    width: 100%;
  }

  /* Asiakasnäkymän päivämäärävalinta */

  .date-choice-list {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    width: 100%;
    max-width: 100%;
    min-width: 0;
    margin: 0;
    padding: 0;
    gap: 12px;
  }

  .date-choice-list > .date-choice-button {
    grid-column: 1;
    justify-self: stretch;
    box-sizing: border-box;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    margin: 0;
  }

  /* Varauksen tietojen admin-näkymä */

  .booking-detail-list > div {
    grid-template-columns: minmax(0, 1fr);
    gap: 2px;
    padding: 10px 0;
  }

  .booking-detail-list dd {
    margin-left: 20px;
  }
}

@media (max-width: 640px) {
  html,
  body {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
  }

  .admin-page,
  .admin-panel,
  .slot-form,
  .form-field,
  .date-choice-list,
  .date-choice-button {
    min-width: 0;
    max-width: 100%;
  }
}