
/* Reset some default styles */
*,
*::before,
*::after {
  box-sizing: border-box;
  position: relative;
  margin: 0;
  padding: 0;
  font-family: inherit;
  font-size: inherit;
  color: #87888c;
}

html {
  font-size: 62.5%;

  --dark-background: #171821;
  --dark-element-background: #21222d;
  --dark-primary-color: #87888c;
  --dark-active-background: #a9dfd8;
  --dark-active-color: #000000;
  --border-radius: 10px;
  --switch-active: #4c9141;
  --checkbox-background: #3a3b45;
  --checkbox-border: #5a5b67;
  --checkbox-checked-background: #a9dfd8;
}

html,
body {
  width: 100%;
  height: 100%;
  svg {
    fill: var(--dark-primary-color);
  }
}

body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    Oxygen, Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif;
  font-size: 1.6rem;
  line-height: 140%;

  ::-webkit-scrollbar {
    width: 8px;
  }
  ::-webkit-scrollbar-track {
    box-shadow: inset 0 0 5px grey;
    border-radius: 10px;
  }
  ::-webkit-scrollbar-thumb {
    background: var(--dark-active-background);
    border-radius: 10px;

    &:hover {
      background: var(--dark-active-background);
    }
  }
}

.modal {
  display: none; /* Hidden by default */
  align-items: center;
  justify-content: center;
  position: fixed; /* Stay in place */
  z-index: 1; /* Sit on top */
  left: 0;
  top: 0;
  width: 100%; /* Full width */
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5); /* Black background with opacity */
  overflow: auto;

  .modal-content {
    background-color: var(--dark-element-background);
    color: var(--dark-primary-color);
    padding: 30px;
    border-radius: var(--border-radius);
    width: 450px;
    margin: 50px auto;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    position: relative;
    transition: transform 0.3s ease, box-shadow 0.3s ease;

    &:hover {
      transform: translateY(-10px);
      box-shadow: 0 15px 40px rgba(0, 0, 0, 0.7);
    }

    h2 {
      font-size: 24px;
      color: var(--dark-active-background);
      text-align: center;
      margin-bottom: 20px;
    }

    input,
    textarea,
    select {
      width: 100%;
      padding: 12px;
      margin: 10px 0 20px;
      border: 1px solid var(--dark-primary-color);
      border-radius: var(--border-radius);
      background-color: var(--dark-background);
      color: var(--dark-primary-color);
      box-sizing: border-box;
      transition: box-shadow 0.3s ease, border-color 0.3s ease;

      &:focus {
        outline: none;
        border-color: var(--dark-active-background);
        box-shadow: var(--input-focus-shadow);
      }

      &[type="checkbox"] {
        width: auto;
        margin-left: 10px;
        transform: scale(1.2);
      }
    }

    textarea {
      resize: vertical;
      min-height: 80px;
    }

    button {
      background-color: var(--dark-active-background);
      color: var(--dark-active-color);
      border: none;
      padding: 12px 25px;
      border-radius: var(--border-radius);
      cursor: pointer;
      font-size: 16px;
      width: 100%;
      transition: background-color 0.3s ease, color 0.3s ease;

      &:hover {
        background-color: var(--dark-primary-color);
        color: var(--dark-background);
      }
    }
  }

  .close {
    color: var(--dark-primary-color);
    position: absolute;
    top: 15px;
    right: 15px;
    font-size: 28px;
    cursor: pointer;
    transition: color 0.3s ease;

    &:hover {
      color: var(--dark-active-background);
    }
  }
}

.flex-row {
  display: flex;
  flex-direction: row;
}

/* Container */
.main-container {
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-rows: 1fr;
  height: 100dvh;
}

/* Sidebar styles */
.sidebar {
  border-right: 1px solid var(--dark-primary-color);
  font-size: 1.8rem;
  width: 250px;
  background-color: var(--dark-background);
  display: flex;
  flex-direction: column;
  align-items: center;
  transition: width 0.3s, font-size 0.3s;
  gap: 40px;

  .list-item[inert] {
    opacity: 0.6;
  }

  &.collapsed {
    font-size: 0;
    width: 60px;
    min-width: unset;

    .sidebar-header {
      display: flex;
      align-items: center;
      .toggle-button {
        svg {
          position: absolute;
          margin-right: 0 !important;
          &.sidepanel-hide {
            display: none;
          }
          &.sidepanel-show {
            display: block;
          }
        }
      }
    }

    .sidebar-nav {
      .active {
        background-color: transparent;
        svg {
          fill: var(--dark-active-background);
        }
      }
      .submenu {
        padding-left: 0 !important;
      }
    }
  }

  .sidebar-header {
    width: 100%;
    padding: 20px;
    background-color: var(--dark-background);
    display: flex;
    justify-content: flex-end;

    .toggle-button {
      margin-right: 10px;
      background: none;
      border: none;
      font-size: 24px;
      cursor: pointer;

      svg {
        position: absolute;
        &.sidepanel-show {
          display: none;
        }
      }
    }
  }

  .sidebar-nav {
    .active {
      background: var(--dark-active-background);

      .text {
        color: var(--dark-active-color);
      }

      svg {
        fill: var(--dark-active-color);
      }
    }
    ul {
      list-style: none;
      padding: 0;

      li {
        margin-top: 20px;

        a {
          display: flex;
          align-items: center;
          padding: 7px 10px;
          margin-top: 10px;
          text-decoration: none;
          border-radius: var(--border-radius);
          font-weight: 550;
          transition: background-color 0.3s;

          &:hover:not(:is(.active)) {
            .text {
              color: var(--dark-active-background) !important;
            }
            svg {
              fill: var(--dark-active-background);
            }
          }

          .text:not(:is(.collapsed *)) {
            margin-left: 10px;
          }
        }

        .submenu {
          padding-left: 20px;
        }
      }
    }
  }
}

.content {
  background-color: var(--dark-background);
  padding: 20px;
  height: 100dvh;
  overflow: hidden;
  display: grid;

  .content-header {
    padding: 20px;
    text-align: center;
  }
}

/* Main content styles */
.container {
  padding: 20px;
  background-color: var(--dark-element-background);
  border-radius: 15px;

  * {
    color: #ffffff;
  }
}

.switch {
  position: relative;
  display: inline-block;
  width: 34px;
  height: 21px;

  input {
    opacity: 0;
    width: 0;
    height: 0;

    &:checked + .slider {
      background-color: var(--switch-active);
    }
    &:focus + .slider {
      box-shadow: 0 0 1px var(--dark-active-background);
    }
    &:checked + .slider:before {
      transform: translateX(15px);
    }
  }

  .slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: 0.4s;
    border-radius: 34px;

    &:before {
      position: absolute;
      content: "";
      height: 15px;
      width: 15px;
      left: 2px;
      bottom: 3px;
      background-color: var(--dark-background);
      transition: 0.4s;
      border-radius: 50%;
    }
  }
}


#domains {
  display: flex;
  flex-direction: column;
  gap: 20px;
  height: calc(100dvh - 40px);

  .container:has(#search) {
    overflow: hidden;
    display: flex;
    padding: 0;

    form {
      width: 100%;
    }
    button {
      padding: 10px 15px;
      background-color: var(--dark-active-background);
      color: var(--dark-active-color);
      border: none;
      border-radius: 5px;
      cursor: pointer;
    }
  }

  #search {
    width: 100%;
    height: 100%;
    background: transparent;
    border: unset;
    outline: unset;
    padding: 20px;
  }

  .domain-table {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow-y: auto;
    padding-top: 0;

    .domain {
      border: 1px solid lightgray;
      border-left: unset;
      border-right: unset;

      &.table-header {
        position: sticky;
        z-index: 1;
        top: 0;
        background: var(--dark-element-background);
        border-bottom: 1px solid #6b6a6a;
        margin-bottom: 15px;
        border: unset;
      }

      &:not(.table-header) {
        margin: 8px;
      }

      display: grid;
      grid-auto-flow: column;
      padding: 15px;

      > div {
        display: flex;
        align-items: center;
        gap: 8px;
      }

      .activeColor {
        position: absolute;
        left: 0;
        width: 5px;
        height: 100%;
        border-radius: 100vmax;


      }
      .green {
        color: #4c9141;
        &.activeColor{
          background-color: #4c9141;
        }
      }
      .red {
        &.activeColor{
        background-color: #a82438;
        }
        color: #a82438;
      }

      .domain-name {
        width: 200px;
      }

      input[type="datetime-local"] {
        background: transparent;
        border: 1px solid var(--dark-primery-color);
        border-radius: 10px;
        outline: unset;
        padding: 8px;
      }

      .options {
        position: absolute;
        right: 10px;
        top: 0px;
        bottom: 0px;
        cursor: pointer;

        svg:hover {
          fill: var(--dark-active-background);
        }
      }
    }
  }
}

#product {
  display: flex;
  flex-direction: column;
  gap: 20px;
  height: calc(100dvh - 40px);

  .container:has(#search) {
    padding: 0;
  }

  .product-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
    padding: 20px;

    .product-card {
      display: flex;
      flex-direction: column;
      // align-items: center;
      justify-content: center;
      background-color: var(--dark-background);
      padding: 15px;
      border-radius: 8px;
      box-shadow: 0 0px 4px var(--dark-active-background);
      // text-align: center;
      transition: all 0.2s ease-in-out;
      img {
        max-width: 100%;
        border-radius: 8px;
      }

      h3 {
        margin: 10px 0;
        font-size: 18px;
        color: var(--dark-active-background);
      }

      p {
        color: #777;
        font-size: 14px;
      }

      .price {
        background: var(--dark-background);
        border: unset;
        width: min-content;
        font-size: 16px;
        margin: 10px auto;
      }

      button {
        padding: 5px 5px;
        margin: 5px 0;
        border: none;
        border-radius: 5px;
        cursor: pointer;
        transition: background-color 0.3s;

        &.delete-btn{
          background-color: #d9534f;

          &:hover {
            background-color: #c9302c;
          }
        }
        &.edit-btn {
          background-color: #5bc0de;

          &:hover {
            background-color: #31b0d5;
          }
        }

      }

      &:hover {
        transition: all 0.2s ease-in-out;
        transform: scale(1.1);
        z-index: 1;
      }
    }
  }
}

#settings {
  display: grid;
  grid-template-columns: 1fr 2fr 1fr;
  grid-gap: 20px;
  height: 100%;

  button {
    background-color: var(--dark-active-background);
    color: var(--dark-active-color);
    border: none;
    padding: 12px 25px;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-size: 16px;
    width: 100%;
    transition: background-color 0.3s ease, color 0.3s ease;

    &:hover {
      background-color: var(--dark-primary-color);
      color: var(--dark-background);
    }
  }

  .short-container {
    padding: 20px;
    border-radius: var(--border-radius);
    margin-bottom: 20px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);

    hr {
      margin: 15px;
    }

    h3,
    p {
      color: var(--dark-active-background);
    }

    a {
      text-decoration: none;
      font-size: 15px;
      font-weight: bold;
      color: #fff;
      transition: color 0.3s ease;

      &:hover {
        color: var(--dark-primery-color);
      }
    }

    p {
      font-size: 16px;
      line-height: 1.6;
      margin-top: 10px;
      color: var(--dark-primery-color);
    }

    input,
    textarea,
    select {
      width: 100%;
      padding: 12px;
      margin: 10px 0 20px;
      border: 1px solid var(--dark-primary-color);
      border-radius: var(--border-radius);
      background-color: var(--dark-background);
      color: var(--dark-primary-color);
      box-sizing: border-box;
      transition: box-shadow 0.3s ease, border-color 0.3s ease;
      resize: none;

      &:focus {
        outline: none;
        border-color: var(--dark-active-background);
        box-shadow: var(--input-focus-shadow);
      }

      &[type="checkbox"] {
        width: auto;
        margin-left: 10px;
        transform: scale(1.2);
      }
    }

    .buttonGroup {
      display: flex;
      gap: 10px;
      margin-top: 20px;

      .btn {
        background-color: var(--dark-active-background);
        color: var(--dark-active-color);
        border: none;
        padding: 10px 20px;
        border-radius: 5px;
        cursor: pointer;
        transition: background-color 0.3s;

        &:hover {
          background-color: var(--dark-primery-color);
          color: #000;
        }
      }

      .delete-btn {
        background-color: #d9534f;

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

    }
  }

  .long-container {
    padding: 20px;
    overflow-y: auto;
    grid-column: span 2;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
    grid-auto-rows: max-content;

    .product-card {
      display: flex;
      flex-direction: column;
      // align-items: center;
      justify-content: center;
      background-color: var(--dark-background);
      padding: 15px;
      border-radius: 8px;
      box-shadow: 0 0px 4px var(--dark-active-background);
      // text-align: center;
      transition: all 0.2s ease-in-out;
      img {
        max-width: 100%;
        border-radius: 8px;
      }

      h3 {
        margin: 10px 0;
        font-size: 18px;
        color: var(--dark-active-background);
      }

      p {
        color: #777;
        font-size: 14px;
      }

      .price {
        background: var(--dark-background);
        border: unset;
        width: min-content;
        font-size: 16px;
        margin: 10px auto;
      }

      button {
        padding: 5px 5px;
        margin: 5px 0;
        border: none;
        border-radius: 5px;
        cursor: pointer;
        transition: background-color 0.3s;
        display: none;

        &.delete-btn{
          background-color: #d9534f;

          &:hover {
            background-color: #c9302c;
          }
        }
        &.edit-btn {
          background-color: #5bc0de;

          &:hover {
            background-color: #31b0d5;
          }
        }

      }

      &:hover {
        transition: all 0.2s ease-in-out;
        transform: scale(1.1);
        z-index: 1;
      }
    }
  }
}


.notifications {
  position: fixed;
  bottom: 30px;
  right: 20px;

  :where(.toast, .column) {
    display: flex;
    align-items: center;
  }

  .toast {
    width: 400px;
    position: relative;
    overflow: hidden;
    list-style: none;
    border-radius: 4px;
    padding: 16px 17px;
    margin-bottom: 10px;
    background: var(--light);
    justify-content: space-between;
    animation: show_toast 0.3s ease forwards;

    &::before {
      position: absolute;
      content: "";
      height: 5px;
      width: 100%;
      bottom: 0;
      left: 0;
      animation: progress 5s linear forwards;
    }

    &.success {
      background-color: #4c9141d8;
      &::before {
        background: #2c5826;
      }
    }

    &.error {
      background-color: #d56073;
      &::before {
        background: #db2140;
      }
    }

    &.warning {
      background-color: var(--warning);
      &::before {
        background: var(--warning);
      }
    }

    &.info {
      background-color: var(--info);
      &::before {
        background: var(--info);
      }
    }

    .column {
      font-size: 1.75rem;
      span {
        font-size: 1.5rem;
        font-weight: 700;
        margin-left: 10px;
        color: #ffffff;
      }
    }

    &.hide {
      animation: hide_toast 0.3s ease forwards;
    }
  }
}

@keyframes show_toast {
  0% {
    transform: translateX(100%);
  }
  40% {
    transform: translateX(-5%);
  }
  80% {
    transform: translateX(0%);
  }
  100% {
    transform: translateX(-10%);
  }
}

@keyframes hide_toast {
  0% {
    transform: translateX(-10%);
  }
  40% {
    transform: translateX(0%);
  }
  80% {
    transform: translateX(-5%);
  }
  100% {
    transform: translateX(calc(100% + 20px));
  }
}

@keyframes progress {
  100% {
    width: 0%;
  }
}

@media screen and (max-width: 530px) {
  .notifications {
    width: 80%;
  }

  .notifications .toast {
    width: 100%;
    font-size: 1rem;
    margin-left: 20px;
  }
}

#users {
  display: flex;
  flex-direction: column;
  gap: 20px;
  flex-shrink: 0;
  flex-grow: 0;
  height: calc(100dvh - 40px);

  .container:has(#search) {
    padding: 0;
    flex-shrink: 0;
    flex-grow: 0;
  }

  #search {
    width: 100%;
    height: 100%;
    background: transparent;
    border: unset;
    outline: unset;
    padding: 20px;
  }

  .user-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
    padding: 20px;

    .user-card {
      display: flex;
      flex-direction: column;

      justify-content: center;
      background-color: var(--dark-background);
      padding: 15px;
      border-radius: 8px;
      box-shadow: 0 0px 4px var(--dark-active-background);
      text-align: center;
      transition: all 0.2s ease-in-out;

      img {
        max-width: 100%;
        border-radius: 8px;
      }

      h3 {
        margin: 10px 0;
        font-size: 18px;
        color: var(--dark-active-background);
      }

      input,
    textarea,
    select {
      width: 100%;
      padding: 5px;
      margin: 2px;
      border: unset;
      border-radius: var(--border-radius);
      background-color: var(--dark-background);
      color: var(--dark-primary-color);
      box-sizing: border-box;
      transition: box-shadow 0.3s ease, border-color 0.3s ease;
      resize: none;

      &:focus {
        outline: none;
        border-color: var(--dark-active-background);
        box-shadow: var(--input-focus-shadow);
      }

      &[type="checkbox"] {
        width: auto;
        margin-left: 10px;
        transform: scale(1.2);
      }
    }

      button {
        padding: 5px 5px;
        margin: 5px 0;
        border: none;
        border-radius: 5px;
        cursor: pointer;
        transition: background-color 0.3s;

        &.delete-btn{
          background-color: #d9534f;

          &:hover {
            background-color: #c9302c;
          }
        }
        &.edit-btn {
          background-color: #5bc0de;

          &:hover {
            background-color: #31b0d5;
          }
        }

      }

      &:hover {
        transition: all 0.2s ease-in-out;
        transform: scale(1.1);
        z-index: 1;
      }
    }
  }
}
