/**
 * Estilos para o popup de seleção de estado e tipo de cliente
 */

/* Reposiciona o badge do reCAPTCHA para evitar conflito com WhatsApp */
.grecaptcha-badge {
    bottom: 110px !important; /* Ajustado para ficar acima do botão WhatsApp */
    left: auto !important; /* Garante que fique à direita */
    z-index: 1 !important;
}

/* Link para alterar preferências */
.perlima-change-preferences {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 999998;
    background: #fff;
    border: 1px solid #c3c4c7;
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    padding: 12px 16px;
    font-size: 14px;
    max-width: 300px;
}

.perlima-current-selection {
    display: flex;
    align-items: center;
    gap: 12px;
}

.perlima-selection-text {
    color: #1d2327;
    font-weight: 500;
    flex: 1;
}

.perlima-change-btn {
    background: #2271b1;
    color: #fff;
    border: none;
    border-radius: 4px;
    padding: 6px 12px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.perlima-change-btn:hover {
    background: #135e96;
}

.perlima-popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 999999;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
}

.perlima-popup-content {
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    padding-top: 20px;
    animation: perlima-popup-fade-in 0.3s ease-out;
}

@keyframes perlima-popup-fade-in {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.perlima-popup-header {
    padding: 30px 50px 20px 30px;
    text-align: center;
    border-bottom: 1px solid #e1e5e9;
    position: relative;
}

.perlima-popup-close {
    position: absolute;
    top: 0;
    right: 15px;
    background: rgba(255, 255, 255, 0.9);
    border: 2px solid #e1e5e9;
    font-size: 16px;
    color: #7f8c8d;
    cursor: pointer;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
    font-weight: bold;
    line-height: 1;
    z-index: 10;
}

.perlima-popup-close:hover {
    background: #fff;
    color: #2c3e50;
    border-color: #c3c4c7;
    transform: scale(1.1);
}

.perlima-popup-header h2 {
    margin: 0 0 10px 0;
    font-size: 24px;
    font-weight: 600;
    color: #2c3e50;
    line-height: 1.3;
}

.perlima-popup-header p {
    margin: 0;
    font-size: 16px;
    color: #7f8c8d;
    line-height: 1.5;
}

.perlima-popup-form {
    padding: 30px;
}

.perlima-form-group {
    margin-bottom: 25px;
}

.perlima-form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #2c3e50;
    font-size: 14px;
}

.perlima-form-group select {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e1e5e9;
    border-radius: 8px;
    font-size: 16px;
    background-color: #ffffff;
    color: #2c3e50;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6,9 12,15 18,9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px;
    padding-right: 40px;
}

.perlima-form-group select:focus {
    outline: none;
    border-color: #be2126;
    box-shadow: 0 0 0 3px rgba(190, 33, 38, 0.1);
}

.perlima-form-group select:invalid {
    border-color: #e74c3c;
}

/* Estilos para campos de texto */
.perlima-form-group input[type="text"],
.perlima-form-group input[type="email"],
.perlima-form-group input[type="tel"] {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e1e5e9;
    border-radius: 8px;
    font-size: 16px;
    background-color: #ffffff;
    color: #2c3e50;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
    box-sizing: border-box;
}

.perlima-form-group input[type="text"]:focus,
.perlima-form-group input[type="email"]:focus,
.perlima-form-group input[type="tel"]:focus {
    outline: none;
    border-color: #be2126;
    box-shadow: 0 0 0 3px rgba(190, 33, 38, 0.1);
}

.perlima-form-group input[type="text"]:invalid,
.perlima-form-group input[type="email"]:invalid,
.perlima-form-group input[type="tel"]:invalid {
    border-color: #e74c3c;
}

/* Estilos para captcha */
.perlima-captcha-container {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.perlima-captcha-text {
    background: #f8f9fa;
    border: 2px solid #e1e5e9;
    border-radius: 6px;
    padding: 8px 12px;
    font-family: 'Courier New', monospace;
    font-size: 18px;
    font-weight: bold;
    color: #2c3e50;
    letter-spacing: 2px;
    user-select: none;
    min-width: 80px;
    text-align: center;
}

.perlima-captcha-refresh {
    background: #2271b1;
    color: #fff;
    border: none;
    border-radius: 4px;
    padding: 8px 12px;
    font-size: 14px;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.perlima-captcha-refresh:hover {
    background: #135e96;
}

/* Transições suaves para mudanças de labels */
.perlima-form-group label {
    transition: all 0.2s ease;
}

.perlima-form-group input {
    transition: all 0.2s ease;
}

/* Estilos para campos com erro */
.perlima-field-error {
    border-color: #e74c3c !important;
    box-shadow: 0 0 0 3px rgba(231, 76, 60, 0.1) !important;
}

.perlima-field-error-message {
    color: #e74c3c;
    font-size: 12px;
    margin-top: 5px;
    font-weight: 500;
}

/* Animação para campos limpos */
.perlima-field-cleared {
    animation: perlima-field-clear 0.3s ease-out;
}

/* Animação para campos restaurados */
.perlima-field-restored {
    animation: perlima-field-restore 0.3s ease-out;
}

@keyframes perlima-field-clear {
    0% {
        background-color: #fff3cd;
        border-color: #ffeaa7;
    }
    100% {
        background-color: #ffffff;
        border-color: #e1e5e9;
    }
}

@keyframes perlima-field-restore {
    0% {
        background-color: #d4edda;
        border-color: #c3e6cb;
    }
    100% {
        background-color: #ffffff;
        border-color: #e1e5e9;
    }
}

.perlima-form-actions {
    text-align: center;
    margin-top: 30px;
}

.perlima-btn {
    display: inline-block;
    padding: 14px 28px;
    font-size: 16px;
    font-weight: 600;
    text-decoration: none;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 140px;
}

.perlima-btn-primary {
    background-color: #be2126;
    color: #ffffff;
}

.perlima-btn-primary:hover {
    background-color: #a01d21;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(190, 33, 38, 0.3);
}

.perlima-btn-primary:active {
    transform: translateY(0);
}

.perlima-btn-primary:disabled {
    background-color: #bdc3c7;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Responsividade */
@media (max-width: 768px) {
    .perlima-popup-content {
        width: 95%;
        margin: 20px;
    }
    
    .perlima-popup-header {
        padding: 25px 20px 15px;
    }
    
    .perlima-popup-header h2 {
        font-size: 20px;
    }
    
    .perlima-popup-header p {
        font-size: 14px;
    }
    
    .perlima-popup-form {
        padding: 20px;
    }
    
    .perlima-form-group {
        margin-bottom: 20px;
    }
    
    .perlima-form-group select {
        padding: 10px 14px;
        font-size: 14px;
    }
    
    .perlima-btn {
        padding: 12px 24px;
        font-size: 14px;
        min-width: 120px;
    }
}

@media (max-width: 480px) {
    .perlima-popup-content {
        width: 100%;
        height: 100%;
        border-radius: 0;
        max-height: none;
    }
    
    .perlima-popup-header {
        padding: 20px 15px 15px;
    }
    
    .perlima-popup-form {
        padding: 15px;
    }
}

/* Estados de loading */
.perlima-loading {
    position: relative;
    pointer-events: none;
}

.perlima-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #ffffff;
    border-top: 2px solid transparent;
    border-radius: 50%;
    animation: perlima-spin 1s linear infinite;
}

@keyframes perlima-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Acessibilidade */
.perlima-popup-overlay:focus-within {
    outline: none;
}

.perlima-form-group select:focus-visible {
    outline: 2px solid #be2126;
    outline-offset: 2px;
}

/* Animações suaves */
.perlima-popup-overlay {
    transition: opacity 0.3s ease;
}

.perlima-popup-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

/* Melhorias para temas escuros */
@media (prefers-color-scheme: dark) {
    .perlima-popup-content {
        background: #2c3e50;
        color: #ecf0f1;
    }
    
    .perlima-popup-header {
        border-bottom-color: #34495e;
    }
    
    .perlima-popup-header h2 {
        color: #ecf0f1;
    }
    
    .perlima-popup-header p {
        color: #bdc3c7;
    }
    
    .perlima-form-group label {
        color: #ecf0f1;
    }
    
    .perlima-form-group select {
        background-color: #34495e;
        border-color: #34495e;
        color: #ecf0f1;
    }
    
    .perlima-form-group select:focus {
        border-color: #be2126;
        background-color: #34495e;
    }
}
