/* Estilos específicos para a página de cadastro em lote */

/* Ajustes responsivos */
@media (max-width: 768px) {
    .item-row {
        padding: 1rem !important;
        margin-bottom: 1rem !important;
    }

    .item-row .col-md-1,
    .item-row .col-md-2,
    .item-row .col-md-4 {
        padding-bottom: 0.5rem;
    }

    .campo-total {
        font-size: 0.9rem;
        padding-top: 0.375rem;
        padding-bottom: 0.375rem;
    }
}

/* Numeração dos itens */
.numero-item {
    min-width: 30px;
    display: inline-block;
    text-align: center;
}

/* Campos com erro */
.is-invalid {
    border-color: #dc3545 !important;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' width='12' height='12' fill='none' stroke='%23dc3545'%3e%3ccircle cx='6' cy='6' r='4.5'/%3e%3cpath stroke-linejoin='round' d='M5.8 3.6h.4L6 6.5z'/%3e%3ccircle cx='6' cy='8.2' r='.6' fill='%23dc3545' stroke='none'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right calc(0.375em + 0.1875rem) center;
    background-size: calc(0.75em + 0.375rem) calc(0.75em + 0.375rem);
}

/* Item com erro */
.border-danger {
    border-color: #dc3545 !important;
    border-width: 2px !important;
}

.bg-danger-light {
    background-color: rgba(220, 53, 69, 0.05) !important;
}

/* Labels obrigatórios */
.form-label.required::after {
    content: " *";
    color: #dc3545;
}

/* Animação para novos itens */
@keyframes highlightItem {
    0% { background-color: rgba(25, 135, 84, 0.1); }
    100% { background-color: transparent; }
}

.item-row.highlight {
    animation: highlightItem 2s ease-out;
}

/* Estilo para totais */
.table-active {
    background-color: rgba(13, 110, 253, 0.05) !important;
}

/* Barra fixa mobile */
.fixed-bottom {
    z-index: 1030;
}

/* Ajuste para campos numéricos */
input[type="number"] {
    text-align: right;
}

/* Placeholder melhorado */
.form-control::placeholder {
    color: #6c757d;
    opacity: 0.7;
}

/* Tooltip customizado */
[data-bs-toggle="tooltip"] {
    cursor: help;
}

/* Adicione estas regras ao arquivo CSS */

/* Estilo para contador de itens */
#contador-itens {
    font-weight: bold;
    transition: color 0.3s ease;
}

#contador-itens.text-warning {
    color: #ffc107 !important;
    animation: pulse 1.5s infinite;
}

/* Animação para contador próximo do limite */
@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.7; }
    100% { opacity: 1; }
}

/* Feedback de teclado */
.keyboard-feedback {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1060;
    animation: slideInRight 0.3s ease, fadeOut 0.3s ease 1.7s forwards;
}

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

@keyframes fadeOut {
    to { opacity: 0; }
}

/* Botão no rodapé do card */
/*
.card-body > .d-flex:last-child {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid #dee2e6;
}
 */

/* Estilo para botões de ação no alerta de sucesso */
.alert .btn-group {
    margin-top: 0.5rem;
}

.alert .btn-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.875rem;
}

/* Ajuste para mobile */
@media (max-width: 768px) {
    #mobile-contador {
        font-size: 0.875rem;
        font-weight: bold;
    }

    .fixed-bottom .btn-sm {
        padding: 0.25rem 0.5rem;
        min-width: 40px;
    }
}

/* Highlight para novo item adicionado */
.item-row.novo-item {
    animation: highlightNew 1.5s ease-out;
    border-left: 4px solid #0d6efd !important;
}

@keyframes highlightNew {
    0% {
        background-color: rgba(13, 110, 253, 0.1);
        transform: translateX(-5px);
    }
    50% {
        background-color: rgba(13, 110, 253, 0.05);
        transform: translateX(0);
    }
    100% {
        background-color: transparent;
    }
}

/* Estilo para kbd (teclas do teclado) */
kbd {
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 0.25rem;
    padding: 0.1rem 0.3rem;
    font-size: 0.875em;
    font-family: monospace;
    box-shadow: 0 1px 1px rgba(0,0,0,0.1);
}

.tecla-ctrl,
.tecla-enter {
    background-color: #343a40 !important; /* Cor escura para melhor contraste */
    color: #ffffff !important;
    border: 1px solid #495057 !important;
    border-radius: 0.25rem !important;
    padding: 0.1rem 0.4rem !important;
    font-size: 0.85em !important;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif !important;
    font-weight: 600 !important;
    box-shadow: 0 2px 3px rgba(0,0,0,0.2) !important;
    text-shadow: 0 1px 1px rgba(0,0,0,0.3) !important;
    margin: 0 2px !important;
}

/* Estilo específico para cada tecla (opcional) */
.tecla-ctrl {
    background-color: #495057 !important;
}

.tecla-enter {
    background-color: #0d6efd !important;
    border-color: #0a58ca !important;
}

/* Hover nas teclas (para melhor feedback) */
.tecla-ctrl:hover,
.tecla-enter:hover {
    transform: translateY(-1px);
    box-shadow: 0 3px 4px rgba(0,0,0,0.25) !important;
}

/* CORREÇÃO 2: Estilo para foco no novo campo */
.campo-descricao:focus {
    border-color: #0d6efd !important;
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25) !important;
    outline: none !important;
}

/* Animação de foco suave */
@keyframes pulseFocus {
    0% { box-shadow: 0 0 0 0 rgba(13, 110, 253, 0.7); }
    70% { box-shadow: 0 0 0 6px rgba(13, 110, 253, 0); }
    100% { box-shadow: 0 0 0 0 rgba(13, 110, 253, 0); }
}

.campo-descricao.focado {
    animation: pulseFocus 1s ease-out;
}



/* Estilo para quando o campo está pronto para digitação */
.campo-pronto {
    border-color: #198754 !important;
    background-color: rgba(25, 135, 84, 0.05) !important;
}

/* Feedback visual para atalho de teclado usado */
.feedback-atalho {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1060;
    background: linear-gradient(135deg, #0d6efd, #198754);
    color: white;
    padding: 10px 15px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    display: flex;
    align-items: center;
    animation: slideInRight 0.3s ease, fadeOut 0.3s ease 1.7s forwards;
}

.feedback-atalho i {
    margin-right: 8px;
    font-size: 1.2em;
}

/* Ajuste para o texto das teclas em diferentes tamanhos de tela */
@media (max-width: 576px) {
    .tecla-ctrl,
    .tecla-enter {
        padding: 0.08rem 0.3rem !important;
        font-size: 0.8em !important;
    }

    .text-muted.small {
        font-size: 0.75rem !important;
    }
}

/* Melhor visibilidade do placeholder nos campos */
.campo-descricao::placeholder {
    color: #6c757d;
    opacity: 0.8;
    font-style: italic;
}

/* Transição suave para foco */
.campo-descricao,
.campo-observacao,
.campo-quantidade,
.campo-unitario {
    transition: all 0.2s ease-in-out;
}

/* Estilo para o botão de adicionar item quando em foco */
#btn-adicionar-item:focus {
    box-shadow: 0 0 0 0.25rem rgba(25, 135, 84, 0.5) !important;
}

/* Ajuste para a dica de atalho no rodapé */
/*
.card-body > .d-flex:last-child {
    background-color: #f8f9fa;
    border-radius: 0.375rem;
    padding: 0.75rem 1rem;
    margin-top: 1.5rem;
}
*/

/* Estilos para o breadcrumb */
.breadcrumb {
    background-color: transparent;
    padding: 0.75rem 0;
    margin-bottom: 1rem;
    border-radius: 0;
    border-bottom: 1px solid #e9ecef;
}

.breadcrumb-item {
    font-size: 0.9rem;
}

.breadcrumb-item a {
    color: #6c757d;
    text-decoration: none;
    transition: color 0.2s ease;
}

.breadcrumb-item a:hover {
    color: #0d6efd;
    text-decoration: underline;
}

.breadcrumb-item.active {
    color: #495057;
    font-weight: 600;
}

.breadcrumb-item + .breadcrumb-item::before {
    color: #adb5bd;
    content: "›";
    font-size: 1.2em;
    padding: 0 0.5rem;
}

/* Ajustes responsivos para breadcrumb */
@media (max-width: 768px) {
    .breadcrumb {
        padding: 0.5rem 0;
        font-size: 0.85rem;
    }

    .breadcrumb-item + .breadcrumb-item::before {
        padding: 0 0.3rem;
    }
}

/* Estilo para o badge "Novo" no título */
.badge.bg-info {
    font-size: 0.7rem;
    padding: 0.2rem 0.5rem;
    vertical-align: middle;
    margin-left: 0.5rem;
}

/* Estilos para ícones nos labels */
.form-label i {
    width: 16px;
    text-align: center;
}

/* Contador no header do card */
#contador-itens-header {
    font-weight: 600;
}

/* Ajuste para tooltips */
[data-bs-toggle="tooltip"] {
    cursor: help;
}

/* Melhorias visuais para os cards */
.card-header.bg-primary {
    border-bottom: none;
}

.card-header.bg-primary h5 {
    font-weight: 600;
}

/* Ajuste para a barra fixa mobile */
.fixed-bottom {
    box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
}