/**
 * Estilos específicos para o sistema de reconhecimento facial
 */

/* Estados do indicador de status */
.tf-status-light.tf-status-success {
    background: var(--tf-primary);
    box-shadow: 0 0 10px rgba(34, 179, 27, 0.5);
}

.tf-status-light.tf-status-error {
    background: #dc2626;
    box-shadow: 0 0 10px rgba(220, 38, 38, 0.5);
    animation: errorPulse 1s infinite;
}

.tf-status-light.tf-status-warning {
    background: #f59e0b;
    box-shadow: 0 0 10px rgba(245, 158, 11, 0.5);
}

.tf-status-light.tf-status-processing {
    background: #3b82f6;
    box-shadow: 0 0 10px rgba(59, 130, 246, 0.5);
    animation: processingPulse 0.8s infinite;
}

@keyframes errorPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

@keyframes processingPulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.7; transform: scale(1.1); }
}

/* Melhorias na interface da câmera */
.tf-camera-container:before {
    content: 'Posicione seu rosto dentro do quadro';
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 12px;
    z-index: 10;
    opacity: 0.8;
}

/* Efeitos visuais aprimorados */
.tf-face-frame {
    transition: all 0.3s ease;
}

.tf-face-frame.scanning {
    border-color: #3b82f6;
    box-shadow: 0 0 20px rgba(59, 130, 246, 0.5);
}

.tf-face-frame.success {
    border-color: var(--tf-primary);
    box-shadow: 0 0 20px rgba(34, 179, 27, 0.7);
}

.tf-face-frame.error {
    border-color: #dc2626;
    box-shadow: 0 0 20px rgba(220, 38, 38, 0.7);
}

/* Animações melhoradas */
@keyframes scanLine {
    0% { top: 0; opacity: 1; }
    100% { top: 100%; opacity: 0; }
}

.tf-detection-overlay.scanning::after {
    content: '';
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    width: 200px;
    height: 2px;
    background: linear-gradient(90deg, transparent, #3b82f6, transparent);
    animation: scanLine 2s infinite;
}

/* Feedback visual para captura */
.tf-camera-container.capturing {
    animation: cameraFlash 0.3s ease-out;
}

@keyframes cameraFlash {
    0% { background: #000; }
    50% { background: #fff; }
    100% { background: #000; }
}

/* Melhor contraste para textos */
.tf-result-container {
    transition: all 0.3s ease;
}

.tf-result-container.success {
    border-color: var(--tf-primary);
    background: rgba(34, 179, 27, 0.05);
}

.tf-result-container.error {
    border-color: #dc2626;
    background: rgba(220, 38, 38, 0.05);
}

/* Indicadores de progresso */
.tf-progress-bar {
    width: 100%;
    height: 4px;
    background: rgba(0, 0, 0, 0.1);
    border-radius: 2px;
    overflow: hidden;
    margin: 16px 0;
}

.tf-progress-fill {
    height: 100%;
    background: var(--tf-gradient);
    border-radius: 2px;
    transition: width 0.3s ease;
    width: 0%;
}

/* Tooltips e ajuda */
.tf-tooltip {
    position: relative;
    cursor: help;
}

.tf-tooltip::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 120%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 12px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
    z-index: 1000;
}

.tf-tooltip:hover::after {
    opacity: 1;
}

/* Estados de conectividade */
.tf-connection-status {
    position: absolute;
    top: 20px;
    right: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 20px;
    font-size: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.tf-connection-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--tf-primary);
}

.tf-connection-dot.offline {
    background: #dc2626;
    animation: errorPulse 1s infinite;
}

/* Versão mobile aprimorada */
@media (max-width: 768px) {
    .tf-camera-container {
        aspect-ratio: 3/4;
    }

    .tf-face-frame {
        width: 150px;
        height: 200px;
    }

    .tf-camera-container:before {
        font-size: 11px;
        padding: 6px 12px;
    }

    .tf-result-container {
        padding: 24px 16px;
    }

    .tf-btn {
        padding: 14px 20px;
        font-size: 16px;
    }
}

/* Acessibilidade */
@media (prefers-reduced-motion: reduce) {
    .tf-status-light,
    .tf-face-frame,
    .tf-loader {
        animation: none;
    }
}

/* Contraste alto */
@media (prefers-contrast: high) {
    .tf-face-frame {
        border-width: 3px;
    }

    .tf-corner {
        border-width: 4px;
    }

    .tf-btn {
        border-width: 2px;
    }
}

/* Tema escuro */
@media (prefers-color-scheme: dark) {
    #ticket-face-recognition-container {
        background: rgba(31, 41, 55, 0.98);
        color: #f9fafb;
    }

    .tf-recognition-header,
    .tf-recognition-status {
        background: rgba(17, 24, 39, 0.8);
    }

    .tf-result-container {
        background: rgba(17, 24, 39, 0.5);
        border-color: rgba(75, 85, 99, 0.5);
    }

    .tf-camera-container:before {
        background: rgba(17, 24, 39, 0.9);
    }
}

/* Keyframes adicionais */
@keyframes zoomIn {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.tf-result-success,
.tf-result-error {
    animation: zoomIn 0.4s ease-out;
}

.tf-messages .tf-alert {
    animation: slideUp 0.3s ease-out;
}

/* Mensagens de Status */
.tf-messages {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
    max-width: 400px;
}

.tf-alert {
    background: var(--tf-surface);
    border-left: 4px solid var(--tf-primary);
    padding: 16px;
    margin-bottom: 12px;
    border-radius: 0 var(--tf-radius) var(--tf-radius) 0;
    box-shadow: var(--tf-shadow-lg);
    animation: slideIn 0.3s ease-out;
    backdrop-filter: blur(8px);
}

.tf-alert-error {
    border-left-color: var(--tf-error);
    background: rgba(254, 242, 242, 0.95);
    color: #dc2626;
}

.tf-alert-success {
    border-left-color: var(--tf-success);
    background: rgba(240, 253, 244, 0.95);
    color: #16a34a;
}

.tf-alert-warning {
    border-left-color: var(--tf-warning);
    background: rgba(255, 251, 235, 0.95);
    color: #d97706;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Melhorias adicionais */
.tf-btn:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(30, 64, 175, 0.3);
}

.tf-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

/* Estados especiais */
.tf-camera-container.capturing {
    animation: cameraFlash 0.3s ease-out;
}

@keyframes cameraFlash {
    0% { filter: brightness(1); }
    50% { filter: brightness(2); }
    100% { filter: brightness(1); }
}

.tf-scanning-line {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    width: 200px;
    height: 2px;
    background: var(--tf-gradient);
    opacity: 0;
    animation: scanLine 2s infinite;
}

@keyframes scanLine {
    0% {
        top: 0;
        opacity: 1;
    }
    100% {
        top: 100%;
        opacity: 0;
    }
}

/* Sistema de feedback tátil */
.tf-feedback-success {
    animation: successPulse 0.3s ease-out;
}

.tf-feedback-error {
    animation: errorShake 0.5s ease-out;
}

@keyframes successPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.02); }
}

/* Responsividade para telas pequenas */
@media (max-width: 480px) {
    .tf-recognition-header {
        padding: 16px;
    }

    .tf-title {
        font-size: 20px;
    }

    .tf-subtitle {
        font-size: 14px;
    }

    .tf-camera-section,
    .tf-result-section {
        padding: 16px;
    }

    .tf-face-frame {
        width: 120px;
        height: 160px;
    }

    .tf-user-name {
        font-size: 20px;
    }

    .tf-recognition-details {
        font-size: 12px;
    }
}