:root {
  --white: #f6f6f6;
  --white-hover: #f3f3f3;
  --black: #001514;
  --green: #007a04;
  --green-hover: #005a03;
  --blue: #1b5299;
  --blue-hover: #163f75;
  --red: #d11e17;
  --red-hover: #b01914;
  --yellow: #fffd82;
  --gray: #6e6e6e;
  --light-blue: #2361f1;
  --light-blue-hover: #1f55d3;
  --disabled: #e0e0e0;
}

@font-face {
  font-family: "Ubuntu";
  src: url(fonts/Ubuntu-Regular.woff2) format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Ubuntu";
  src: url(fonts/Ubuntu-Bold.woff2) format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

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

:where(ul, ol):where([class]) {
  padding-left: 0;
}

:where(h1, h2, h3, h4, h5, h6, p, ul, ol, dl):where([class]) {
  margin-block: 0;
}

ul {
  list-style: none;
}

img {
  display: block;
  max-width: 100%;
  height: auto;
}

/* Наследование шрифтов */
input,
textarea,
select,
button {
  font: inherit;
}

html {
  font-size: 16px;
  height: 100%;
  scroll-behavior: smooth;
}

body {
  font-family: "Ubuntu";
  font-weight: 400;
  height: 100vh;
  display: grid;
  justify-items: center;
  align-content: center;
  background-color: var(--white);
}

.loader {
  position: fixed;
  inset: 0;
  display: grid;
  justify-items: center;
  align-content: center;
  z-index: auto;
  background-color: var(--white);
  animation: load 1s ease-in-out 2.4s forwards;
}

.loader__content {
  display: flex;
  justify-content: center;
  align-items: end;
  gap: 50px;
}

.loader__title {
  text-align: center;
  font-size: 3rem;
  font-weight: 700;
  color: var(--black);
}

.loader__points {
  display: flex;
  column-gap: 30px;
  flex-wrap: nowrap;
}

.loader__point {
  width: 25px;
  height: 25px;
  border: 1px solid var(--black);
  background-color: var(--blue);
  border-radius: 50%;
  animation: moveCircles 2.1s ease-in-out infinite;

  &.loader__point--first {
    animation-delay: 0.3s;
  }
  &.loader__point--second {
    animation-delay: 0.6s;
  }
  &.loader__point--third {
    animation-delay: 0.9s;
  }
}

/* Анимация движения точек (кружков загрузки) */
@keyframes moveCircles {
  0% {
    transform: translateY(0);
  }
  25% {
    transform: translateY(-70px);
  }
  75% {
    transform: translateY(0);
  }
  100% {
    transform: translateY(0);
  }
}

/* Закрытие loader-а */
@keyframes load {
  from {
    transform: rotateY(360deg);
    opacity: 1;
  }
  to {
    opacity: 0.5;
    transform: rotateY(270deg);
  }
}

.notes {
  padding: 60px;
  background-color: white;
  border-radius: 10px;
  width: 80vw;
  max-height: min-content;
  box-shadow: rgba(99, 99, 99, 0.2) 0px 2px 8px 0px;
}

.notes .notes__header {
  text-align: center;
  margin-bottom: 20px;
}

.input__toolbar {
  display: grid;
  gap: 30px;
  grid-template-columns: 3fr 1.5fr;
  justify-items: baseline;
  margin-bottom: 30px;
}

.notes__input {
  width: 100%;
  font-size: 1.3125rem;
  font-weight: 400;
  color: var(--black);
  background-color: white;
  border-radius: 6px;
  padding: 10px;

  &:focus {
    outline: 0;
    border: 2px solid var(--blue);
    box-shadow: rgba(100, 100, 111, 0.2) 0px 7px 29px 0px;
  }
  &.notes__input--edit {
    margin-bottom: 0;
  }
  &#search-note {
    background-image: url(images/loupe.png);
    background-position: 10px 50%;
    background-repeat: no-repeat;
  }
}

.notes__list {
  display: flex;
  flex-direction: column;
  row-gap: 5px;
}

.notes__item {
  box-sizing: border-box;
  border: 2px solid var(--gray);
  padding: 10px 15px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.notes__text {
  flex-grow: 1;
  font-size: 1.5rem;
  line-height: 1.25;
  max-width: 100%;
  overflow-wrap: break-word;
}

button[class^="btn"] {
  border: 0;
  box-shadow: rgba(0, 0, 0, 0.2) 2px 2px 4px;
}

.btn:where(.btn--add, .btn--update, .btn--delete, .btn--save, .btn--cancel) {
  font-size: 1.25rem;
  font-weight: 700;
  border-radius: 5px;
  padding: 10px;
  color: var(--white);
}

.btn__toolbar {
  display: flex;
  gap: 5px 15px;
  flex-wrap: wrap;
}

.btn--add {
  padding: 10px 25px;
  background-color: var(--blue);
  &:hover {
    background-color: var(--blue-hover);
  }
}
.btn--update {
  background-color: var(--green);
  &:where(:hover, :focus-visible, :active) {
    background-color: var(--green-hover);
  }
}
.btn--delete {
  background-color: var(--red);
  &:where(:hover, :focus-visible, :active) {
    background-color: var(--red-hover);
  }
}
.btn--cancel {
  background-color: transparent;
  border: 2px solid var(--gray) !important;
  color: var(--gray);
  &:where(:hover, :focus-visible, :active) {
    background-color: var(--white-hover);
  }
}
.btn--save {
  background-color: var(--light-blue);
  &:where(:hover, :focus-visible, :active) {
    background-color: var(--light-blue-hover);
  }
}

.alert {
  position: fixed;
  top: 20px;
  right: 20px;
  padding: 16 20px;
  min-width: 200px;
  max-width: 320px;
  min-height: 100px;
  max-height: min-content;
  align-content: center;
  text-align: center;
  border-radius: 8px;
  box-shadow: 0 8px 32px rgba(255, 107, 107, 0.3);
  border: 10px solid inherit;
  background: linear-gradient(
    90deg,
    rgba(209, 36, 36, 1) 0%,
    rgba(204, 137, 22, 1) 65%
  );
  color: var(--white);
  font-size: 1.1rem;
  font-weight: 700;
  z-index: 1000;
  animation: lifeCycle 3.5s ease-in-out forwards;
}

/* Анимация появления и исчезновения alert */
@keyframes lifeCycle {
  0% {
    opacity: 0;
  }
  20% {
    opacity: 1;
  }
  80% {
    opacity: 1;
  }
  100% {
    opacity: 0;
  }
}

/* Стили для пагинации */

.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  column-gap: 15px;
  margin-top: 20px;
  font-size: 1.3rem;
}

.pagination__btn {
  box-sizing: border-box;
  border: 1px solid var(--black);
  border-radius: 4px;
  padding: 6px 10px;
  color: var(--white);
  background-color: var(--light-blue);
  font-size: 1.5rem;
  font-weight: 700;

  &:hover {
    background-color: var(--light-blue-hover);
  }

  &:disabled {
    color: var(--gray);
    background-color: var(--disabled);
    cursor: not-allowed;
  }
}

:where(.pagination__current, .pagination__total) {
  font-weight: 700;
}

/*
 * Медиа-запросы (добавить + поправить)
*/
@media screen and (width <= 1024px) {
  html {
    font-size: 15px;
  }

  .input__toolbar {
    justify-items: stretch;
  }

  .btn--add {
    grid-row: 1 / 2;
    grid-column: 2 / 3;
  }
}

@media screen and (width <= 768px) {
  .notes {
    padding: 20px 10px;
    width: 90vw;
  }
  .input__toolbar {
    gap: 15px;
  }
}

@media screen and (width <= 550px) {
  html {
    font-size: 14px;
  }

  .input__toolbar,
  .notes__header {
    margin-bottom: 12px !important;
  }

  .loader__content {
    gap: 20px;
  }

  .loader__points {
    gap: 10px;
  }

  .notes__item {
    padding: 8px;
    gap: 5px;
  }

  .notes__text {
    font-size: 1.2rem;
    line-height: 1.1;
  }

  .btn:where(.btn--update, .btn--delete, .btn--save, .btn--cancel) {
    font-size: 1.1rem;
    padding: 8px;
  }

  .notes__input {
    padding: 7px;
    font-size: 1rem;
  }

  .pagination__btn {
    padding: 3px 5px;
  }

  .btn.btn--add {
    font-size: 1rem;
    padding: 5px;
  }
}

