/* =====================
           Reset e base
===================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    display: flex;
    min-height: 100vh;
    background-color: #f5f6fa;
    color: #333;
}

/* =====================
           Sidebar
===================== */
.sidebar {
    width: 250px;
    min-height: 100vh;
    background-color: #1e272e;
    color: #fff;
    display: flex;
    flex-direction: column;
    transition: width 0.3s;
}

.sidebar.collapsed {
    width: 70px;
}

.sidebar .title {
    font-size: 1.5rem;
    font-weight: bold;
    padding: 20px;
    text-align: center;
    border-bottom: 1px solid #333;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.sidebar.collapsed .title .title-text {
    display: none;
}

.sidebar ul {
    list-style: none;
    flex: 1;
    padding-top: 20px;
}

.sidebar ul li {
    display: flex;
    align-items: center;
    padding: 15px 20px;
    cursor: pointer;
    transition: background 0.2s;
}

.sidebar ul li i {
    margin-right: 10px;
    min-width: 20px;
    text-align: center;
}

.sidebar.collapsed ul li {
    justify-content: center;
}

.sidebar.collapsed ul li .menu-text {
    display: none;
}

.sidebar ul li:hover {
    background-color: #485460;
}

/* =====================
           Main
===================== */
.main {
    flex: 1;
    padding: 20px;
}

.main-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.main-header h1 {
    font-size: 2rem;
    font-weight: bold;
}

/* Sidebar toggle */
.sidebar-toggle {
    font-size: 1.2rem;
    cursor: pointer;
    padding: 6px 10px;
    border-radius: 6px;
    background-color: rgba(0, 0, 0, 0.05);
    color: #333;
    transition: all 0.3s ease;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

.sidebar-toggle:hover {
    background-color: rgba(55, 66, 250, 0.1);
    color: #3742fa;
    transform: scale(1.05);
}

/* =====================
           Cards
===================== */
.cards {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    margin-bottom: 20px;
}

.card {
    position: relative;
    background-color: #fff;
    flex: 1 1 calc(20% - 20px);
    min-width: 150px;
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    transition: transform 0.3s, box-shadow 0.3s;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
}

.card-icon {
    position: absolute;
    top: 15px;
    right: 15px;
    font-size: 1.5rem;
    transition: all 0.3s;
}

.card:hover .card-icon {
    transform: scale(1.2);
}

.card h2 {
    font-size: 1.5rem;
    margin-bottom: 5px;
    color: #1e272e;
}

.card p {
    font-size: 0.9rem;
    color: #636e72;
}

.card-1 .card-icon {
    color: #f39c12;
}

.card-2 .card-icon {
    color: #2980b9;
}

.card-3 .card-icon {
    color: #27ae60;
}

.card-4 .card-icon {
    color: #e74c3c;
}

.card-5 .card-icon {
    color: #2e0fdb;
}

/* Botão ver motoristas (Card 5) */
.card-5 .btn-ver-motoristas {
    margin-top: 10px;
    padding: 6px 12px;
    font-size: 13px;
    font-weight: 600;
    border: none;
    border-radius: 6px;
    background: #2980b9;
    color: #fff;
    cursor: pointer;
    transition: 0.3s;
}

.card-5 .btn-ver-motoristas:hover {
    background: #1f6391;
}

/* =====================
           Filtros
===================== */
.borda-div {
    width: 100%;
    height: 1px;
    background-color: #e1e3e7;
}

.filtros {
    display: flex;
    gap: 10px;
    margin: 20px 0;
}

.filtro-btn {
    padding: 8px 18px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    border: 2px solid transparent;
    background: transparent;
    transition: all 0.3s ease;
}

.filtro-btn.em-rota {
    border-color: #534e4e;
    color: black;
}

.filtro-btn.em-rota.active {
    background: #d6ad0a;
    border-color: #d6ad0a;
    color: white;
}

.filtro-btn.aguardando {
    border-color: #534e4e;
    color: black;
}

.filtro-btn.aguardando.active {
    background: #2980b9;
    border-color: #2980b9;
    color: white;
}

.filtro-btn.entregue {
    border-color: #534e4e;
    color: black;
}

.filtro-btn.entregue.active {
    background: #27ae60;
    border-color: #27ae60;
    color: white;
}

/* =====================
           Table
===================== */
.table-card {
    max-height: 310px;
    background-color: #fff;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

button:disabled{
    opacity: 0.40
}

table th,
table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid #eee;
}

table th {
    background-color: #f1f2f6;
    color: #1e272e;
}

.th-idCarga {
    width: 15%;
}

.th-motorista {
    width: 35%;
}

.th-nPedidos {
    width: 15%;
}

.th-status {
    width: 15%;
}

.th-acoes {
    width: 40%;
    text-align: center;
}

.td-acoes {
    width: 40%;    
    text-align: center;
}

.w-full{
    display: flex;
    width: 100%;
}

.justify-end{
    justify-content: end;
}

/* Botão ver (tabela) */
.btn {
    padding: 6px 12px;
    border: none;
    border-radius: 5px;
    cursor: pointer;    
    color: #fff;
    transition: background 0.2s;
}

.btn-indigo{
    background-color: #555bc7;
}

.btn-indigo:hover {
    background-color: #3e6dd3;
}

.ml-10{
    margin-left: 10px;
}

.btn-danger{
    background-color: #df6363ff !important;
}

.btn-danger:hover{
    background-color: #da3333ff;
}

.alert{
    display: flex;
    align-items: center;
    padding: 10px 10px;
    border-radius: 5px; 
    margin: 10px 0px;  
    width: 100%;
    color: #862929ff;
    font-size: 1rem;
}

.alert-danger{
    background-color: #f38686ff !important;
    border: 1px solid #da3333ff;
}

.d-none{
    display: none;
}

/* Badge tabela dashboard */
.badge {
    padding: 6px 20px;
    border-radius: 999px;
    font-weight: 500;
    font-size: 0.95rem;
    color: #fff;
    min-width: 120px;
    text-align: center;
    display: inline-block;
}

.badge.em-rota {
    background-color: #d6ad0a;
}

.badge.aguardando {
    background-color: #3498db;
}

.badge.entregue {
    background-color: #2ecc71;
}

/* =====================
       Modal Imagem
===================== */

.image-modal {
    display: none;
    /* inicial escondido */
    position: fixed;
    z-index: 9999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.8);
    /* fundo escuro semi-transparente */
    justify-content: center;
    align-items: center;
}

.image-modal-content {
    max-width: 90%;
    max-height: 90%;
    border-radius: 8px;
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.5);
}

.close {
    position: absolute;
    top: 20px;
    right: 35px;
    color: #fff;
    font-size: 40px;
    font-weight: bold;
    cursor: pointer;
}

/* =====================
       Modal Motoristas
===================== */

.table-motorista {
    width: 100%;
    background: #fff;
    padding: 20px;
    margin-top: 10px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    position: relative;
}

.fechar-motorista {
    position: absolute;
    top: 10px;
    right: 15px;
    font-size: 22px;
    cursor: pointer;
    color: #333;
}

/* Tabela Motoristas */
.tabela-motoristas {
    width: 100%;
    max-height: 320px;
    border-collapse: collapse;
    margin-top: 15px;
    overflow-y: auto;
}

.tabela-motoristas th,
.tabela-motoristas td {
    border: 1px solid #ddd;
    padding: 10px;
    text-align: left;
}

.tabela-motoristas th {
    background-color: #f5f5f5;
    font-weight: bold;
}

/* Badges Motoristas */
.motorista-badge {
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 12px;
    color: #fff;
    font-weight: bold;
}

.motorista-badge-green {
    background-color: #28a745;
}

.motorista-badge-blue {
    background-color: #007bff;
}

/* =====================
Modal Alterar Motorista
===================== */
/* Modal container */
.modal-alterar {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.5);
    transition: 0.3s;
}

/* Modal content box */
.modal-alterar-content {
    background-color: #f9f9f9;
    margin: 10% auto;
    padding: 20px;
    border-radius: 10px;
    width: 400px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    position: relative;
    animation: slideDown 0.3s ease-out;
}

/* Animation */
@keyframes slideDown {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Close button */
.modal-close {
    color: #aaa;
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

.modal-alterar-close:hover {
    color: #000;
}

/* Body content */
.modal-alterar-body {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.modal-alterar-body select {
    padding: 8px;
    font-size: 16px;
    border-radius: 6px;
    border: 1px solid #ccc;
}

.modal-alterar-body button {
    padding: 10px;
    font-size: 16px;
    background-color: #007bff;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: 0.2s;
}

.modal-alterar-body button:hover {
    background-color: #0056b3;
}

/* =====================
       Modal Detalhes
===================== */
.modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    justify-content: center;
    align-items: center;
    z-index: 2000;
}

.modal-content {
    background-color: #fff;
    margin: 0 20px;
    padding: 20px 24px;
    border-radius: 12px;
    width: 700px;
    max-width: calc(100% - 40px);
    max-height: 80vh;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.25);
    position: relative;
    animation: modalIn 220ms ease;
    color: #222;
    display: flex;
    flex-direction: column;
}

.close-modal {
    position: absolute;
    top: 12px;
    right: 14px;
    font-size: 1.4rem;
    cursor: pointer;
    color: #444;
    background: transparent;
    border: none;
}

.modal-title {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 12px;
    display: flex;
    align-items: baseline;
    gap: 8px;
    color: #111;
}

/* Lista de pedidos */
#modalPedidosLista {
    overflow-y: auto;
    padding-right: 5px;
    max-height: calc(80vh - 100px);
}

.pedido-card {
    border: 1px solid #ddd;
    border-radius: 10px;
    padding: 16px;
    margin-bottom: 12px;
    background: #fafafa;
    transition: box-shadow 0.2s;
}

.pedido-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

.pedido-header {
    font-weight: 700;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1.1rem;
}

.status-pill {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 999px;
    font-weight: 600;
    color: #fff;
    font-size: 0.85rem;
}

.status-pendente {
    background: #f39c12;
}

.status-rota {
    background: #3498db;
}

.status-recusado {
    background: #e74c3c;
}

.status-entregue {
    background: #2ecc71;
}

.status-ocorrencia {
    background: #9b59b6;
}

.pedido-row {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1rem;
    color: #333;
    margin: 6px 0;
}

.cliente-nome {
    font-weight: 600;
    font-size: 1.05rem;
    color: #1e272e;
}

/* Comprovantes e ocorrências */
.comprovantes-wrapper,
.ocorrencias-wrapper {
    margin-top: 10px;
}

.comprovantes-wrapper strong,
.ocorrencias-wrapper strong {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.95rem;
    margin-bottom: 6px;
}

.comprovantes {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.comprovantes img {
    width: 120px;
    height: 90px;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid #eee;
    transition: transform 0.3s ease;
    transform-origin: center center;
    cursor: pointer;
}

.comprovantes img:hover {
    transform: scale(1.05);
}

.ocorrencias {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.ocorrencia-item {
    display: flex;
    flex-direction: column;
    margin-top: 5px;
    gap: 10px;
}

.ocorrencia-text {
    display: flex;
    flex-direction: row;
}

.ocorrencia-title {
    font-size: 1rem;
    color: #333;
}

.ocorrencia-desc {
    font-weight: 600;
    font-size: 1.05rem;
    color: #1e272e;
    margin-left: 10px;
}

.ocorrencias img {
    width: 120px;
    height: 90px;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid #eee;
    transition: transform 0.14s;
}

.ocorrencias img:hover {
    transform: scale(1.05);
}

/* Loading Overlay */
#loadingOverlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.loading-spinner {
    border: 8px solid #f3f3f3;
    border-top: 8px solid #3742fa;
    border-radius: 50%;
    width: 60px;
    height: 60px;
    animation: spin 1s linear infinite;
}

.h-40{
    height: 70px;
}

.d-flex{    
    display: flex;
    align-items: center;    
}

.mt-5{
    margin-top: 8px;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

@keyframes modalIn {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* =====================
           Responsivo
===================== */
@media(max-width: 1200px) {
    .card {
        flex: 1 1 calc(50% - 15px);
    }
}

@media(max-width: 768px) {
    .sidebar {
        position: fixed;
        height: 100%;
        z-index: 1000;
        left: -250px;
    }

    .sidebar.collapsed {
        left: 0;
        width: 250px;
    }

    .main {
        margin-left: 0;
    }
}