/**
 * RemoverEmail Modal CSS - Versão 3.0 com Acessibilidade 
 * Sistema refinado sem uso de !important e com suporte ARIA
 */

/* =====================
 * RemoverEmail Modal CSS - Customizações necessárias para o fluxo OTP
 * Mantido apenas o essencial para animações, feedback visual e responsividade.
 * Regras que causam conflito ou são redundantes com Bootstrap foram removidas.
 * ===================== */

:root {
    --removeremail-primary: #25D366;
    --removeremail-primary-hover: #20BD5A;
    --removeremail-bg: #FFFFFF;
    --removeremail-text: #333333;
    --removeremail-overlay: rgba(0, 0, 0, 0.7);
    --removeremail-radius: 8px;
    --removeremail-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    --removeremail-transition: all 0.3s ease;
    /* Novas variáveis para personalização */
    --removeremail-btn-text: #fff;
    --removeremail-btn-bg: #25D366;
    --removeremail-btn-border: #25D366;
    --removeremail-field-text: #222;
    --removeremail-field-bg: #fff;
    --removeremail-field-border: #ccc;
    --removeremail-font: inherit;
    --removeremail-btn-bg-hover: var(--removeremail-primary-hover);
    --removeremail-btn-text-hover: var(--removeremail-btn-text);
    --removeremail-btn-border-hover: var(--removeremail-btn-border);
    --removeremail-trigger-bg: var(--removeremail-primary);
    --removeremail-trigger-text: #fff;
    --removeremail-trigger-border: var(--removeremail-primary);
    --removeremail-trigger-bg-hover: var(--removeremail-primary-hover);
    --removeremail-trigger-text-hover: var(--removeremail-trigger-text, #fff);
    --removeremail-trigger-border-hover: var(--removeremail-trigger-border, var(--removeremail-primary));
}

/* ==== ESTRUTURA BÁSICA DO MODAL ==== */
.removeremail-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 999;
    display: none;
}

/* Foco visível para usuários de teclado */
.removeremail-modal-container:focus,
.removeremail-modal-button:focus,
.removeremail-modal-close:focus,
.removeremail-modal-input:focus,
.removeremail-modal-trigger:focus {
    outline: 2px solid var(--removeremail-primary);
    outline-offset: 2px;
}

/* Estado de visibilidade específico para acessibilidade */
.removeremail-modal[aria-hidden="false"] {
    display: block;
}

/* Overlay - camada de fundo */
.removeremail-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--removeremail-overlay);
}

/* Container principal */
.removeremail-modal-container {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: var(--removeremail-bg);
    color: var(--removeremail-text);
    font-family: var(--removeremail-font, inherit);
    border-radius: var(--removeremail-radius);
    box-shadow: var(--removeremail-shadow);
    width: 90%;
    max-width: 480px;
    min-height: 300px;
    max-height: 90vh;
    overflow-y: auto;
    animation: removerEmailModalFadeIn 0.3s ease;
}

/* Animações para experiência melhorada */
@keyframes removerEmailModalFadeIn {
    from { opacity: 0; transform: translate(-50%, -48%); }
    to { opacity: 1; transform: translate(-50%, -50%); }
}

/* Alerta para usuários de leitor de tela sobre mudanças dinâmicas */
.removeremail-modal-live-region {
    position: absolute;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    height: 1px;
    width: 1px;
    overflow: hidden;
    white-space: nowrap;
}

/* ==== ELEMENTOS DO MODAL ==== */

/* Botão de fechar */
.removeremail-modal-close {
    position: absolute;
    top: 10px;
    right: 10px;
    background: transparent;
    border: none;
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
    color: #999;
    transition: var(--removeremail-transition);
    z-index: 10;
    padding: 5px 10px;
    border-radius: 50%;
}

.removeremail-modal-close:hover,
.removeremail-modal-close:focus {
    color: var(--removeremail-text);
    background-color: rgba(0, 0, 0, 0.05);
}

/* Cabeçalho do modal */
.removeremail-modal-header {
    padding: 20px 20px 10px;
    text-align: center;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.removeremail-modal-title {
    font-size: 24px;
    margin: 0 0 10px;
    color: var(--removeremail-text);
    font-weight: 600;
}

.removeremail-modal-subtitle {
    font-size: 14px;
    margin: 0 0 15px;
    color: #666;
}

/* Corpo do modal */
.removeremail-modal-body {
    padding: 20px;
}

.removeremail-modal-content {
    width: 100%;
}

/* Etapas do formulário */
.removeremail-modal-step {
    display: block;
}

/* Grupos de formulário */
.removeremail-modal-form-group {
    margin-bottom: 20px;
}

.removeremail-modal-label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--removeremail-text);
    font-size: 14px;
}

.removeremail-modal-input {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid #DDD;
    border-radius: 4px;
    font-size: 16px;
    transition: var(--removeremail-transition);
}

.removeremail-modal-input:focus {
    border-color: var(--removeremail-primary);
    box-shadow: 0 0 0 2px rgba(37, 211, 102, 0.2);
}

.removeremail-modal-help {
    display: block;
    margin-top: 6px;
    font-size: 12px;
    color: #777;
}

/* Botão primário */
.removeremail-modal-button {
    display: block;
    width: 100%;
    padding: 14px 20px;
    background-color: var(--removeremail-btn-bg);
    color: var(--removeremail-btn-text);
    border: 2px solid var(--removeremail-btn-border);
    border-radius: 4px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--removeremail-transition);
    font-family: var(--removeremail-font, inherit);
}

.removeremail-modal-button:hover,
.removeremail-modal-button:focus {
    background-color: var(--removeremail-btn-bg-hover, var(--removeremail-primary-hover));
    color: var(--removeremail-btn-text-hover, var(--removeremail-btn-text));
    border-color: var(--removeremail-btn-border-hover, var(--removeremail-btn-border));
}

/* Botão de trigger */
.removeremail-modal-trigger {
    display: inline-block;
    padding: 10px 16px;
    background-color: var(--removeremail-trigger-bg, var(--removeremail-primary));
    color: var(--removeremail-trigger-text, #fff);
    border: 2px solid var(--removeremail-trigger-border, var(--removeremail-primary));
    border-radius: 4px;
    font-size: 16px;
    cursor: pointer;
    transition: var(--removeremail-transition);
    font-family: var(--removeremail-font, inherit);
}

.removeremail-modal-trigger:hover,
.removeremail-modal-trigger:focus {
    background-color: var(--removeremail-trigger-bg-hover, var(--removeremail-primary-hover));
    color: var(--removeremail-trigger-text-hover, var(--removeremail-trigger-text, #fff));
    border-color: var(--removeremail-trigger-border-hover, var(--removeremail-trigger-border, var(--removeremail-primary)));
}

/* ==== ACESSIBILIDADE ==== */

/* Esconde elementos visualmente mas mantém para leitores de tela */
.removeremail-modal-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* Visualmente escondido mas acessível para leitores de tela */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* Estado de foco estilizado para acessibilidade por teclado */
.js-focus-visible :focus:not(.focus-visible) {
    outline: none;
}

.js-focus-visible .focus-visible {
    outline: 2px solid var(--removeremail-primary);
    outline-offset: 2px;
}

/* Skip to content link - invisível até receber foco */
.skip-to-modal-content {
    position: absolute;
    top: -40px;
    left: 0;
    background: var(--removeremail-primary);
    color: white;
    padding: 8px;
    z-index: 1000;
    transition: top 0.3s;
}

.skip-to-modal-content:focus {
    top: 0;
}

/* ==== NOVOS ELEMENTOS PARA OTP E FLUXO ==== */

/* Mensagens de erro */
.removeremail-modal-error {
    color: #d32f2f;
    font-size: 14px;
    margin-top: 8px;
    font-weight: 500;
}

/* Notificações */
.removeremail-modal-notification {
    background-color: #e8f5e9;
    color: #2e7d32;
    padding: 10px 15px;
    border-radius: 4px;
    margin: 0 20px;
    font-size: 14px;
    text-align: center;
    font-weight: 500;
}

/* Processamento/Carregamento */
.removeremail-modal-processing {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px 0;
    margin: 10px 20px;
    gap: 10px;
    font-size: 14px;
    color: #555;
}

.removeremail-modal-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(0, 0, 0, 0.1);
    border-top-color: var(--removeremail-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Container de OTP */
.removeremail-modal-otp-container {
    display: flex;
    gap: 8px;
    margin: 10px 0;
    justify-content: center;
}

.removeremail-modal-otp-digit {
    width: 40px;
    height: 48px;
    text-align: center;
    font-size: 18px;
    font-weight: 600;
    border: 1px solid #DDD;
    border-radius: 4px;
    transition: var(--removeremail-transition);
}

.removeremail-modal-otp-digit:focus {
    border-color: var(--removeremail-primary);
    box-shadow: 0 0 0 2px rgba(37, 211, 102, 0.2);
}

/* Timer */
.removeremail-modal-timer-container {
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 15px 0;
    gap: 8px;
}

.removeremail-modal-timer {
    font-weight: 700;
    color: #e53935;
}

/* Botões secundários */
.removeremail-modal-resend-button {
    margin-top: 10px;
    background-color: transparent;
    color: var(--removeremail-primary);
    border: 1px solid var(--removeremail-primary);
}

.removeremail-modal-resend-button:hover,
.removeremail-modal-resend-button:focus:not([disabled]) {
    background-color: rgba(37, 211, 102, 0.05);
}

.removeremail-modal-resend-button[disabled] {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Estilo para botões secundários em geral */
.removeremail-modal-secondary {
    background-color: transparent;
    color: var(--removeremail-primary);
    border: 1px solid var(--removeremail-primary);
}

.removeremail-modal-secondary:hover,
.removeremail-modal-secondary:focus {
    background-color: rgba(37, 211, 102, 0.05);
}

/* Caixa de mensagem para confirmações */
.removeremail-modal-message-box {
    background-color: #f8f9fa;
    border-radius: var(--removeremail-radius);
    padding: 15px 20px;
    margin-bottom: 20px;
    text-align: center;
}

.removeremail-modal-message-box p {
    margin: 0 0 10px;
    font-size: 15px;
    color: var(--removeremail-text);
}

.removeremail-modal-message-box p:last-child {
    margin-bottom: 0;
}

/* Grupo de botões para escolhas */
.removeremail-modal-button-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* Informações do usuário */
.removeremail-modal-info {
    text-align: center;
    margin: 0 0 20px;
    padding: 0 10px;
    font-size: 14px;
    color: #555;
}

/* Tela de sucesso */
.removeremail-modal-success-icon {
    width: 80px;
    height: 80px;
    background-color: #4caf50;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 40px;
    margin: 20px auto;
}

.removeremail-modal-success-title {
    text-align: center;
    font-size: 22px;
    margin: 15px 0;
    color: var(--removeremail-text);
}

.removeremail-modal-success-message {
    text-align: center;
    margin: 0 0 25px;
    color: #555;
}

/* ==== MENSAGENS DE SISTEMA ==== */

/* Notificações e mensagens de erro */
.removeremail-modal-notification {
    display: none;
    padding: 12px;
    border-radius: var(--removeremail-radius);
    margin-bottom: 15px;
    font-size: 14px;
    text-align: center;
    animation: removerEmailFadeIn 0.3s ease;
}

.removeremail-modal-success-notification {
    background-color: rgba(37, 211, 102, 0.15);
    color: #0d904b;
    border: 1px solid #0d904b;
}

.removeremail-modal-error-notification {
    background-color: rgba(255, 0, 0, 0.1);
    color: #d32f2f;
    border: 1px solid #d32f2f;
}

/* Mensagens de erro específicas com ícones e cores */
#otp-error {
    display: none;
    padding: 10px 15px;
    margin: 10px 0;
    border-radius: var(--removeremail-radius);
    background-color: rgba(255, 0, 0, 0.1);
    color: #d32f2f;
    border-left: 4px solid #d32f2f;
    font-size: 14px;
    text-align: left;
    transition: var(--removeremail-transition);
}

/* Estilos específicos para cada tipo de erro */
#otp-error[data-error-type="expired"] {
    background-color: rgba(255, 152, 0, 0.1);
    border-left-color: #ff9800;
    color: #e65100;
}

#otp-error[data-error-type="invalid"] {
    background-color: rgba(211, 47, 47, 0.1);
    border-left-color: #d32f2f;
    color: #b71c1c;
}

#otp-error[data-error-type="not-found"] {
    background-color: rgba(103, 58, 183, 0.1);
    border-left-color: #673ab7;
    color: #4527a0;
}

#otp-error[data-error-type="missing"] {
    background-color: rgba(255, 87, 34, 0.1);
    border-left-color: #ff5722;
    color: #d84315;
}

#otp-error[data-error-type="format"] {
    background-color: rgba(0, 150, 136, 0.1);
    border-left-color: #009688;
    color: #00695c;
}

#otp-error[data-error-type="general"] {
    background-color: rgba(33, 33, 33, 0.1);
    border-left-color: #212121;
    color: #212121;
}

/* Animação para chamar atenção para o erro */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
    20%, 40%, 60%, 80% { transform: translateX(5px); }
}

.shake-animation {
    animation: shake 0.6s cubic-bezier(.36,.07,.19,.97) both;
}

@keyframes removerEmailFadeIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Botão de reenviar código com estilo mais destacado */
.removeremail-modal-resend {
    display: inline-block;
    margin-top: 10px;
    color: var(--removeremail-primary);
    text-decoration: underline;
    cursor: pointer;
    font-size: 14px;
    transition: var(--removeremail-transition);
}

.removeremail-modal-resend:hover {
    color: var(--removeremail-primary-hover);
}

/* Contador de tentativas */
.removeremail-modal-attempts {
    font-size: 12px;
    color: #666;
    text-align: center;
    margin-top: 5px;
}

/* Feedback visual quando o usuário digita um OTP inválido */
.removeremail-modal-otp-digit.error {
    border-color: #d32f2f;
    box-shadow: 0 0 0 1px #d32f2f;
    animation: shake 0.5s cubic-bezier(.36,.07,.19,.97) both;
}

/* Feedback visual quando o usuário digita um OTP correto */
.removeremail-modal-otp-digit.success {
    border-color: var(--removeremail-primary);
    box-shadow: 0 0 0 1px var(--removeremail-primary);
}

/* ==== RESPONSIVIDADE ==== */
@media screen and (max-width: 480px) {
    .removeremail-modal-container {
        width: 95%;
        max-height: 95vh;
    }
    
    .removeremail-modal-title {
        font-size: 20px;
    }
    
    .removeremail-modal-close {
        font-size: 24px;
    }
}

@media (max-width: 480px) {
    .removeremail-modal-otp-container {
        gap: 4px;
    }
    
    .removeremail-modal-otp-digit {
        width: 36px;
        height: 42px;
        font-size: 16px;
    }
    
    .removeremail-modal-container {
        width: 95%;
        max-width: 360px;
    }
    
    .removeremail-modal-title {
        font-size: 20px;
    }
}

/* ====== CORREÇÃO DE VAZAMENTO DE BOOTSTRAP NO BACKEND ====== */
/*
 * Corrige links globais afetados pelo Bootstrap, mas só aplica no frontend.
 * No backend/admin, o CSS não deve ser carregado!
 * Seletor robusto para garantir que nunca afete o admin, mesmo com body customizado.
 */
body:not(.wp-admin):not([class*="wp-admin"]) a:not(.btn):not([class*="link-"]) {
  color: inherit !important;
  text-decoration: none !important;
}

/* ====== FIM DAS CUSTOMIZAÇÕES ESSENCIAIS ====== */

/* ====== LINKS PERSONALIZADOS (apenas cor de texto normal, sem cor customizada) ====== */
.removeremail-modal-custom-link, .removeremail-modal-custom-link:visited, .removeremail-modal-custom-link:active {
  color: inherit !important;
  text-decoration: none !important;
}
.removeremail-modal-custom-link:hover, .removeremail-modal-custom-link:focus {
  color: inherit !important;
  text-decoration: underline !important;
  background: none !important;
}
/* FIM: Links personalizados sem cor customizada */

.removeremail-modal-input,
.form-control {
    color: var(--removeremail-field-text);
    background: var(--removeremail-field-bg);
    border-color: var(--removeremail-field-border);
}

/* Animação de shake para erro no OTP */
.otp-shake {
  animation: otp-shake 0.4s cubic-bezier(.36,.07,.19,.97) both;
}
@keyframes otp-shake {
  10%, 90% { transform: translateX(-2px); }
  20%, 80% { transform: translateX(4px); }
  30%, 50%, 70% { transform: translateX(-8px); }
  40%, 60% { transform: translateX(8px); }
}

/* Spinner visual no botão de solicitar código */
.removeremail-modal-phone-button.processing {
  position: relative;
  color: transparent !important;
}
.removeremail-modal-phone-button.processing:after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 20px;
  height: 20px;
  margin: -10px 0 0 -10px;
  border: 2px solid #25D366;
  border-top: 2px solid #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  z-index: 2;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Inputs OTP modernos */
.otp-inputs {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin-bottom: 10px;
}
.otp-input {
  width: 48px;
  height: 48px;
  font-size: 2rem;
  text-align: center;
  border-radius: 8px;
  border: 1px solid #ccc;
  transition: border-color 0.2s;
}
.otp-input:focus {
  border-color: #2271b1;
  outline: none;
  box-shadow: 0 0 0 2px #2271b133;
}
.otp-toggle-visibility {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.5rem;
  color: #2271b1;
  align-self: center;
  margin-left: 4px;
}
.otp-toggle-visibility.active span {
  color: #e74c3c;
}
/* Mensagens de feedback */
.removeremail-modal-context-message {
  color: #2271b1;
  font-size: 15px;
  margin-bottom: 10px;
  text-align: center;
}
#otp-error {
  color: #e74c3c;
  font-size: 1rem;
  margin-top: 6px;
  text-align: center;
}
/* Animação shake */
@keyframes otp-shake {
  0% { transform: translateX(0); }
  20% { transform: translateX(-8px); }
  40% { transform: translateX(8px); }
  60% { transform: translateX(-8px); }
  80% { transform: translateX(8px); }
  100% { transform: translateX(0); }
}
.otp-shake {
  animation: otp-shake 0.5s;
}
/* Responsividade */
@media (max-width: 480px) {
  .otp-input { width: 36px; height: 36px; font-size: 1.2rem; }
  .otp-inputs { gap: 4px; }
}
