﻿/* cep-input.css - Versão atualizada com melhor controle do botão desabilitado */
/* Mantendo o layout original, apenas melhorando a harmonia visual */

/* Container principal do formulário CEP */
.cep-form-container {
    display: flex;
    flex-direction: column;
}

/* Ajuste do container para acomodar o feedback */
.cep-input-container {
    position: relative;
    flex-grow: 1;
}

.cep-input {
    padding-left: 2.75rem !important;
    padding-right: 1rem !important;
    border-radius: 50rem 0 0 50rem !important;
    border: none !important; /* Remove a borda */
    transition: all 0.25s ease;
    font-size: 1rem;
    height: 42px;
    background: #ffffff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    font-weight: 400;
}

    .cep-input:focus {
        border: none !important; /* Mantém sem borda no focus */
        box-shadow: 0 0 0 0.2rem rgba(23, 162, 184, 0.2);
        outline: none;
        background: #ffffff;
    }

    .cep-input:hover:not(:focus):not(:disabled) {
        border: none !important; /* Remove borda no hover também */
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.12);
    }

.cep-icon {
    position: absolute;
    left: 0.875rem;
    top: 50%;
    transform: translateY(-50%);
    color: #6c757d;
    z-index: 3;
    pointer-events: none;
    font-size: 1rem;
    transition: color 0.25s ease;
}

.cep-input:focus + .cep-icon {
    color: #17a2b8;
}

.cep-input.is-valid {
    border: none !important; /* Remove borda mesmo quando válido */
    padding-right: 2.5rem !important;
    background: #ffffff;
    box-shadow: 0 0 0 0.15rem rgba(40, 167, 69, 0.2); /* Sombra verde sutil */
}

    .cep-input.is-valid:focus {
        border: none !important;
        box-shadow: 0 0 0 0.2rem rgba(40, 167, 69, 0.2);
    }

.cep-input.is-invalid {
    border: none !important; /* Remove borda mesmo quando inválido */
    padding-right: 2.5rem !important;
    background: #ffffff;
    box-shadow: 0 0 0 0.15rem rgba(220, 53, 69, 0.2); /* Sombra vermelha sutil */
}

    .cep-input.is-invalid:focus {
        border: none !important;
        box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.2);
    }

/* Ícones de validação posicionados corretamente */
.cep-input-container.valid::after {
    content: '✓';
    position: absolute;
    right: 0.875rem;
    top: 50%;
    transform: translateY(-50%);
    color: #28a745;
    font-weight: bold;
    font-size: 1.1rem;
    pointer-events: none;
    z-index: 4;
}

.cep-input-container.invalid::after {
    content: '✗';
    position: absolute;
    right: 0.875rem;
    top: 50%;
    transform: translateY(-50%);
    color: #dc3545;
    font-weight: bold;
    font-size: 1.1rem;
    pointer-events: none;
    z-index: 4;
}

.cep-feedback {
    font-size: 0.8rem;
    margin-top: 0.5rem;
    min-height: 1rem;
    display: block;
    font-weight: 500;
    text-align: left;
    padding-left: 0.875rem; /* Alinha com o texto do input */
    transition: all 0.3s ease;
    text-shadow: 2px 0 #ffffff, -2px 0 #ffffff, 0 2px #ffffff, 0 -2px #ffffff, 1px 1px #ffffff, -1px -1px #ffffff, 1px -1px #ffffff, -1px 1px #ffffff;
}

.valid-feedback {
    color: #28a745;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

    .valid-feedback::before {
        content: '✓';
        font-weight: bold;
        font-size: 0.9rem;
    }

.invalid-feedback {
    color: #dc3545;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

    .invalid-feedback::before {
        content: '⚠';
        font-weight: bold;
        font-size: 0.9rem;
    }

/* Botão harmonizado com o input - VERSÃO ATUALIZADA COM MELHOR CONTROLE DE ESTADO DESABILITADO */
.btn-search-cep {
    border-radius: 0 50rem 50rem 0 !important;
    min-width: 100px;
    height: 42px; /* Mesma altura do input */
    border: 2px solid #013819;
    background: #013819 !important;
    color: #ffffff !important;
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.25s ease;
    box-shadow: 0 1px 3px rgba(23, 162, 184, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    position: relative;
    overflow: hidden;
}

    .btn-search-cep:hover:not(:disabled) {
        background: #138496 !important;
        border-color: #138496;
        transform: translateY(-1px);
        box-shadow: 0 2px 6px rgba(23, 162, 184, 0.4);
        color: #ffffff !important;
    }

    .btn-search-cep:active:not(:disabled) {
        transform: translateY(0);
        box-shadow: 0 1px 3px rgba(23, 162, 184, 0.3);
    }

    /* Estado desabilitado aprimorado */
    .btn-search-cep:disabled {
        opacity: 0.5 !important;
        cursor: not-allowed !important;
        transform: none !important;
        background: #6c757d !important;
        border-color: #6c757d !important;
        box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1) !important;
        pointer-events: none !important; /* Impede qualquer interação */
        color: #ffffff !important;
        transition: none !important; /* Remove transições para estado mais definitivo */
    }

        /* Garantir que o estado desabilitado não mude com hover */
        .btn-search-cep:disabled:hover,
        .btn-search-cep:disabled:focus,
        .btn-search-cep:disabled:active {
            transform: none !important;
            background: #6c757d !important;
            border-color: #6c757d !important;
            box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1) !important;
            opacity: 0.5 !important;
            color: #ffffff !important;
        }

        /* Overlay visual para estado desabilitado */
        .btn-search-cep:disabled::before {
            content: '';
            position: absolute;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background: rgba(255, 255, 255, 0.1);
            pointer-events: none;
        }

/* Alinhamento perfeito entre input e botão */
.d-flex .cep-input-container {
    display: flex;
    align-items: stretch;
}

.d-flex .btn-search-cep {
    border-left: none;
    margin-left: -1px; /* Remove gap entre input e botão */
}

/* Estilos para área de scroll dos PDVs */
.scroll-pdv {
    max-height: 500px;
    display: flex;
    flex-direction: column;
    align-items: center;
    overflow-y: auto;
}

/* Responsive adjustments mantendo as proporções */
@media (max-width: 768px) {
    .cep-input {
        height: 40px;
        font-size: 0.95rem;
        padding-left: 2.5rem !important;
    }

    .btn-search-cep {
        height: 40px;
        min-width: 85px;
        font-size: 0.85rem;
    }

    .cep-icon {
        left: 0.75rem;
        font-size: 0.95rem;
    }

    .cep-feedback {
        font-size: 0.75rem;
        margin-top: 0.4rem;
        padding-left: 0.75rem;
    }
}

@media (max-width: 576px) {
    .btn-search-cep {
        min-width: 75px;
        font-size: 0.8rem;
    }
}

/* Loading state */
.cep-input:disabled {
    background-color: #f8f9fa;
    opacity: 0.7;
    cursor: not-allowed;
    border: none !important; /* Mantém sem borda quando disabled */
}

    .cep-input:disabled + .cep-icon {
        color: #adb5bd;
    }

/* Placeholder harmonioso */
.cep-input::placeholder {
    color: #adb5bd;
    opacity: 0.8;
    font-style: italic;
    font-weight: 400;
}

/* Suavidade geral */
* {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Adicional: Garantir que spinners dentro do botão desabilitado também sejam visíveis */
.btn-search-cep:disabled .spinner-border {
    border-color: rgba(255, 255, 255, 0.7);
    border-right-color: transparent;
}
