/*
 * Slide captcha modal for the login page.
 * Matches the dialog and puzzle of nusapay-disbursment (Tailwind/shadcn), written as plain CSS.
 */

/* ---------- Dialog ---------- */
.sc-dialog-overlay {
  position: fixed;
  inset: 0;
  z-index: 1060;
  background-color: rgba(107, 114, 128, 0.75);
  animation: sc-fade-in 0.2s ease-out;
}

.sc-dialog {
  position: fixed;
  top: 50%;
  left: 50%;
  z-index: 1061;
  display: grid;
  gap: 1rem;
  width: 100%;
  max-width: calc(100% - 2rem);
  padding: 1.5rem;
  background-color: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 0.625rem;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
  font-family: 'Ubuntu', ui-sans-serif, system-ui, sans-serif;
  transform: translate(-50%, -50%);
  animation: sc-zoom-in 0.2s ease-out;
}

.sc-dialog[hidden],
.sc-dialog-overlay[hidden] {
  display: none;
}

@media (min-width: 640px) {
  .sc-dialog {
    max-width: 28rem;
  }
}

.sc-dialog:focus {
  outline: none;
}

.sc-dialog-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  display: inline-flex;
  padding: 0;
  color: inherit;
  background: transparent;
  border: 0;
  border-radius: 0.125rem;
  opacity: 0.7;
  transition: opacity 0.15s;
}

.sc-dialog-close:hover {
  opacity: 1;
}

.sc-dialog-close:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px #fff, 0 0 0 4px #9ca3af;
}

.sc-dialog-close svg {
  width: 1rem;
  height: 1rem;
  pointer-events: none;
}

.sc-dialog-header {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  margin: -1.5rem -1.5rem 0.25rem;
  padding: 1.25rem 1.5rem;
  text-align: left;
  border-bottom: 1px solid #e5e7eb;
}

.sc-dialog-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  line-height: 1;
  color: #374151;
}

.sc-dialog-description {
  margin: 0;
  font-size: 0.875rem;
  line-height: 1.25rem;
  color: #6b7280;
}

/* ---------- Puzzle ---------- */
.sc [hidden] {
  display: none !important;
}

.sc {
  display: grid;
  gap: 0.5rem;
}

.sc-toolbar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
}

.sc-refresh {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0;
  font-size: 0.75rem;
  line-height: 1rem;
  color: #6b7280;
  background: transparent;
  border: 0;
}

.sc-refresh:hover {
  color: #111827;
}

.sc-refresh:disabled {
  opacity: 0.5;
}

.sc-frame {
  position: relative;
  width: 100%;
  aspect-ratio: 2 / 1;
  overflow: hidden;
  background-color: #f3f4f6;
  border: 1px solid #e5e7eb;
  border-radius: 0.5rem;
  user-select: none;
  -webkit-user-select: none;
}

.sc-frame img {
  position: absolute;
  max-width: none;
  pointer-events: none;
}

.sc-background {
  inset: 0;
  width: 100%;
  height: 100%;
}

.sc-piece {
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.45));
}

.sc-center {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #9ca3af;
}

.sc-verified {
  background-color: rgba(5, 150, 105, 0.25);
}

.sc-badge {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.25rem 0.75rem;
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1.25rem;
  color: #047857;
  background-color: #fff;
  border-radius: 9999px;
  box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px -1px rgba(0, 0, 0, 0.1);
}

.sc-track {
  position: relative;
  width: 100%;
  height: 2.5rem;
  overflow: hidden;
  background-color: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 0.5rem;
}

.sc-track.is-success {
  background-color: #ecfdf5;
  border-color: #34d399;
}

.sc-track.is-error {
  background-color: #fef2f2;
  border-color: #f87171;
  animation: sc-shake 0.3s;
}

.sc-fill {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  background-color: rgba(229, 231, 235, 0.7);
}

.sc-track.is-success .sc-fill {
  background-color: #d1fae5;
}

.sc-hint {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding-left: 2.5rem;
  font-size: 0.75rem;
  line-height: 1rem;
  color: #6b7280;
  pointer-events: none;
}

.sc-handle {
  position: absolute;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 100%;
  padding: 0;
  color: #374151;
  background-color: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 0.5rem;
  box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  cursor: grab;
  touch-action: none;
}

.sc-handle:active {
  cursor: grabbing;
}

.sc-handle:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px #9ca3af;
}

.sc-handle:disabled {
  opacity: 1;
}

.sc-track.is-success .sc-handle {
  color: #059669;
  border-color: #34d399;
  cursor: default;
}

.sc-error {
  margin: 0;
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1.25rem;
  color: #dc2626;
}

.sc-spin {
  width: 1rem;
  height: 1rem;
  animation: sc-spin 1s linear infinite;
}

@keyframes sc-spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes sc-shake {
  0%,
  100% {
    transform: translateX(0);
  }
  25% {
    transform: translateX(-4px);
  }
  75% {
    transform: translateX(4px);
  }
}

@keyframes sc-fade-in {
  from {
    opacity: 0;
  }
}

@keyframes sc-zoom-in {
  from {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.95);
  }
}
