/* public/css/style.css */
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100%;
    width: 100vw;
    background: #613ab5;
    margin: 0;
    color: #fff;
    overflow: hidden;
}
.main-container {
    padding: 15px 5px;
    width: 100%;
    height: 100%;
    max-width: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    box-sizing: border-box;
    overflow: hidden;
}
.liveness-wrapper {
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
    padding: 20px;
    text-align: center;
    overflow: hidden;
    height: 100%;
    transition: transform 0.3s ease;
    width: 100%;
    max-width: 500px;
    box-sizing: border-box;
}
.liveness-wrapper:hover {
    transform: scale(1.02);
}
h1 {
    margin-top: 0;
    color: #fff;
    font-size: 2rem;
    font-weight: bold;
}
.instructions {
    font-size: 1.2rem;
    color: #ddd;
    min-height: 60px;
    transition: color 0.3s ease, transform 0.3s ease, opacity 0.3s ease;
    font-weight: 500;
    padding: 10px;
    border-radius: 8px;
    background-color: rgba(255, 255, 255, 0.05);
}
.intro-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}
.intro-screen p {
    font-size: 1.1rem;
    margin: 20px 0;
    color: #eee;
}
.intro-icon {
    font-size: 5rem;
    margin-bottom: 20px;
    animation: pulse 2s infinite;
}
@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}
.start-button {
    background-color: #37d39b;
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 150px;
    height: 150px;
    font-size: 1.4rem;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;

    box-shadow: 3px 3px 0 #2ca67d,
                0 12px 20px rgba(0, 0, 0, 0.35);
    transition: all 0.2s ease-in-out;
}

.start-button:hover {
    transform: translateY(-2px);
    box-shadow: 3px 5px 0 #2ca67d,
                0 14px 25px rgba(0, 0, 0, 0.4);
}

.start-button:active {
    transform: translateY(4px);
    box-shadow: 0 4px 0 #2ca67d,
                0 8px 12px rgba(0, 0, 0, 0.3);
}
.video-container {
    position: relative;
    width: 100%;
    max-width: 400px;
    margin: 20px auto;
    overflow: hidden;
    border: none;
    border-radius: 50%;
    display: none;
    background: #000;
}
.video-container::before {
    content: "";
    display: block;
    padding-top: 100%;
}
video, #canvas-mask, #canvas-fx {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}
video {
    transform: scaleX(-1);
    background: transparent;
}
#canvas-mask {
    transform: scaleX(-1);
    z-index: 5;
}
#canvas-fx {
    z-index: 6; /* Por cima do mask para efeitos, sem scaleX */
}
.loader, .loader-overlay .loader-dots {
    display: none;
    position: relative;
    width: 100px; /* Aumentado para melhor espaçamento */
    height: 40px;
    margin: 20px auto;
}
.loader::before, .loader::after, .loader span,
.loader-overlay .loader-dots::before, .loader-overlay .loader-dots::after, .loader-overlay .loader-dots span {
    content: '';
    position: absolute;
    width: 12px;
    height: 12px;
    background: #fff;
    border-radius: 50%;
    animation: bounce 1.5s infinite ease-in-out;
    display: block; /* Garantir visibilidade */
}
.loader::before, .loader-overlay .loader-dots::before { left: 0; animation-delay: -0.3s; }
.loader span, .loader-overlay .loader-dots span { left: 40px; animation-delay: -0.15s; display: inline-block; } /* Explícito para span */
.loader::after, .loader-overlay .loader-dots::after { left: 80px; animation-delay: 0s; }
@keyframes bounce {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1); }
}
.feedback-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    color: #613ab5;
    font-size: 2rem;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.5s, visibility 0.5s, transform 0.5s;
    border-radius: 50%;
    z-index: 10;
    backdrop-filter: blur(10px);
}
.feedback-overlay.show {
    opacity: 1;
    visibility: visible;
    transform: scale(1.05);
}
.feedback-overlay.success { background-color: rgba(255, 255, 255, 0.85); }
.feedback-overlay.error { background-color: rgba(220, 53, 69, 0.85); color: #fff; }
.feedback-overlay span { font-size: 5rem; transition: transform 0.3s; }
.feedback-overlay.show span { transform: rotate(360deg); }
.feedback-overlay p { margin: 10px 0 0 0; font-weight: bold; }
.camera-loader {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.8);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 10;
}

.camera-loader-loader {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.camera-loader-loader-text {
  color: white;
  font-size: 1.2rem;
  font-weight: bold;
}

.camera-loader-arc {
  position: relative;
  width: 40px;
  height: 40px;
}

.camera-loader-arc::before,
.camera-loader-arc::after,
.camera-loader-dot {
  content: '';
  position: absolute;
  top: calc(50% - 3px);
  left: calc(50% - 3px);
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background-color: white;
  animation: orbit 1.5s linear infinite;
}

.camera-loader-arc::before {
  animation-delay: -0.5s;
}

.camera-loader-arc::after {
  animation-delay: -1s;
}

@keyframes orbit {
  0% {
    transform: rotate(0deg) translateX(16px);
  }
  100% {
    transform: rotate(360deg) translateX(16px);
  }
}
.progress-steps {
    display: flex;
    justify-content: center;
    gap: 5%;
    margin: 10px 0;
}
.progress-step {
    width: 30px;
    height: 30px;
    background-color: #ddd;
    border-radius: 50%;
    transition: background-color 0.3s;
    color: #613ab5;
    font-size: 1rem; /* Legível */
    display: flex;
    align-items: center;
    justify-content: center;
}
.progress-step.active {
    background-color: #fff;
}
.progress-step.complete {
    background-color: #37d39b;
}
.progress-step.animated-complete {
    animation: completeAnim 0.5s ease-in-out;
}
@keyframes completeAnim {
    0% { transform: scale(1); box-shadow: none; }
    50% { transform: scale(1.2); box-shadow: 0 0 10px #37d39b; }
    100% { transform: scale(1); box-shadow: none; }
}
#debug-feedback {
    font-size: 0.8rem;
    color: #aaa;
    margin-top: 10px;
}
@keyframes pulse-ellipse {
    0% { stroke-width: 6; }
    50% { stroke-width: 8; }
    100% { stroke-width: 6; }
}
#debug-table {
    font-size: 0.8rem;
    color: #aaa;
    margin-top: 10px;
    text-align: left;
}
#debug-table table {
    width: 100%;
    border-collapse: collapse;
}
#debug-table th, #debug-table td {
    border: 1px solid #aaa;
    padding: 2px;
}
/* Novo: Loader overlay para loading inicial */
.loader-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(97, 58, 181, 0.9); /* Match background */
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 999;
    opacity: 1;
    transition: opacity 0.5s ease;
}
.loader-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}
.loader-overlay .loader-text {
    font-size: 1.2rem;
    margin-bottom: 20px;
    color: #fff;
    animation: fadePulse 1.5s infinite;
}
@keyframes fadePulse {
    0%, 100% { opacity: 0.7; }
    50% { opacity: 1; }
}
.loader-overlay .loader-dots {
    display: block;
    width: 100px;
    height: 50px;
}
.loader-overlay .loader-dots::before, .loader-overlay .loader-dots::after, .loader-overlay .loader-dots span {
    background: linear-gradient(to right, #37d39b, #fff); /* Degradê bonito */
}
@media (max-width: 480px) {
    .progress-step {
        width: 8vw; /* Relativo a viewport */
        height: 8vw;
        font-size: 4vw;
    }
    .loader-dots {
        width: 25vw;
    }
}