* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --color-text-primary: hsla(0, 0%, 21%, 1);
  --color-text-secondary: hsla(0, 0%, 21%, 0.75);

  --color-secondary: hsla(246, 74%, 66%, 1);
  --color-secondary-invert: hsla(0, 0%, 100%, 1);
  --color-secondary-darker: hsla(246, 74%, 60%, 1);
  --color-primary: rgb(4, 17, 135);

  --color-active-tabs-color: rgb(135, 216, 112);
  --color-active-groups-background: rgba(51, 122, 215, 0.69);
  --color-loader-border: rgb(243, 243, 243);
  --color-loader-border-top: rgb(52, 152, 219);
  --color-list-border: rgba(0, 0, 0, 0.2);
  --color-white: rgb(255, 255, 255);
  --color-not-verified: rgb(255, 0, 0);

  --color-group-loading-background: hsla(218, 100%, 98%, 1);
  --color-group-loading-primary: rgb(227, 232, 239);

  --color-group-background: var(--color-white);
  --color-group-count: var(--color-text-secondary);
  --color-group-btn-background: var(--color-secondary);
  --color-group-btn-text: var(--color-secondary-invert);
  --color-group-btn-hover: var(--color-secondary-darker);
}

input:focus,
button:focus,
textarea:focus {
  outline: none;
}

textarea {
  resize: none;
}

.button {
  border: none;
  border-radius: 8px;
  padding: 6px 20px;
  background: var(--color-group-btn-background);
  color: var(--color-group-btn-text);
  font-weight: 600;
  font-size: 0.8rem;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
}

.button:hover {
  background: var(--color-group-btn-hover);
}

.button--secondary {
  background: var(--color-secondary-invert);
  color: var(--color-secondary);
  border: 1px solid var(--color-secondary);
}

.button--secondary:hover {
  background: var(--color-secondary);
  color: var(--color-secondary-invert);
}

.button--minimal {
  background: transparent;
  color: var(--color-secondary);
  border: none;
}

.button--minimal:hover {
  background: transparent;
  color: var(--color-secondary-invert);
}

.button--blocked {
  opacity: 0.5;
  cursor: not-allowed;
}

.button__icon {
  margin-left: 6px;
  height: 1.2em;
  color: inherit;
}

body {
  font-family: 'Inter', sans-serif;
  font-optical-sizing: auto;
  font-style: normal;
  font-variation-settings: 'slnt' 0;
  display: flex;
  justify-content: center;
  align-items: center;
  flex-direction: column;
}

.container {
  flex-grow: 1;
  width: clamp(300px, 100%, 1000px);
  padding: 20px;
  color: var(--color-text-primary);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.backdrop {
  width: 100%;
  height: 100%;
  position: fixed;
  background-color: rgba(0, 0, 0, 0.3);
  top: 0;
  display: grid;
  place-items: center;
}

.group-header {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
}

@media screen and (max-width: 400px) {
  .group-header {
    gap: 0.8rem;
  }
}

.spacer {
  flex-grow: 1;
}

/*
    FOR Group Creation Modal
*/

.group-creation-modal {
  height: 450px;
  width: clamp(300px, 100%, 350px);
  background-color: var(--color-white);
  border-radius: 8px;
  display: flex;
  flex-direction: column;

  #close-button {
    align-self: flex-end;
    padding: 0.2rem;
    margin: 0.2rem 0.2rem 0 0;
    cursor: pointer;
  }

  .header {
    margin: 0 2rem 1rem 2rem;
    align-self: center;
    font-size: 1.25rem;
    font-weight: 600;
    line-height: 30px;
    text-align: left;
  }

  .disclaimer {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin: 0 2rem 1rem 2rem;
    padding: 0.6rem;
    border-radius: 4px;
    background: hsla(0, 84%, 95%, 1);
    font-size: 0.7rem;
    color: hsla(0, 74%, 45%, 1);
  }

  .form {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    margin: 1rem 2rem 2rem 2rem;
    gap: 1rem;

    .input {
      display: flex;
      align-items: center;
      gap: 8px;
      flex-grow: 1;

      .input__label {
        font-size: 0.9rem;
        color: hsla(220, 9%, 46%, 1);
      }

      .input__container {
        display: flex;
        justify-content: center;
        align-items: center;
        background: rgb(245, 246, 246);
        border-radius: 8px;
        flex-grow: 1;
      }

      .input__field {
        padding: 0.7rem;
        box-sizing: border-box;
        flex-grow: 1;
        border: none;
        background-color: transparent;
      }

      .input__field::placeholder {
        font-size: 14px;
        font-weight: 400;
        line-height: 17.5px;
        text-align: left;
        color: hsla(220, 9%, 46%, 0.5);
      }

      #clear-input {
        padding: 0.7rem 1rem;
        border: none;
        display: grid;
        place-content: center;
        background-color: transparent;

        img {
          height: 1.1rem;
        }
      }
    }

    #description {
      flex-direction: column;
      align-items: flex-start;
      gap: 0px;

      .input__container {
        width: 100%;
      }

      .input__label {
        color: rgb(90, 96, 107);
      }

      .input__field {
        height: 100px;
      }
    }

    .submit__button {
      padding: 12px;
      font-size: 0.9rem;
      font-weight: 500;
      line-height: 21px;
      border-radius: 8px;
      background: hsla(221, 79%, 48%, 1);
      text-align: center;
      display: table-cell;
      vertical-align: middle;
    }

    .submit__button--disabled {
      background: hsla(221, 79%, 48%, 0.5);
      cursor: not-allowed;
    }
  }
}

/* 
    FOR Serach
*/
.search {
  grid-column-start: 2;
  grid-column-end: 4;
  border: 1px solid hsla(0, 0%, 53%, 1);
  width: 100%;
  display: flex;
  align-items: center;
  border-radius: 30px;
  padding: 12px 16px;
  cursor: text;
}

.search__icon {
  height: 1.1rem;
}

.search__input {
  border: none;
  margin-left: 0.3rem;
}

.search__input::placeholder {
  color: hsla(0, 0%, 63%, 1);
}

.search__input:focus {
  outline: none;
}

/* 
    FOR Create Group
*/

.create-group {
  grid-column-start: 4;
  display: flex;
  justify-content: end;
  align-items: center;
}

.create-group .button {
  padding: 0.7rem 1.4rem;
  border-radius: 8px;
  height: 35px;
  font-size: 0.8rem;
  gap: 0.3rem;

  .button__icon {
    height: 0.9em;
  }
}

/*
    FOR Group
*/

.group-container {
  grid-column-start: 1;
  grid-column-end: 6;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 0.8rem;
  margin-top: 40px;
}

.card {
  margin-inline: auto;
  background: var(--color-group-background);
  padding: 20px;
  border-radius: 15px;
  border: 1px solid hsla(0, 0%, 92%, 1);
  box-shadow: 1px 2px 4px 0px hsla(0, 0%, 0%, 0.1);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  width: 100%;
}

.card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.delete-group {
  background-color: transparent;
  border: none;
  padding: 0;
  cursor: pointer;
}

.delete-group__icon {
  height: 1.2em;
  opacity: 0.5;
  transition: transform 0.2s ease-in-out, opacity 0.2s ease-in-out,
    scale 0.2s ease-in-out;
}

.delete-group:hover .delete-group__icon {
  transform: rotate(10deg);
  opacity: 1;
  scale: 1.2;
}

.card__title {
  font-size: 1.1rem;
  font-weight: 600;
}

.card__description {
  margin-top: 0.6rem;
  color: var(--color-text-secondary);
  font-weight: 400;
  font-size: 0.8rem;
  line-height: 18px;
}

.card__action {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 1.5rem;
}

.card__count {
  color: var(--color-group-count);
  font-size: 0.9rem;
  display: flex;
  align-items: center;
}

.card__count-text {
  font-size: 0.8em;
}

.card__count-icon {
  margin-left: 0.5rem;
  padding-bottom: 0.5px;
  height: 1.2em;
}

.card--loading {
  background: var(--color-group-loading-background);
}

.card--loading .card__title {
  background: var(--color-group-loading-primary);
  height: 1.2rem;
  border-radius: 4px;
}

.card--loading .card__description {
  background: var(--color-group-loading-primary);
  height: 4rem;
  border-radius: 4px;
}

.card--loading .card__btn {
  background-color: var(--color-group-loading-primary);
  height: 0.9rem;
  width: 3rem;
}

.no-group-container {
  grid-column-start: 1;
  grid-column-end: 6;
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
}

.no-group {
  display: flex;
  align-items: flex-start;
  max-width: 400px;
  width: 100%;
  padding: 1.5rem;
  background-color: var(--color-secondary-invert);
  border-left: 4px solid var(--color-secondary);
  border-radius: 4px;
  box-shadow: 0 2px 4px var(--color-list-border);

  .icon {
    flex-shrink: 0;
    margin-right: 1rem;
    width: 24px;
    height: 24px;
    color: var(--color-secondary);
  }

  .message {
    flex-grow: 1;
  }

  .message h2 {
    margin: 0 0 0.5rem 0;
    font-size: 1.25rem;
    color: var(--color-secondary);
  }

  .message p {
    margin: 0;
    font-size: 1rem;
    color: var(--color-secondary);
  }
}

/*
    FOR Navbar
*/

.navbar {
  flex-shrink: 0;
  width: 100%;
  height: 60px;
  padding: 0 20px;
  background-color: var(--color-primary);
  display: flex;
  justify-content: center;
  position: sticky;
  top: 0;
}

.navbar__container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: clamp(350px, 100%, 1000px);
  height: 100%;
}

.back {
  background-color: transparent;
  border: none;
  padding: 10px;
  text-decoration: none;
  display: flex;
  align-items: center;
}

.back__icon {
  height: 1.2rem;
}

.profile {
  display: flex;
  align-items: center;
}

.profile--loading {
  height: 2rem;
  width: 6rem;
  background-color: var(--color-group-loading-primary);
  border-radius: 10px;
}

.profile__name {
  color: white;
  font-weight: 400;
  font-size: 0.8rem;
}

.profile__avatar {
  margin-left: 0.5rem;
  height: 2rem;
  width: 2rem;
  border-radius: 50%;
  margin-right: 10px;
}

.signin {
  width: fit-content;
  padding: 5px;
  background-color: transparent;
  color: white;
  cursor: pointer;
  border: 2px solid white;
  border-radius: 6px;
  text-decoration: none;
  font-size: 0.8rem;
}

.signin__img {
  height: 15px;
  width: 15px;
  position: relative;
  top: 1px;
}

/*
    FOR Message toaster box
*/

.toast {
  position: fixed;
  top: 20px;
  right: 20px;
  width: 300px;
}

.toast__message {
  padding: 15px;
  background-color: #4caf50;
  color: white;
  border-radius: 5px;
  margin-bottom: 10px;
  display: none;
}

.toast--show {
  display: block;
  animation: slideInFromRight 3s forwards;
}

@keyframes slideInFromRight {
  0% {
    transform: translateX(100%);
    opacity: 1;
  }

  30% {
    transform: translateX(0);
    opacity: 1;
  }

  70% {
    transform: translateX(0);
    opacity: 1;
  }

  100% {
    transform: translateX(0) translateY(-100%);
    opacity: 0;
  }
}

@media screen and (max-width: 768px) {
  .search {
    grid-column-start: 1;
    grid-column-end: 4;
    border-radius: 10px;
  }

  .create-group .button {
    border-radius: 10px;
    padding: 4px 10px;
    height: 100%;
    gap: 0;
  }
}

/*
For Delete Confirmation Modal
*/

.delete-confirmation-modal {
  background-color: var(--color-white);
  border-radius: 8px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  max-width: 400px;
  width: 90%;
  padding: 24px;
  position: relative;
}

.delete-modal__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.delete-modal__title {
  font-size: 24px;
  font-weight: bold;
  color: #333;
  margin: 0;
}

.delete-modal__close {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.8rem 1rem;
  margin: -1rem -0.8rem 0.8rem 0.4rem;
}

.delete-modal__content {
  margin-bottom: 24px;
}

.delete-modal__msg {
  font-size: 16px;
  color: #666;
  line-height: 1.5;
}

.delete-modal__buttons {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

.delete-modal-button {
  padding: 10px 20px;
  border-radius: 4px;
  font-size: 16px;
  font-weight: bold;
  cursor: pointer;
  transition: background-color 0.3s ease;
}

.button--secondary:hover {
  background-color: var(--color-group-btn-background);
}

.button--danger {
  background-color: #dc3545;
  color: #fff;
  border: none;
}

.button--danger:hover {
  background-color: #c82333;
}

/*
For Spin Loader
*/

.loader {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(255, 255, 255, 0.8);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 1000;
}

.loader-spin {
  border: 8px solid #f3f3f3;
  border-top: 8px solid #345bdb;
  border-radius: 50%;
  width: 50px;
  height: 50px;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}
