/* ── RedoSan Authenticity — Page-specific CSS ──
   This file contains CSS rules unique to this page.
   Shared/base styles are in ../../Style/style.css
   Loaded AFTER shared CSS so overrides work naturally. */

/* Input-mode tabs: site-template segmented buttons */
.voice-input-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.voice-tab-btn {
  display: inline-block;
  padding: 8px 16px;
  background: var(--card-hover);
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.85rem;
  cursor: pointer;
  transition: 0.2s;
  touch-action: manipulation;
}

.voice-tab-btn:hover {
  background: var(--card);
  color: var(--primary);
  border-color: var(--primary);
}

.voice-tab-btn.is-active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.voice-tab-btn.is-active:hover {
  background: var(--primary-dark);
  color: #fff;
}

/* Preview: keep aspect ratio, fit the card layout */
#voice-preview {
  display: none;
  max-width: 100%;
  max-height: 420px;
  width: auto;
  height: auto;
  object-fit: contain;
  margin: 12px auto 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--card);
}

/* Registry management + camera buttons: solid primary, never faded */
.btn-sm.voice-mgmt-btn,
#voice-record-start,
#voice-record-stop,
#voice-record-abort {
  background: var(--primary);
  color: #fff;
  border: none;
}

.btn-sm.voice-mgmt-btn:hover,
#voice-record-start:hover,
#voice-record-stop:hover,
#voice-record-abort:hover {
  opacity: 1;
  background: var(--primary-dark);
  color: #fff;
  border: none;
}

/* Liveness mode select: match the site's compact select styling */
#voice-liveness-mode {
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-size: 0.85rem;
  cursor: pointer;
  outline: none;
}

#voice-liveness-mode:focus {
  border-color: var(--primary);
}

/* Progress overlay: blur the page while identifiers are generated */
.voice-progress-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgb(15, 15, 35, 0.35);
  backdrop-filter: blur(7px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.45s ease;
}

.voice-progress-overlay.is-visible {
  opacity: 1;
  pointer-events: auto;
}

.voice-progress-card {
  width: min(92vw, 380px);
  padding: 28px 24px 22px;
  border-radius: 14px;
  background: var(--card, #fff);
  border: 1px solid var(--border, #ddd);
  box-shadow: 0 18px 60px rgb(0, 0, 0, 0.35);
  text-align: center;
}

.voice-progress-spinner {
  width: 58px;
  height: 58px;
  margin: 0 auto 16px;
  border-radius: 50%;
  background: conic-gradient(
    from 0deg,
    var(--primary, #6c5ce7),
    rgb(108, 92, 231, 0.15) 65%,
    var(--primary, #6c5ce7)
  );
  mask: radial-gradient(
    farthest-side,
    transparent calc(100% - 7px),
    #000 calc(100% - 6px)
  );
  animation: voice-spin 0.9s linear infinite;
}

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

.voice-progress-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text, #222);
  margin-bottom: 4px;
}

.voice-progress-text {
  font-size: 0.82rem;
  color: var(--text-muted, #666);
  margin-bottom: 16px;
  min-height: 1.2em;
}

.voice-progress-track {
  position: relative;
  height: 10px;
  border-radius: 999px;
  background: var(--border, #e5e5e5);
  overflow: hidden;
  display: flex;
  align-items: center;
  gap: 8px;
}

.voice-progress-bar {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, #6c5ce7, #a29bfe, #6c5ce7);
  background-size: 200% 100%;
  width: 0%;
  transition: width 0.35s ease;
  animation: voice-shimmer 1.4s linear infinite;
}

.voice-progress-bar.is-det {
  animation: none;
  background: linear-gradient(90deg, #6c5ce7, #a29bfe);
}

@keyframes voice-shimmer {
  to {
    background-position: -200% 0;
  }
}

.voice-progress-pct {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.62rem;
  font-weight: 700;
  color: var(--text-muted, #666);
  background: var(--card, #fff);
  border-radius: 4px;
  padding: 0 3px;
  line-height: 1.2;
}

@media (prefers-reduced-motion: reduce) {
  .voice-progress-spinner,
  .voice-progress-bar {
    animation: none;
  }
}

/* ── Consent checkbox: comfortable touch target on mobile ── */
#voice-consent-panel input[type="checkbox"] {
  width: 20px;
  height: 20px;
  min-width: 20px;
  flex: none;
  margin-top: 2px;
  accent-color: #6c5ce7;
  cursor: pointer;
}

/* ── Consent list: RTL-safe, items stacked one below another ── */
.consent-list {
  font-size: 0.78rem;
  margin: 0 0 10px;
  padding-inline-start: 18px;
  padding-inline-end: 4px;
  line-height: 1.7;
  list-style-type: disc;
}

.consent-list li {
  margin-block-end: 6px;
}

/* ── Help card readability & flow (desktop EN copy renders small, and the
      shared pre-line rule forces ragged breaks with a wide right gutter) ── */
.help-card-body {
  font-size: 0.95rem;
  line-height: 1.75;
  white-space: pre-wrap;
}

.help-card-body li {
  margin-block-end: 4px;
}

.help-card-header {
  font-size: 1rem;
}

/* ── Interactive Audio Recorder UI ── */
.voice-recorder-ui {
  margin: 12px 0;
  padding: 16px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 4px 12px rgb(0, 0, 0, 0.1);
}

.voice-recorder-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.voice-recorder-status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
  color: var(--text);
}

#voice-status.voice-status-success {
  color: #1aab4e !important;
  font-weight: 600;
}

.voice-recorder-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--text-muted);
  transition: background 0.3s ease;
}

.voice-recorder-dot.recording {
  background: #ef4444;
  animation: pulse-recording 1.5s ease-in-out infinite;
}

@keyframes pulse-recording {
  0%,
  100% {
    opacity: 1;
    transform: scale(1);
  }

  50% {
    opacity: 0.7;
    transform: scale(1.1);
  }
}

.voice-recorder-timer {
  font-family: "Courier New", monospace;
  font-size: 1.2rem;
  font-weight: bold;
  color: var(--text);
  background: var(--card-hover);
  padding: 4px 12px;
  border-radius: 6px;
  border: 1px solid var(--border);
}

.voice-recorder-timer-group {
  display: flex;
  align-items: center;
  gap: 6px;
}

.voice-recorder-max-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.5px;
}

/* Progress bar for max duration */
.voice-recorder-progress-container {
  width: 100%;
  height: 4px;
  background: var(--card-hover);
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 12px;
}

.voice-recorder-progress {
  height: 100%;
  width: 0%;
  background: var(--primary, #3b82f6);
  border-radius: 2px;
  transition:
    width 0.25s ease,
    background 0.3s ease;
}

.voice-recorder-progress--warn {
  background: #f59e0b;
}

.voice-recorder-progress--critical {
  background: #ef4444;
  animation: progress-pulse 1s ease-in-out infinite;
}

@keyframes progress-pulse {
  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.6;
  }
}

.voice-recorder-canvas-container {
  width: 100%;
  height: 80px;
  margin: 12px 0;
  background: var(--card-hover);
  border-radius: 8px;
  border: 1px solid var(--border);
  overflow: hidden;
}

.voice-recorder-canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.voice-recorder-controls {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.voice-record-btn {
  flex: 1;
  min-width: 120px;
  padding: 10px 16px;
  font-size: 0.9rem;
  font-weight: 500;
  border-radius: 8px;
  transition: all 0.2s ease;
  touch-action: manipulation;
}

.voice-record-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Responsive adjustments */
@media (max-width: 600px) {
  .voice-recorder-ui {
    padding: 12px;
  }

  .voice-recorder-header {
    flex-direction: column;
    gap: 8px;
    align-items: flex-start;
  }

  .voice-recorder-timer-group {
    align-self: flex-start;
  }

  .voice-recorder-timer {
    font-size: 1rem;
  }

  .voice-recorder-canvas-container {
    height: 60px;
  }

  .voice-record-btn {
    min-width: 100%;
  }
}
