/* Importando uma fonte moderna do Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;500;700&display=swap');

/* Variáveis de cor para o tema Bumax */
:root {
    --bumax-orange: #f37021;
    --bumax-dark-bg: #212529;
    --bumax-card-bg: rgba(0, 0, 0, 0.6);
    --bumax-light-text: #f8f9fa;
    --bumax-muted-text: #adb5bd;
}

body {
    font-family: 'Roboto', sans-serif;
    background-color: #f4f6f9; /* Cor de fundo padrão para o dashboard */
}

/* --- Estilos da Página de Login --- */
.login-page {
    background-color: var(--bumax-dark-bg);
    background-image: url('https://images.unsplash.com/photo-1579546929518-9e396f3a8034?q=80&w=2070&auto=format&fit=crop'); /* Imagem de fundo genérica */
    background-size: cover;
    background-position: center;
    background-blend-mode: overlay; /* Efeito para escurecer a imagem */
    color: var(--bumax-light-text);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
}

.login-container {
    background-color: var(--bumax-card-bg);
    padding: 2.5rem;
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    width: 100%;
    max-width: 450px;
    backdrop-filter: blur(5px); /* Efeito de vidro fosco */
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.login-logo {
    max-width: 200px; /* Ajuste o tamanho da logo conforme necessário */
    margin-bottom: 2rem;
}

.login-container h2 {
    font-weight: 300;
    margin-bottom: 2rem;
}

.form-control-dark {
    background-color: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: var(--bumax-light-text);
}

.form-control-dark:focus {
    background-color: rgba(255, 255, 255, 0.2);
    border-color: var(--bumax-orange);
    color: var(--bumax-light-text);
    box-shadow: 0 0 0 0.25rem rgba(243, 112, 33, 0.25);
}

.form-control-dark::placeholder {
    color: var(--bumax-muted-text);
}

.btn-login {
    background-color: var(--bumax-orange);
    border-color: var(--bumax-orange);
    color: #fff;
    padding: 0.75rem;
    font-weight: 500;
    transition: all 0.3s ease;
}

.btn-login:hover {
    background-color: #d8601a;
    border-color: #d8601a;
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(243, 112, 33, 0.3);
}

/* --- Estilos do Navbar e Dashboard --- */
.navbar-custom {
    background-color: var(--bumax-dark-bg);
}

.navbar-custom .navbar-brand,
.navbar-custom .nav-link,
.navbar-custom .navbar-text {
    color: var(--bumax-light-text);
}

.navbar-custom .nav-link.active,
.navbar-custom .nav-link:hover {
    color: var(--bumax-orange);
}

.navbar-custom .navbar-brand:hover {
    color: #fff;
}

.btn-logout {
    border-color: var(--bumax-orange);
    color: var(--bumax-orange);
}

.btn-logout:hover {
    background-color: var(--bumax-orange);
    color: #fff;
}

/* Ajustes gerais para a tabela no dashboard */
.table-responsive {
    max-height: 70vh;
}
.table th {
    position: sticky;
    top: 0;
    z-index: 1;
}
.badge {
    font-size: 0.8rem;
}

.btn-primary {
    background-color: var(--bumax-orange);
    border-color: var(--bumax-orange);
}
.btn-primary:hover {
    background-color: #d8601a;
    border-color: #d8601a;
}

/* Animações de Piscar para Linhas da Tabela (dashboard) */
@keyframes blink-danger-row {
    0%, 100% { background-color: var(--bs-table-bg-state, var(--bs-table-bg)); } /* Usa a cor de fundo atual da linha (ex: table-danger) */
    50% { background-color: rgba(220, 53, 69, 0.2); } /* Vermelho claro semi-transparente para o flash */
}

@keyframes blink-warning-row {
    0%, 100% { background-color: var(--bs-table-bg-state, var(--bs-table-bg)); } /* Usa a cor de fundo atual da linha (ex: table-warning) */
    50% { background-color: rgba(255, 193, 7, 0.2); } /* Amarelo claro semi-transparente para o flash */
}

/* Aplica a animação específica à linha da tabela */
.blinking-row.table-danger {
    animation: blink-danger-row 1.5s infinite alternate; /* Alternate para um fade suave */
}

.blinking-row.table-warning {
    animation: blink-warning-row 1.5s infinite alternate;
}

/* Para o texto "Situação Prazo" em si, se ele precisar piscar independentemente da linha */
@keyframes blink-text {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}
.blinking-status-text {
    animation: blink-text 1s infinite;
}

/* Estilos para o modal de alerta (linhas dentro dele) */
#alertasEntregasModal .modal-body .table .blinking-row {
    animation: blink-warning-row 1.5s infinite alternate; /* Use a animação de aviso para o modal de alerta, pois já é amarelo */
}

/* --- Estilos para o Ícone de Agendamento --- */
.agendamento-icon {
    margin-left: 5px; /* Espaçamento do texto */
    color: #17a2b8; /* Cor info (azul claro) */
    cursor: pointer; /* Indica que é clicável */
    transition: color 0.3s ease;
}

.agendamento-icon:hover {
    color: #0c5460; /* Azul escuro no hover */
}

@keyframes blink-agendamento-icon {
    0%, 100% { color: #17a2b8; } /* Cor info (azul claro) */
    50% { color: #0c5460; } /* Azul escuro no meio do ciclo */
}

.agendamento-icon.blinking-icon {
    animation: blink-agendamento-icon 1.2s infinite alternate;
}

/* === ESTILOS PARA TIMELINE DO HISTÓRICO === */
.timeline {
    position: relative;
    padding: 20px 0;
}

.timeline::before {
    content: '';
    position: absolute;
    top: 0;
    left: 30px;
    height: 100%;
    width: 2px;
    background: #dee2e6;
}

.timeline-item {
    position: relative;
    padding-left: 60px;
    padding-bottom: 20px;
}

.timeline-item::before {
    content: '';
    position: absolute;
    left: 24px;
    top: 5px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #6c757d;
    border: 2px solid #fff;
    box-shadow: 0 0 0 2px #dee2e6;
}

.timeline-item.created::before {
    background: #28a745;
    box-shadow: 0 0 0 2px #28a745;
}

.timeline-item.updated::before {
    background: #17a2b8;
    box-shadow: 0 0 0 2px #17a2b8;
}

.timeline-item.status-change::before {
    background: #ffc107;
    box-shadow: 0 0 0 2px #ffc107;
}

.timeline-item.deleted::before {
    background: #dc3545;
    box-shadow: 0 0 0 2px #dc3545;
}

.timeline-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f8f9fa;
    padding: 10px 15px;
    border-radius: 5px;
    margin-bottom: 10px;
    border-left: 3px solid #6c757d;
}

.timeline-item.created .timeline-header {
    border-left-color: #28a745;
}

.timeline-item.status-change .timeline-header {
    border-left-color: #ffc107;
}

.timeline-action {
    font-weight: bold;
    color: #343a40;
    font-size: 1.1em;
}

.timeline-user {
    font-size: 0.9em;
    color: #6c757d;
    margin-top: 5px;
}

.timeline-date {
    font-size: 0.85em;
    color: #6c757d;
    white-space: nowrap;
}

.timeline-details {
    background: #fff;
    border: 1px solid #dee2e6;
    border-radius: 5px;
    padding: 15px;
    margin-left: 15px;
}

.change-detail {
    margin-bottom: 10px;
}

.change-detail:last-child {
    margin-bottom: 0;
}

.old-value {
    color: #dc3545;
    text-decoration: line-through;
    font-style: italic;
}

.new-value {
    color: #28a745;
    font-weight: bold;
}

.change-arrow {
    color: #6c757d;
    margin: 0 10px;
}

/* Ficha de Entrega para Impressão */
.entrega-ficha {
    background: #fff;
    padding: 20px;
    border: 1px solid #dee2e6;
    border-radius: 5px;
}

.ficha-header {
    border-bottom: 2px solid #343a40;
    padding-bottom: 15px;
    margin-bottom: 20px;
}

.ficha-section {
    margin-bottom: 20px;
}

.ficha-section h6 {
    color: #007bff;
    border-bottom: 1px solid #dee2e6;
    padding-bottom: 5px;
    margin-bottom: 15px;
}

/* === ESTILOS PARA IMPRESSÃO === */
@media print {
    body {
        font-size: 12pt;
        color: #000;
        background: #fff;
    }
    
    /* Esconder elementos não necessários na impressão */
    .navbar, .btn, .modal-footer, #btn-print-relatorio {
        display: none !important;
    }
    
    /* Mostrar apenas o conteúdo do modal */
    .modal {
        position: static !important;
        display: block !important;
    }
    
    .modal-backdrop {
        display: none !important;
    }
    
    .modal-dialog {
        margin: 0 !important;
        max-width: 100% !important;
    }
    
    .modal-content {
        border: none !important;
        box-shadow: none !important;
    }
    
    /* Timeline para impressão */
    .timeline::before {
        background: #000 !important;
    }
    
    .timeline-item::before {
        border-color: #000 !important;
        print-color-adjust: exact;
        -webkit-print-color-adjust: exact;
    }
    
    .timeline-header {
        background: #f0f0f0 !important;
        print-color-adjust: exact;
        -webkit-print-color-adjust: exact;
    }
    
    /* Quebra de página */
    .page-break {
        page-break-before: always;
    }
    
    /* Cabeçalho de impressão */
    @page {
        margin: 1cm;
    }
}

/* Loader para carregamento */
.timeline-loader {
    text-align: center;
    padding: 40px;
}

.timeline-loader .spinner-border {
    width: 3rem;
    height: 3rem;
}

/* === ESTILOS PARA SISTEMA DE WHATSAPP === */
.btn-whatsapp-entrega {
    background-color: #25d366;
    border-color: #25d366;
    color: white;
}

.btn-whatsapp-entrega:hover {
    background-color: #1da851;
    border-color: #1da851;
    color: white;
}

.whatsapp-message-preview {
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 15px;
    font-family: 'Courier New', monospace;
    white-space: pre-wrap;
    max-height: 300px;
    overflow-y: auto;
}

.modal-whatsapp .modal-header {
    background-color: #25d366;
    color: white;
}

.modal-whatsapp .btn-close-white {
    filter: invert(1) grayscale(100%) brightness(200%);
}

/* === ESTILOS PARA CHECKBOXES E SELEÇÃO === */
.row-checkbox {
    transform: scale(1.2);
    margin: 0;
}

#selectAllCheckboxes {
    transform: scale(1.3);
}

.table tbody tr:hover {
    background-color: rgba(0, 123, 255, 0.1);
}

.table tbody tr.selected {
    background-color: rgba(0, 123, 255, 0.2);
}

/* === ESTILOS PARA BOTÕES DE AÇÃO === */
.btn-group-sm .btn {
    padding: 0.25rem 0.5rem;
    font-size: 0.875rem;
    border-radius: 0.2rem;
}

.btn-historico-entrega {
    background-color: #17a2b8;
    border-color: #17a2b8;
    color: white;
}

.btn-historico-entrega:hover {
    background-color: #138496;
    border-color: #117a8b;
    color: white;
}

/* === ESTILOS PARA TOASTS E NOTIFICAÇÕES === */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
}

.alert-floating {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    min-width: 300px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* === ESTILOS PARA MODAIS === */
.modal-xl {
    max-width: 95%;
}

.modal-lg {
    max-width: 80%;
}

.modal-body {
    max-height: 70vh;
    overflow-y: auto;
}

/* === ESTILOS PARA TIMELINE DO HISTÓRICO (MELHORADO) === */
.timeline-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.875rem;
}

.timeline-item .card {
    border-left: 3px solid #dee2e6;
    transition: all 0.3s ease;
}

.timeline-item .card:hover {
    border-left-color: #007bff;
    box-shadow: 0 2px 8px rgba(0, 123, 255, 0.15);
}

/* === ESTILOS PARA FILTROS === */
.card-header .btn-outline-light:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.form-control:focus {
    border-color: var(--bumax-orange);
    box-shadow: 0 0 0 0.2rem rgba(243, 112, 33, 0.25);
}

.form-select:focus {
    border-color: var(--bumax-orange);
    box-shadow: 0 0 0 0.2rem rgba(243, 112, 33, 0.25);
}

/* === ESTILOS PARA BADGES DE STATUS === */
.badge {
    font-size: 0.75rem;
    font-weight: 500;
}

/* === FICHA DETALHADA === */
.status-badge-large {
    font-size: 1.2rem;
    padding: 0.5rem 1rem;
}

.dias-rota {
    font-size: 1.5rem;
    font-weight: bold;
}

.dias-rota.atrasado {
    color: #dc3545;
    animation: blink 1s infinite;
}

.dias-rota.no-prazo {
    color: #28a745;
}

@keyframes blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0.5; }
}

.observacao-item {
    border-left: 3px solid #007bff;
    padding: 10px 15px;
    margin-bottom: 10px;
    background: #f8f9fa;
    border-radius: 0 5px 5px 0;
}

.observacao-data {
    font-size: 0.8rem;
    color: #6c757d;
    font-weight: 500;
}

.observacao-cancelada {
    background: #f8d7da;
    border-left-color: #dc3545;
    opacity: 0.7;
}

.observacao-cancelada .observacao-texto {
    color: #721c24;
    font-style: italic;
}

/* === ESTILOS RESPONSIVOS === */
@media (max-width: 768px) {
    .table-responsive {
        font-size: 0.875rem;
    }
    
    .btn-group-sm .btn {
        padding: 0.125rem 0.25rem;
        font-size: 0.75rem;
    }
    
    .modal-lg {
        max-width: 95%;
    }
    
    .timeline-item {
        padding-left: 40px;
    }
    
    .timeline::before {
        left: 20px;
    }
    
    .timeline-item::before {
        left: 14px;
    }
}

/* === ESTILOS PARA LOADING === */
.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.spinner-border-lg {
    width: 3rem;
    height: 3rem;
}

/* === ANIMAÇÕES ADICIONAIS === */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.fade-in {
    animation: fadeIn 0.3s ease-out;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

.pulse {
    animation: pulse 2s infinite;
}
    color: #28a745;
}

.rastreio-step.current .rastreio-label {
    color: #007bff;
    font-weight: 700;
}

.rastreio-step.problem .rastreio-label {
    color: #dc3545;
    font-weight: 700;
}

.rastreio-date {
    font-size: 12px;
    color: #6c757d;
    background: #f8f9fa;
    padding: 4px 10px;
    border-radius: 12px;
    font-weight: 500;
}

.rastreio-step.completed .rastreio-date {
    background: rgba(40, 167, 69, 0.1);
    color: #28a745;
}

.rastreio-step.problem .rastreio-date {
    background: rgba(220, 53, 69, 0.1);
    color: #dc3545;
}

/* Alerta de problema */
.rastreio-alert {
    background: linear-gradient(135deg, #dc3545, #c82333);
    color: white;
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 25px;
    display: flex;
    align-items: center;
    box-shadow: 0 6px 20px rgba(220, 53, 69, 0.3);
}

.rastreio-alert i {
    font-size: 24px;
    margin-right: 15px;
    animation: alertShake 2s infinite;
}

.rastreio-alert-text {
    flex: 1;
}

.rastreio-alert-title {
    font-weight: 700;
    font-size: 16px;
    margin-bottom: 5px;
}

.rastreio-alert-desc {
    font-size: 14px;
    opacity: 0.9;
}

/* Animações */
@keyframes currentPulse {
    0% { transform: scale(1.1); }
    50% { transform: scale(1.15); }
    100% { transform: scale(1.1); }
}

@keyframes problemPulse {
    0% { transform: scale(1.1); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1.1); }
}

@keyframes alertShake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-3px); }
    20%, 40%, 60%, 80% { transform: translateX(3px); }
}

/* === ESTILOS RESPONSIVOS === */
@media (max-width: 768px) {
    .table-responsive {
        font-size: 0.875rem;
    }
    
    .btn-group-sm .btn {
        padding: 0.125rem 0.25rem;
        font-size: 0.75rem;
    }
    
    .modal-lg {
        max-width: 95%;
    }
    
    .timeline-item {
        padding-left: 40px;
    }
    
    .timeline::before {
        left: 20px;
    }
    
    .timeline-item::before {
        left: 14px;
    }
}

/* === ESTILOS PARA LOADING === */
.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.spinner-border-lg {
    width: 3rem;
    height: 3rem;
}

/* === ANIMAÇÕES ADICIONAIS === */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.fade-in {
    animation: fadeIn 0.3s ease-out;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

.pulse {
    animation: pulse 2s infinite;
}