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

body {
  background-color: #0b0c10;
  color: #e0e0e0;
  font-family: "Poppins", sans-serif;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.container {
  background-color: #1f2833;
  width: 80vw;

  padding: 20px;
  border-radius: 10px;
  display: grid;
  grid-template-columns: 4fr 3fr;
  justify-content: center;
}

.img {
  display: flex;
  flex-direction: column;
  gap: 30px;
  justify-content: center;
  align-items: center;
}

.img-box {
  display: none;
  position: relative;
}

.img-box #toggleOriginal {
  min-width: 27px;
  min-height: 27px;
  background-color: rgba(0, 0, 0, 0.5);
  position: absolute;
  top: 5px;
  right: 5px;
  padding: 5px;
  color: #fff;
  border: none;
  outline: none;
  border-radius: 5px;
  cursor: pointer;
  display: none;
  transition: 0.3s ease;
}

.img-box:hover #toggleOriginal {
  display: block;
}

.img-box #toggleOriginal:active {
  background-color: rgba(255, 255, 255, 0.3);
}

.img-box {
  touch-action: none; /* لضمان التعامل الصحيح مع الأحداث اللمسية */
}

.img .img-box img,
.img .img-box canvas {
  max-width: 40vw;
  max-height: 60vh;
}

.img .upload input {
  display: none;
}

.upload label {
  color: #0075ff;
  padding: 5px 15px;
  border: 2px #0075ff dashed;
  border-radius: 10px;
  transition: 0.3s ease;
  font-size: 14px;
  box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.2),
    inset 5px 5px 5px rgba(0, 0, 0, 0.2);
}

.upload label:hover {
  cursor: pointer;
  background-color: #0075ff;
  color: #fff;
  box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.2),
    inset 5px 5px 5px rgba(255, 255, 255, 0.3);
}

.filters {
  max-height: calc(100vh - 40px - 40px);
  overflow-y: auto;
  padding-right: 10px;
}

.filters::-webkit-scrollbar {
  width: 10px;
}

.filters::-webkit-scrollbar-track {
  width: 10px;
  border-radius: 5px;
  background-color: #0b0c10;
  box-shadow: inset 5px 5px 5px rgba(100, 100, 100, 0.1);
}

.filters::-webkit-scrollbar-thumb {
  cursor: pointer;
  border-radius: 5px;
  background-color: #1f2833;
  box-shadow: inset 5px 5px 5px rgba(131, 131, 131, 0.1);
}

.filters ul,
.filters ul li {
  display: flex;
  flex-direction: column;
  gap: 15px;
  direction: rtl;
}

.filters ul li {
  gap: 5px;
}

.filters ul li label {
  color: #e0e0e0;
}

.filters ul li .filter-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-direction: row-reverse;
  gap: 5px;

  padding: 5px;
  border-radius: 10px;
  background-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.2), transparent);
  box-shadow: 10px 10px 35px rgba(0, 0, 0, 0.2);
  height: 28px;
}

.filters ul li input[type="range"] {
  flex-grow: 1;
  height: 10px;
  appearance: none;
  background-color: #e0e0e0;
  outline: none;
  border-radius: 15px;
  box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.2),
    inset 5px 5px 5px rgba(0, 0, 0, 0.2);
  overflow: hidden;
}

.filters ul li input[type="range"]::-webkit-slider-thumb {
  appearance: none;
  width: 10px;
  height: 10px;
  background-color: #fff;
  border-radius: 50%;
  border: 3px solid #0075ff;
  box-shadow: 405px 0 0 400px #00a3ff;
  cursor: pointer;
}

.filter-box .reset {
  color: #e0e0e0;
  font-size: 12px;
  padding: 3px;
  border-radius: 5px;
  transition: 0.3s ease;
  display: none;
}

.filter-box .reset:hover {
  background-color: #444;
  cursor: pointer;
}

.filter-box .reset:active {
  background-color: #444;
  transform: scale(0.9);
}

.filter-box span {
  color: #fff;
  font-size: 12px;
  width: 45px;
  text-align: center;
  direction: ltr;

  background-color: #00a3ff;
  border-radius: 25px;
  box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.2),
    inset 5px 5px 5px rgba(0, 0, 0, 0.2),
    inset -5px -5px 5px rgba(255, 255, 255, 0.25);
}

.filters ul li:last-child {
  flex-direction: row;
  justify-content: space-around;
}

.filters ul li button {
  color: #fff;
  padding: 8px 15px;
  background-color: #0075ff;
  border: none;
  outline: none;
  border-radius: 10px;
  transition: 0.3s ease;
  display: none;
  font-size: 14px;
  box-shadow: 5px 5px 15px rgba(0, 0, 0, 0.2), -5px -5px 10px rgba(0, 0, 0, 0.2),
    inset 3px 3px 5px rgba(255, 255, 255, 0.3);
}

.filters ul li button:hover {
  cursor: pointer;
  opacity: 0.9;
  transform: translateY(-3px);
}

.filters ul li button:active {
  transform: translateY(0);
  box-shadow: inset 3px 3px 5px rgba(0, 0, 0, 0.3);
}

@media screen and (max-width: 650px) {
  .container {
    display: flex;
    flex-direction: column;
    gap: 20px;
    height: calc(100vh - 40px);
  }

  .img {
    gap: 10px;
    flex: 1; /* اجعل قسم الصورة يأخذ المساحة المتاحة */
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
  }

  .img .img-box img,
  .img .img-box canvas {
    max-width: 70vw;
  }

  .upload label:hover {
    cursor: context-menu;
    background-color: transparent;
    color: #0075ff;
    box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.2),
      inset 5px 5px 5px rgba(0, 0, 0, 0.2);
  }

  .filters {
    padding-right: 5px;
  }

  .filters::-webkit-scrollbar {
    width: 5px;
  }

  .filters::-webkit-scrollbar-track {
    width: 5px;
    border-radius: 5px;
    background-color: #0b0c10;
    box-shadow: inset 5px 5px 5px rgba(100, 100, 100, 0.1);
  }

  .filters::-webkit-scrollbar-thumb {
    cursor: pointer;
    border-radius: 5px;
    background-color: #1f2833;
    box-shadow: inset 5px 5px 5px rgba(131, 131, 131, 0.1);
  }

  .filters ul li input[type="range"]::-webkit-slider-thumb {
    cursor: context-menu;
  }

  .filters ul li label {
    font-size: 14px;
  }

  .filters ul li button:hover {
    cursor: context-menu;
    opacity: 1;
    transform: translateY(0);
  }

  .filters ul li button:active {
    opacity: 0.8;
  }

  .filter-box .reset:hover {
    background-color: transparent;
    cursor: context-menu;
  }

  .filter-box .reset:active {
    background-color: #444;
  }
}
