.qrscan-permohonan {
  max-width: 720px;
  margin: 0 auto;
  padding: 8px;
}
.permohonan-row { margin: 12px 0; }
#permohonan-video { border: 1px solid #ccc; }
.scan-status { color: #666; margin-top: 6px; }

/* Modal styles for QR scanner */
.qrscan-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999999; /* ensure modal sits above site header */
  padding: 40px 20px;
}
.qrscan-modal-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.55);
  z-index: 999998;
}
.qrscan-modal-dialog {
  position: relative;
  background: #fff;
  padding: 16px;
  border-radius: 6px;
  box-shadow: 0 6px 20px rgba(0,0,0,0.3);
  z-index: 999999;
  max-width: 1080px;
  max-height: calc(100vh - 80px);
  overflow: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20px 24px;
}
.qrscan-modal video { width: 480px; max-width: 100%; height: auto; display: block; background: #000; object-fit: cover; margin: 0 0 12px; border-radius: 6px; }

/* Ensure canvas scales with video size (kept hidden during preview) */
.qrscan-modal canvas { width: 960px; max-width: 100%; height: auto; display: none; }

/* Prevent body scroll while modal open via helper class */
body.qrscan-modal-open { overflow: hidden; }

/* Modern token input styling */
#permohonan-token-title { margin-top: 0; margin-bottom: 8px; font-size: 18px; }
#permohonan-token-input {
  width: 100%;
  box-sizing: border-box;
  padding: 10px 12px;
  font-size: 16px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  background: linear-gradient(180deg, #ffffff, #f7f9fb);
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.03);
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.05s;
}
#permohonan-token-input:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 4px rgba(37,99,235,0.12);
}

/* Slight spacing for modal action buttons */
.qrscan-modal-dialog .button { margin-right: 8px; }

/* Token input invalid state */
#permohonan-token-input.invalid {
  border-color: #ef4444;
  box-shadow: 0 0 0 4px rgba(239,68,68,0.08);
  animation: shake 0.18s ease-in-out 0s 1;
}

/* small X close button */
.permohonan-token-x {
  position: absolute;
  top: 6px;
  right: 8px;
  border: none;
  background: transparent;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  color: #6b7280;
}
.permohonan-token-x:hover { color: #111827; }

@keyframes shake {
  0% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  50% { transform: translateX(6px); }
  75% { transform: translateX(-4px); }
  100% { transform: translateX(0); }
}

/* Inline action buttons layout */
.permohonan-actions {
  display: flex;
  gap: 12px;
  align-items: stretch;
}
.permohonan-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 17px;
  min-width: 160px;
  flex: 1 1 0;
  text-align: center;
  height: 100px !important;
}
.permohonan-action .icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.permohonan-action .label {display: inline-block;/* padding: 18px; */}

@media (max-width: 768px) {
  .permohonan-actions {
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
  }
  .permohonan-action {
    width: 72% !important;
    min-width: unset !important;
    height: 90px !important;
    min-height: 90px !important;
    flex: none !important;
    padding: 0.75rem 1rem !important;
    font-size: 0.9rem !important;
    line-height: 1.35 !important;
    border-radius: 12px !important;
    justify-content: center !important;
    flex-direction: column !important;
    gap: 0.35rem !important;
    text-align: center !important;
    box-sizing: border-box !important;
    white-space: normal !important;
  }
  .permohonan-action .label {
    display: block;
    white-space: normal;
    word-break: break-word;
  }
  /* Footer: keep it near the bottom on short pages */
  .layout-main-wrapper {
    min-height: 60vh;
  }
}
