:root {
  --border-color: rgb(118, 118, 118);
  --ast-global-color-1: #045cb4;
  --bg-color: #f0f2f5;
  --toggle-bg: #dfe6e9;
  --toggle-active: #3498db;
  --text-active: #ffffff;
  --text-inactive: #636e72;
}

.hidden {
  display: none !important;
}

.modal {
  display: block;
  position: fixed;
  z-index: 9999;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  display: flex;
  justify-content: center;
  align-items: center;
}

.modal-container {
  background-color: #fff;
  margin: auto;
  padding: 10px 0;
  width: 30%;
  border-radius: 8px;
  position: relative;
}

.modal-container p {
  margin: 0;
}

.modal-header {
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  line-height: 1rem;
  padding-inline: 20px;
  margin-block: 10px;
  min-height: 1.5rem;
}

.modal-header p,
.agq-header-container p,
.agq-footer-container p {
  color: black;
}

hr {
  background-color: #ccc;
  border: 0;
  height: 1px;
  margin-bottom: 1em;
}

.modal-content {
  display: flex;
  flex-direction: column;
  gap: 15px;
  padding-inline: 20px;
  overflow-y: auto;
  max-height: 33rem;
}

.close,
.close-modal {
  float: right;
  cursor: pointer;
  font-size: 28px;
}

.checkbox-group-container {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.checkbox-container {
  display: flex;
  align-items: center; /* Menjaga label dan box tetap sejajar horizontal */
  gap: 10px; /* Jarak antara box dan teks */
  cursor: pointer;
}

.checkbox-container input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
  border-color: var(--border-color);
}

.checkbox-container input[type="checkbox"]:checked + .label-text {
  color: var(--primary-blue);
  font-weight: 500;
}

.label-text {
  font-size: 16px;
  color: var(--text-dark);
  transition: color 0.3s ease;
}

.range-container {
  display: flex;
  align-items: center; /* Sejajar vertikal */
  gap: 15px; /* Jarak antara tulisan "Range" dan input */
  font-family: "Segoe UI", sans-serif;
  background: #fff;
  border-radius: 8px;
}

.range-container p {
  margin: 0;
  font-weight: 500;
  flex: 2;
  color: var(--text-dark);
  white-space: nowrap;
}

.range-wrapper {
  display: flex;
  flex-grow: 1;
  flex: 5;
  align-items: center;
  border-radius: 6px;
  padding: 2px 8px;
  transition: border-color 0.3s ease;
}

.range-wrapper input,
.range-wrapper textarea {
  width: 80px;
  padding: 8px;
  font-size: 14px;
  text-align: center;
  color: var(--text-dark);
  background: transparent;
  border-color: var(--border-color);
}

.variant-name-wrapper input,
.range-wrapper textarea {
  width: 100%;
  text-align: left;
}

.range-wrapper input:focus,
.range-wrapper textarea:focus {
  border-color: #046bd2;
  box-shadow: none;
  outline: none;
  color: var(--text-dark);
  border-style: solid;
}

.separator {
  color: #999;
  font-weight: bold;
  padding: 0 5px;
}

/* Menghilangkan panah up/down pada input number agar lebih bersih */
input::-webkit-outer-spin-button,
input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.error {
  color: red;
  font-size: 14px;
}

.button-container {
  display: flex;
  flex-direction: row;
  justify-content: center;
  gap: 30px;
  padding-bottom: 5px;
}

.button-container button {
  padding: 10px 20px;
  border: none;
  cursor: pointer;
  width: 100px;
}

.button-container button:first-child {
  background-color: transparent;
  border: 1px solid #ccc;
  color: black;
}

.button-container button:first-child:hover {
  background-color: #f0eeee;
  border-color: #f0eeee;
}

.button-container button:last-child:hover {
  background-color: #0158af;
  border-color: #0158af;
  color: white;
}

.upload-question-wrapper {
  display: flex;
  flex-direction: row;
  gap: 7px;
  align-items: center;
}

.custom-file-upload {
  display: flex;
  align-items: center;
  cursor: pointer;
  gap: 10px;
}

/* Sembunyikan input file asli */
#file-input-question {
  display: none;
}

/* Kotak checkbox buatan */
.checkbox-box {
  width: 18px;
  height: 18px;
  border: 1px solid var(--border-color);
  border-radius: 2px;
  position: relative;
  transition: background 0.3s;
  cursor: pointer;
}

/* Efek 'Check' saat file terpilih (akan diatur via JS) */
.custom-file-upload.has-file .checkbox-box {
  background-color: #046bd2;
  border-color: #046bd2;
}

.custom-file-upload.no-has-file .checkbox-box {
  border-color: var(--border-color);
}

.custom-file-upload.has-file .checkbox-box::after,
.custom-file-upload.no-has-file .checkbox-box::after {
  color: white;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 14px;
}

.custom-file-upload.has-file .checkbox-box::after {
  content: "✔";
}

.custom-file-upload.no-has-file .checkbox-box::after {
  content: "";
}

.file-instruction {
  margin-top: 10px !important;
  font-size: 11px;
  color: #777;
  border-left: 2px solid #ddd;
  padding-left: 10px;
}

.file-instruction strong {
  color: #333;
}

.upload-question-container .error {
  margin-top: 5px;
}

/* Badge Count Styling */
.custom-question-badge-count {
  background-color: #4caf50;
  color: white;
  font-size: 0.75rem;
  font-weight: bold;
  padding: 2px 8px;
  border-radius: 12px;
  margin-left: 8px;
  display: none; /* Sembunyi jika tidak ada soal */
}

/* Munculkan jika ada teks di dalamnya */
.custom-question-badge-count:not(:empty) {
  display: inline-block;
}

.link-view-custom-question {
  color: #2196f3;
  text-decoration: none;
  font-size: 12px;
  margin-left: 5px;
  font-weight: normal;
}

.link-view-custom-question:hover {
  text-decoration: underline;
  color: #0b7dda;
  cursor: pointer;
}

.link-edit-question {
  font-size: 14px;
}

.link-delete-question {
  color: red;
  font-size: 14px;
}

.link-delete-question:hover {
  color: rgb(182, 1, 1);
}

.preview-modal-container {
  background-color: white;
  width: 70%;
  padding: 20px 0;
  top: 20px;
}

.preview-modal-container .modal-content {
  overflow-y: auto;
  max-height: 60vh;
}

.preview-modal-container .range-container {
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
}

.preview-modal-container .range-wrapper {
  padding: 0;
  width: 100%;
  flex-direction: column;
  align-items: flex-start;
}

.preview-modal-container .range-wrapper .error {
  color: red;
  padding-top: 2px;
  padding-left: 5px;
}

.range-wrapper.error input,
.range-wrapper.error textarea {
  border-color: red;
}

.preview-col-no {
  width: 10px;
}

.edit-question-image-container {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.edit-image-question-container {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: center;
  border: 2px dashed #ccc;
  border-radius: 8px;
  padding: 20px;
  cursor: pointer;
  min-height: 100px;
  background-color: #fafafa;
  transition: all 0.3s;
}

.edit-image-question-container:hover {
  border-color: #046bd2;
  background-color: #f8f9fa;
}

.preview-image-wrapper {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  width: 50%;
}

.preview-remove-image {
  position: absolute;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  top: 10px;
  right: 10px;
  z-index: 10;
  background: #ff4d4d;
  color: white;
  border: none;
  border-radius: 50%;
  padding: 0;
  width: 25px;
  height: 25px;
  line-height: unset;
  cursor: pointer;
  font-weight: bold;
}

.edit-action-container {
  display: flex;
  flex-direction: row;
  gap: 5px;
  align-items: center;
}

.preview-modal-container .separator {
  color: black;
  font-weight: normal;
}

.add-new-question-container {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  margin-bottom: 10px;
  margin-right: 20px;
}

.agq-dashboard-btn {
  padding: 10px 15px;
  background: #0073aa;
  color: white;
}

.agq-dashboard-btn:hover {
  padding: 10px 15px;
  background: var(--ast-global-color-1);
  border-color: var(--ast-global-color-1);
  color: white;
}

.agq-dashboard-btn::before {
  content: "\f543";
  font-family: dashicons;
  font-weight: 400;
  font-style: normal;
  text-transform: none;
  text-rendering: auto;
  -webkit-font-smoothing: antialiased;
  text-align: center;
}

/* Container Utama */
#progress-container {
  display: none;
  margin-top: 15px;
  width: 100%;
  background-color: #e9ecef;
  border-radius: 10px;
  overflow: hidden; /* Agar bar tidak keluar dari radius */
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* Progress Bar */
#progress-bar {
  width: 0%;
  height: 12px;
  background-color: #28a745;
  background-image: linear-gradient(
    45deg,
    rgba(255, 255, 255, 0.15) 25%,
    transparent 25%,
    transparent 50%,
    rgba(255, 255, 255, 0.15) 50%,
    rgba(255, 255, 255, 0.15) 75%,
    transparent 75%,
    transparent
  );
  background-size: 1rem 1rem;
  border-radius: 10px;
  transition: width 0.3s ease;
  animation:
    progress-bar-stripes 1s linear infinite,
    pulse 2s infinite;
}

.spinner {
  width: 30px;
  height: 30px;
  border: 4px solid #f3f3f3;
  border-top: 4px solid #ff4d4d; /* Warna merah untuk indikasi hapus */
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

.delete-image-overlay {
  display: flex;
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(255, 255, 255, 0.8);
  z-index: 20;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
}

.delete-image-text {
  color: #ff4d4d;
  font-weight: bold;
  margin-top: 10px;
}

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

/* Animasi Garis Berjalan */
@keyframes progress-bar-stripes {
  from {
    background-position: 1rem 0;
  }
  to {
    background-position: 0 0;
  }
}

/* Animasi Berdenyut */
@keyframes pulse {
  0% {
    opacity: 1;
  }
  50% {
    opacity: 0.7;
  }
  100% {
    opacity: 1;
  }
}

#progress-text {
  display: block;
  margin-top: 5px;
  font-size: 12px;
  font-weight: bold;
  color: #555;
  text-align: center;
}

.col-image {
  width: 20%;
}

.custom-preview-table td {
  vertical-align: top; /* Mengatur teks ke atas */
  text-align: left; /* Mengatur teks ke kiri */
  padding: 10px; /* Opsional: memberi ruang agar tidak menempel border */
}

.edit-question-image-container.has-images {
  align-items: flex-start;
}

.edit-custom-questions-image-wrapper {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  width: 100%;
  min-height: 150px;
}

.edit-custom-questions-image-wrapper img {
  width: 300px;
  height: 150px;
  object-fit: fill;
  cursor: pointer;
  border-radius: 8px;
}

/* Container Toggle */
.lang-switch {
  position: relative;
  display: flex;
  width: 170px;
  height: 33px;
  background-color: var(--toggle-bg);
  border-radius: 25px;
  padding: 4px;
  cursor: pointer;
  user-select: none;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Sembunyikan Checkbox Asli */
.lang-switch input {
  display: none;
}

/* Label Teks */
.lang-label {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1;
  font-weight: bold;
  font-size: 14px;
  color: var(--text-inactive);
  transition: color 0.3s ease;
}

/* Tombol Geser (Slider) */
.slider {
  position: absolute;
  top: 4px;
  left: 4px;
  width: calc(50% - 4px);
  height: calc(100% - 8px);
  background-color: var(--toggle-active);
  border-radius: 20px;
  transition: transform 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
  box-shadow: 0 2px 10px rgba(52, 152, 219, 0.4);
}

/* Logika Perpindahan */
/* Jika checkbox dicentang (English terpilih) */
.lang-switch input:checked ~ .slider {
  transform: translateX(100%);
}

/* Ubah warna teks saat aktif */
.lang-switch input:not(:checked) ~ .label-id {
  color: var(--text-active);
}
.lang-switch input:checked ~ .label-en {
  color: var(--text-active);
}

@media (max-width: 480px) {
  .modal-container {
    width: 100%;
    height: 100%;
    top: 6%;
    border-radius: 0;
  }
  .modal-content {
    max-height: 83vh;
  }
  .range-container {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
  .range-wrapper {
    width: 100%;
    justify-content: space-between;
    padding: 0;
  }
  .range-wrapper input {
    flex: 1;
  }
}

/* Styling for Tablet (iPad Air, iPad Mini, Pro 11-inch) */
@media only screen and (min-width: 768px) and (max-width: 1024px) {
  .modal {
    display: block;
  }

  .modal-container {
    width: 50%;
    top: 10%;
  }

  .preview-modal-container {
    width: 90%;
  }
}
