* {
  font-family: "Onest", sans-serif;
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background-color: #f0f0f0;
  color: #333;
  padding: 20px;
}

.container {
  max-width: 1200px;
  margin: 0 auto 20px auto;
  padding: 20px;
  background-color: #fff;
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);

  & h1 {
    text-align: center;
    margin-bottom: 20px;
  }

  & h2 {
    text-align: center;
    margin-bottom: 20px;
  }
}

.contact-form {
  display: flex;
  flex-direction: column;
}

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

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

  & input,
  textarea {
    width: 100%;
    padding: 10px;
    border: 2px solid #ccc;
    border-radius: 4px;
    font-size: 16px;
    transition: border-color 0.3s ease;

    &:focus {
      border-color: #007bff;
      outline: none;
    }
  }

  & textarea {
    resize: vertical;
    min-height: 100px;
    max-height: 300px;
  }

  & .error-message {
    color: red;
    font-size: 14px;
    margin-top: 5px;
    padding: 0 10px;
  }
}

.send-button {
  background-color: #28a745;
  color: white;
  border: none;
  padding: 10px 15px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 16px;
  transition: background-color 0.3s ease;

  &:hover {
    background-color: #218838;
  }
}

#messages {
  margin-top: 20px;

  & p {
    text-align: center;
    color: #666;
  }
}

.message {
  display: flex;
  padding: 10px;
  border: 1px solid transparent;
  border-bottom: 2px solid #ccc;
  cursor: pointer;
  transition: background-color 0.3s ease;

  &:first-child {
    border-radius: 8px 8px 0 0;
  }

  &:last-child {
    border-radius: 0 0 8px 8px;
    margin-bottom: 0;
    border-bottom: none;
  }

  &:only-child {
    border-radius: 8px;
  }

  &.read {
    background-color: white;
  }

  &.unread {
    background-color: #f8f9fa;
  }

  &:hover {
    background-color: #e9ecef;
  }
}

.content {
  flex: 1;
  margin-right: 20px;
  min-width: 0;

  & .author {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 10px;
    margin-bottom: 5px;
    font-weight: bold;

    & h3 {
      font-size: 18px;
    }

    & p {
      margin: 0;
      font-size: 14px;
      color: #555;
    }
  }

  & .message-preview {
    font-size: 16px;
    color: #333;
    margin-bottom: 5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
}

.buttons {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  max-width: 235px;

  & button {
    border: none;
    border-bottom: #555 solid 2px;
    padding: 10px 10px;
    background-color: transparent;
    cursor: pointer;
    transition: transform 0.3s ease;
    margin-left: 10px;

    &:hover {
      transform: scale(1.05) translateY(-2px);
    }
    &:first-child {
      margin-left: 0;
    }

    &.read-button {
      width: 155px;
    }

    &.delete-button {
      width: 70px;
    }
  }
}

#message-dialog {
  border: none;
  border-radius: 8px;
  position: fixed;
  inset: 0;
  margin: auto;
  padding: 20px;
  width: 600px;
  max-width: 90%;
  background-color: white;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  animation: show-dialog 0.3s ease-in-out;

  &::backdrop {
    backdrop-filter: blur(5px);
  }

  &[open]::backdrop {
    animation: show-backdrop 0.3s ease-in-out;
  }
}

@keyframes show-backdrop {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes show-dialog {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

#message-dialog.closing {
  animation: hide-dialog 0.3s ease-in-out forwards;
}

#message-dialog[open].closing::backdrop {
  animation: hide-backdrop 0.3s ease-in-out forwards;
}

@keyframes hide-backdrop {
  from {
    opacity: 1;
  }
  to {
    opacity: 0;
  }
}

@keyframes hide-dialog {
  from {
    opacity: 1;
    transform: translateY(0);
  }
  to {
    opacity: 0;
    transform: translateY(-20px);
  }
}

.dialog-content {
  & h2 {
    border: none;
    border-bottom: 2px solid #ccc;
    padding-bottom: 10px;
    margin-bottom: 20px;
  }
}

.message-details {
  margin-bottom: 20px;

  & p {
    margin: 0 0 10px;
    color: #444;
    line-height: 1.4;
  }

  & .author,
  .email {
    display: flex;
    gap: 8px;
    font-weight: bold;

    & span {
      font-weight: normal;
      color: #666;
    }
  }

  #dialog-message {
    background: #f9f9f9;
    padding: 12px;
    border-radius: 8px;
    font-size: 0.95rem;
    color: #555;
  }
}

#close-button {
  background-color: #0077ff;
  color: white;
  border: none;
  padding: 10px 15px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 16px;
  transition: background-color 0.3s ease;

  &:hover {
    background-color: #005bb5;
  }

  &:focus {
    outline: none;
  }
}
