:root {
  --clr-moderate-blue: hsl(238, 40%, 52%); /*tag edit reply*/
  --clr-soft-red: hsl(358, 79%, 66%); /*delete*/
  --clr-light-grayish-blue: hsl(239, 57%, 85%); /*hover*/
  --clr-pale-red: hsl(357, 100%, 86%); /*hover*/

  --clr-text1: hsl(212, 24%, 26%); /*name*/
  --clr-text2: hsl(211, 10%, 45%); /*text*/
  --clr-input-border: hsl(223, 19%, 93%); /*input border*/
  --clr-bg: hsl(228, 33%, 97%); /*background like-bg*/
  --clr-white: hsl(0, 0%, 100%); /*button-text comment-bg hsl(0, 0%, 100%);*/

  --transition1: 0.2s;
}

*,
*::after,
*::before {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: inherit;
}

body {
  font-family: "Rubik", sans-serif;
}

main {
  background-color: var(--clr-bg);
}

.chat-section {
  display: grid;
  grid-template-columns: 1fr;
  grid-template-rows: 1fr auto;
  height: 100vh;
  padding-bottom: 32px;
}

/*
 * #COMMENTS
 */

.comments-container {
  position: relative;
}

.comments {
  position: absolute;
  width: 100%;
  margin-inline: auto;
  bottom: 0;
  max-height: 100%;

  overflow-y: scroll;
  padding-bottom: 16px;
  scroll-behavior: smooth;
}

.comment-replies-group {
  padding-inline: 16px;
}

.replies {
  display: grid;
  grid-template-columns: auto 1fr;
}

.replies-thread-line {
  width: 2px;
  background-color: var(--clr-input-border);
  margin-right: 16px;
  margin-top: 1rem;
}

.replies-comments .comment:first-child {
  margin-top: 16px;
}

.comment {
  margin-top: 16px;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  padding: 16px;
  background-color: var(--clr-white);
  border-radius: 8px;
  gap: 12px;
}

.comment-header {
  flex-grow: 1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.sender-img {
  height: 32px;
  aspect-ratio: 1/1;
}
.sender-name {
  font-size: 1rem;
  font-weight: 500;
  color: var(--clr-text1);
}
.you {
  background-color: var(--clr-moderate-blue);
  border-radius: 2px;
  padding: 0 4px;
  color: var(--clr-white);
  font-size: 0.75rem;
  line-height: 1rem;
  margin-top: 0.125rem;
}
.date {
  font-size: 1rem;
  font-weight: 400;
  color: var(--clr-text2);
}

.comment-content {
  width: 100%;
  word-wrap: break-word;
  font-size: 1rem;
  font-weight: 400;
  color: var(--clr-text2);
}
.comment-content.active {
  outline: 1px solid var(--clr-moderate-blue);
  border-radius: 8px;
  padding: 8px 16px;
}
.comment-text[contenteditable="true"] {
  outline: none;
}

.reply-to {
  color: var(--clr-moderate-blue);
  font-weight: 500;
}
.reply-to::before {
  content: "@";
}

.vote {
  display: flex;
  align-items: center;
  justify-content: space-evenly;
  width: fit-content;
  background-color: var(--clr-bg);
  border-radius: 8px;
  width: 100px;
  height: 40px;
}
.btn-vote {
  background: none;
  border: none;
  font-size: 1rem;
  font-weight: 500;
  color: var(--clr-light-grayish-blue);
  cursor: pointer;
  width: 24px;
  height: 24px;
  caret-color: transparent;

  transition: var(--transition1);
}
.btn-vote:hover {
  background-color: hsla(0, 0%, 0%, 0.1);
  color: var(--clr-moderate-blue);
  border-radius: 50%;
}
.comment-score {
  font-size: 1rem;
  font-weight: 500;
  color: var(--clr-moderate-blue);
  caret-color: transparent;
  cursor: default;
}

.comment-tools {
  width: fit-content;
  justify-self: end;
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
}
.comment-tool {
  display: flex;
  gap: 4px;
  align-items: center;
  background: none;
  border: none;
  cursor: pointer;

  transition: var(--transition1);
}
.tool-text {
  font-size: 1rem;
  font-weight: 500;
  pointer-events: none;
  caret-color: transparent;
}
.tool-icon {
  pointer-events: none;
}
.reply,
.edit {
  color: var(--clr-moderate-blue);
}
.delete {
  color: var(--clr-soft-red);
}
.reply:hover,
.edit:hover {
  color: var(--clr-light-grayish-blue);
}
.delete:hover {
  color: var(--clr-pale-red);
}

/*
 * #INPUT-COMMENT
 */

.send-reply-form {
  margin-top: 16px;
}

.main-input-group {
  padding-inline: 16px;
}
.main-input-container {
  overflow-y: scroll;
}

.form {
  flex-wrap: wrap;
  width: 100%;
  display: flex;
  gap: 16px;
  padding: 16px;
  border-radius: 4px;
  background-color: var(--clr-white);
  justify-content: space-between;
  align-items: center;
}

.input {
  width: 100%;

  border: 1px solid var(--clr-input-border);
  border-radius: 8px;
  padding: 8px 16px;
  min-height: 96px;
  resize: none;
  font-size: 1rem;
  font-weight: 400;
}
.input:focus {
  outline: 1px solid var(--clr-moderate-blue);
}

.flex-between {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.inputUserImage {
  height: 32px;
  aspect-ratio: 1/1;
  border-radius: 50%;
}

.btn {
  text-transform: uppercase;
  height: 48px;
  padding-inline: 28px;
  font-size: 1rem;
  font-weight: 400;
  color: var(--clr-white);
  background-color: var(--clr-moderate-blue);
  border: none;
  border-radius: 8px;
  cursor: pointer;

  transition: var(--transition1);
}
.btn:hover {
  background-color: var(--clr-light-grayish-blue);
}

/*
 * #MODAL
 */

.modal-container {
  padding: 16px;
  position: fixed;
  inset: 0;
  place-content: center;
  display: none;
}
.overlay {
  position: fixed;
  inset: 0;
  background-color: hsla(0, 0%, 0%, 0.5);
}
.modal {
  display: grid;
  max-width: 400px;
  width: 100%;
  place-content: center;
  background-color: var(--clr-white);
  border-radius: 8px;
  padding: 32px;
  z-index: 1;
  gap: 16px;
}
.buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
}

.modal-container.active {
  display: grid;
}

.no-cancel {
  flex-grow: 1;
  background-color: var(--clr-text2);
}
.yes-delete {
  flex-grow: 1;
  background-color: var(--clr-soft-red);
}
.no-cancel:hover {
  background-color: var(--clr-text2);
  opacity: 0.6;
}
.yes-delete:hover {
  background-color: var(--clr-pale-red);
}

.modal-header {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--clr-text1);
}
.modal-text {
  font-size: 1rem;
  font-weight: 400;
  color: var(--clr-text2);
}

@media (hover: hover) {
  ::-webkit-scrollbar {
    width: 6px;
  }
  ::-webkit-scrollbar-track {
    background: transparent;
  }
  ::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 3px;
  }
  ::-webkit-scrollbar-thumb:hover {
    background: #555;
  }
}

@media only screen and (min-width: 600px) {
  .comment {
    display: grid;
    grid-template-columns: auto 1fr auto;
    grid-template-rows: auto auto auto;
  }

  .comment-replies-group {
    max-width: 740px;
    margin-inline: auto;
  }
  .main-input-group {
    margin-inline: auto;
    max-width: 740px;
  }

  .vote {
    margin-inline: 6px;
    flex-direction: column;
    width: 40px;
    height: 100px;
    order: 1;
    grid-row: span 3;
  }

  .comment-header {
    order: 2;
  }

  .comment-content {
    order: 4;
    grid-column: 2/-1;
  }

  .comment-tools {
    order: 3;
  }

  .edit-input {
    order: 4;
    grid-column: 2/-1;
  }

  .update {
    order: 5;
    grid-column: 3;
  }

  .replies-thread-line {
    margin-inline: 40px;
    margin-top: 1rem;
  }

  .form {
    align-items: start;
  }
  .input {
    order: 2;
    width: auto;
    flex-grow: 1;
  }
  .inputUserImage {
    order: 1;
  }
  .send-btn {
    order: 3;
  }
}
