/* css/styles.css - Versão Final Corrigida (Layout do Item) */

/* ============================== */
/* 🔹 VARIÁVEIS CSS - CORES DO DEMIPLIÉ */
/* ============================== */
:root {
    --primary-color: #E5B5B3;
    --primary-hover: #d9a5a3;
    --primary-light: #f2e4e3;
    --secondary-color: #FFF7F5;
    --accent-color: #d4989a;
    --text-dark: #282c34;
    --text-medium: #6B6B6B;
    --text-light: #8A8A8A;
    --success-color: #52C41A;
    --danger-color: #FF4D4F;
    --warning-color: #FAAD14;
    --info-color: #1890FF;
    --light-gray: #F5F5F5;
    --border-color: #E8E8E8;
    --border-light: #F0F0F0;
    --text-muted: #999999;
    --shadow: 0 2px 8px rgba(0,0,0,0.06);
    --shadow-hover: 0 4px 16px rgba(0,0,0,0.12);
    --border-radius: 6px;
    --border-radius-lg: 8px;
}

/* ============================== */
/* 🔹 RESET E FORMATAÇÃO GERAL */
/* ============================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--secondary-color);
    color: var(--text-dark);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    font-size: 14px;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 24px;
}

h1, h2, h3 {
    margin-bottom: 1rem;
    color: var(--text-dark);
    font-weight: 600;
    letter-spacing: -0.025em;
}

h1 {
    font-size: 24px;
    text-align: center;
    margin-bottom: 2rem;
    color: var(--text-dark);
    font-weight: 700;
}

h2 {
    font-size: 18px;
    color: var(--text-dark);
    margin-bottom: 1rem;
    font-weight: 600;
}

h3 {
    font-size: 16px;
    font-weight: 600;
}

/* ============================== */
/* 🔹 NAVBAR DEMIPLIÉ STYLE */
/* ============================== */
.navbar {
  background-color: #E5B5B3;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 20px;
  min-height: 60px;
  width: 100%;
  position: fixed;
  top: 0;
  left: 0;
  z-index: 1000;
}

.navbar-left {
  display: flex;
  align-items: center;
}

.navbar-logo {
  height: 35px;
  margin-right: 15px;
}

.navbar-header {
    display: flex;
    align-items: center;
    gap: 10px;  
}

.navbar-title {
    font-size: 1.19rem;
    font-weight: 400;
    color: var(--secondary-color);
    letter-spacing: -0.02em;
    margin: 0;
}

.menu-toggle {
    background: none;
    border: none;
    color: var(--secondary-color);
    font-size: 24px;
    cursor: pointer;
    display: none;
}

/* ============================== */
/* 🔹 HEADER E NAVEGAÇÃO */
/* ============================== */
.route-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    margin-top: 80px;
}

.top-menu {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 24px;
}

.main-content {
    margin-top: 60px;
    padding: 24px;
}

/* ============================== */
/* 🔹 CARDS E CONTAINERS */
/* ============================== */
.home-container, .archive-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 80px 24px 24px 24px;
}

.route-card {
    background: white;
    border-radius: var(--border-radius-lg);
    padding: 24px;
    margin-bottom: 16px;
    box-shadow: var(--shadow);
    cursor: pointer;
    transition: all 0.3s ease;
    border: 1px solid var(--border-light);
}

.route-card:hover {
    box-shadow: var(--shadow-hover);
    transform: translateY(-2px);
    border-color: var(--primary-color);
}

.route-card h3 {
    margin: 0 0 12px 0;
    color: var(--text-dark);
    font-weight: 600;
    font-size: 16px;
}

.route-stats {
    display: flex;
    gap: 20px;
    color: var(--text-medium);
    font-size: 13px;
    font-weight: 500;
}

.route-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.route-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

/* ============================== */
/* 🔹 FORMULÁRIOS */
/* ============================== */
.form-section {
    background: white;
    padding: 24px;
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow);
    margin-bottom: 20px;
    border: 1px solid var(--border-light);
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    color: var(--text-dark);
    font-size: 13px;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 14px;
    font-family: inherit;
    transition: all 0.3s ease;
    background-color: white;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(232, 165, 163, 0.1);
}

.form-group textarea {
    resize: vertical;
    min-height: 80px;
}

.form-control {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 14px;
    font-family: inherit;
    transition: all 0.3s ease;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(232, 165, 163, 0.1);
}

/* Seletor de produtos e campos específicos */
.product-selector {
    position: relative;
}

.product-dropdown, .date-picker, .search-input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 14px;
    font-family: inherit;
    background-color: white;
    cursor: pointer;
}

.product-dropdown:focus, .date-picker:focus, .search-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(232, 165, 163, 0.1);
}

.order-number-field {
    background-color: #f8f9fa;
    border: 1px solid #e9ecef;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.form-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 20px;
}

/* ============================== */
/* 🔹 BOTÕES CORPORATIVOS */
/* ============================== */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: var(--border-radius);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    letter-spacing: 0.01em;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    font-family: inherit;
    white-space: nowrap;
}

.btn:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 3px 8px rgba(0,0,0,0.12);
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.btn-primary { background-color: var(--primary-color); color: white; }
.btn-primary:hover { background-color: var(--primary-hover); }
.btn-secondary { background-color: white; color: var(--text-medium); border: 1px solid var(--border-color); }
.btn-secondary:hover { background-color: var(--light-gray); border-color: var(--primary-color); color: var(--primary-color); }
.btn-success { background-color: var(--success-color); color: white; }
.btn-success:hover { background-color: #45B119; }
.btn-danger { background-color: var(--danger-color); color: white; }
.btn-danger:hover { background-color: #FF3B3D; }
.btn-info { background-color: var(--info-color); color: white; }
.btn-info:hover { background-color: #0B7EE0; }
.btn-share { background-color: #4267B2; color: white; }
.btn-share:hover { background-color: #365899; }
.btn-sm { padding: 6px 12px; font-size: 12px; font-weight: 500; }

.new-route-btn {
    width: 100%;
    padding: 16px;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: var(--border-radius-lg);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    margin-bottom: 24px;
    transition: all 0.3s ease;
    box-shadow: var(--shadow);
}

.new-route-btn:hover {
    background-color: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-hover);
}

/* ============================== */
/* 🔹 SEÇÃO DE ENTREGAS (LISTA) */
/* ============================== */
.deliveries-section {
    background: white;
    padding: 24px;
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow);
    margin-bottom: 20px;
    border: 1px solid var(--border-light);
}

.deliveries-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.deliveries-section-actions {
    display: flex;
    gap: 10px;
}

#deliveries-list {
    margin-bottom: 20px;
}

.delivery-actions {
    margin-top: 8px;
    display: flex;
    gap: 6px;
    align-items: center;
    flex-wrap: wrap;
}

.delivery-actions .btn-sm {
    padding: 4px 8px;
    font-size: 11px;
}

/* Tempos de Entrega */
.delivery-times {
    display: flex;
    gap: 12px;
    margin: 6px 0;
    flex-wrap: wrap;
}

.delivery-time-item {
    display: flex;
    align-items: center;
    gap: 4px;
    background: #f8f9fa;
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 11px;
    color: #495057;
    border: 1px solid #e9ecef;
}

.delivery-time-item .icon { font-size: 12px; }
.delivery-time-item .time { font-weight: 600; color: #212529; }
.arrival-time .icon { color: #007bff; }
.vehicle-time .icon { color: #fd7e14; }

/* ==================================================================== */
/* 🔹 LAYOUT DO ITEM DE ENTREGA (CORREÇÃO UNIFICADA) */
/* ==================================================================== */
.delivery-item {
    background: white;
    border: 1px solid var(--border-light);
    border-radius: var(--border-radius);
    padding: 12px;
    margin-bottom: 8px;
    transition: all 0.3s ease;
    position: relative; /* Alteração para o contexto de posicionamento */
    animation: fadeIn 0.3s ease-out;
}

.delivery-item:hover {
    box-shadow: var(--shadow-hover);
    transform: translateY(-1px);
    border-color: var(--primary-light);
}

.delivery-item.draggable { cursor: move; }
.delivery-item.dragging { opacity: 0.5; }
.delivery-item.drag-over { border-top: 2px solid var(--primary-color); }

/* Transforma o header em um container simples, sem flex */
.delivery-header {
    display: block;
    margin-bottom: 0;
}

.delivery-info {
    /* Adiciona espaço à direita para não deixar o texto ir para baixo dos controles */
    padding-right: 110px; 
}

.delivery-info h3 {
    margin: 0 0 4px 0;
    font-size: 16px;
    line-height: 1.3;
    word-wrap: break-word;
    color: var(--text-dark);
    font-weight: 600;
}

.delivery-item p {
    margin: 3px 0;
    font-size: 13px;
    line-height: 1.3;
}

/* Posiciona o bloco de controles no canto superior direito do card */
.delivery-priority-and-order {
    position: absolute;
    top: 12px;
    right: 12px;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
    flex-shrink: 0;
}

.delivery-priority-and-order .priority {
    margin: 0;
    padding: 3px 8px;
    font-size: 11px;
    border-radius: 12px;
    font-weight: 600;
    text-transform: uppercase;
    display: inline-block;
}

.order-control {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(229, 181, 179, 0.08);
    border-radius: 8px;
    padding: 4px;
    border: 1px solid rgba(229, 181, 179, 0.2);
}

.order-number {
    background: white;
    border: 1px solid var(--primary-color);
    border-radius: 6px;
    padding: 4px 8px;
    font-weight: 700;
    font-size: 13px;
    color: var(--primary-color);
    min-width: 32px;
    text-align: center;
    user-select: none;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.order-buttons {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.order-btn {
    background: var(--primary-color);
    border: none;
    color: white;
    width: 24px;
    height: 20px;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: bold;
    transition: all 0.2s ease;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.order-btn:hover:not(:disabled) {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}

.order-btn:active:not(:disabled) {
    transform: translateY(0);
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.order-btn:disabled {
    background: #d1d5db;
    color: #9ca3af;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
    opacity: 0.6;
}

.delivery-item:hover .order-control {
    background: rgba(229, 181, 179, 0.12);
    border-color: rgba(229, 181, 179, 0.3);
}

.delivery-item:hover .order-number {
    border-color: var(--primary-hover);
    color: var(--primary-hover);
}
/* ==================================================================== */

/* ============================== */
/* 🔹 STATUS E PRIORIDADE */
/* ============================== */
.status {
    padding: 3px 8px;
    font-size: 11px;
    border-radius: 12px;
    font-weight: 600;
    text-transform: uppercase;
    display: inline-block;
    margin-top: 8px; 
}

.status-ordem_manual {
    background-color: #f0e6ff;
    color: #531dab;
    border: 1px solid #b37feb;
}

.priority-indicator {
    display: inline-block;
    padding: 2px 6px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    margin-left: 6px;
    text-transform: uppercase;
    vertical-align: middle;
}

/* Cores de Prioridade */
.priority-0, .priority.priority-0, .priority-indicator.priority-0, .priority-indicator.priority-normal { background-color: #F6FFED; color: #52C41A; border: 1px solid #B7EB8F; }
.priority-1, .priority.priority-1, .priority-indicator.priority-1, .priority-indicator.priority-media { background-color: #FFF7E6; color: #FAAD14; border: 1px solid #FFD666; }
.priority-2, .priority.priority-2, .priority-indicator.priority-2, .priority-indicator.priority-alta { background-color: #FFF2E6; color: #FD7E14; border: 1px solid #FFAC6B; }
.priority-3, .priority.priority-3, .priority-indicator.priority-3, .priority-indicator.priority-urgente { background-color: #FFF2F0; color: #FF4D4F; border: 1px solid #FFADD2; }

/* Cores de Status */
.status-pending { background-color: #F9F0FF; color: #722ED1; border: 1px solid #D3ADF7; }
.status-optimized, .status-delivered { background-color: #F6FFED; color: #52C41A; border: 1px solid #B7EB8F; }
.status-in_transit { background-color: #E6F7FF; color: #1890FF; border: 1px solid #91D5FF; }
.status-cancelled { background-color: #FFF2F0; color: #FF4D4F; border: 1px solid #FFADD2; }

@keyframes priorityPulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.05); opacity: 0.8; }
}
.priority-3 { animation: priorityPulse 2s infinite; }
.priority-2 { animation: priorityPulse 3s infinite; }

/* ============================== */
/* 🔹 MAPA E OTIMIZAÇÃO */
/* ============================== */
.map-section {
    background: white;
    padding: 24px;
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow);
    border: 1px solid var(--border-light);
}

#map {
    height: 500px;
    width: 100%;
    border-radius: var(--border-radius);
    margin-bottom: 20px;
    box-shadow: var(--shadow);
}

.map-controls {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.optimization-buttons {
    display: flex;
    gap: 8px;
    margin-top: 15px;
}

.optimization-buttons .btn {
    padding: 8px 12px;
    font-size: 13px;
    font-weight: 500;
}

.optimization-buttons #optimize-route {
    min-height: 36px;
}

.optimization-buttons #auto-optimize-route {
    width: 36px;
    height: 36px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    padding: 0;
}

/* ============================== */
/* 🔹 MODAL E TOASTS */
/* ============================== */
.modal { display: none; position: fixed; z-index: 1000; left: 0; top: 0; width: 100%; height: 100%; background-color: rgba(0,0,0,0.5); backdrop-filter: blur(5px); }
.modal-content { background-color: white; margin: 50px auto; padding: 0; border-radius: var(--border-radius-lg); width: 90%; max-width: 600px; max-height: 90vh; overflow: hidden; display: flex; flex-direction: column; box-shadow: 0 10px 30px rgba(0,0,0,0.2); }
.modal-header { padding: 20px 24px; background-color: var(--primary-color); color: var(--secondary-color); display: flex; justify-content: space-between; align-items: center; }
.modal-header h2 { margin: 0; color: var(--secondary-color); font-size: 18px; font-weight: 600; }
.close { color: var(--secondary-color); font-size: 24px; font-weight: bold; cursor: pointer; background: none; border: none; opacity: 0.8; transition: opacity 0.3s ease; }
.close:hover, .close:focus { opacity: 1; }
.modal-body { padding: 24px; overflow-y: auto; flex: 1; }
.modal-footer { padding: 16px 24px; border-top: 1px solid var(--border-color); display: flex; justify-content: flex-end; gap: 12px; background-color: var(--light-gray); }

.toast { position: fixed; bottom: 20px; right: 20px; background: white; padding: 16px 20px; border-radius: var(--border-radius); box-shadow: 0 4px 12px rgba(0,0,0,0.15); display: flex; align-items: center; gap: 12px; z-index: 2000; animation: slideUp 0.3s ease-out; font-weight: 500; backdrop-filter: blur(10px); border: 1px solid var(--border-light); max-width: 400px; }
@keyframes slideUp { from { transform: translateY(100%); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.toast.success { border-left: 4px solid var(--success-color); background: rgba(255, 255, 255, 0.95); }
.toast.error { border-left: 4px solid var(--danger-color); background: rgba(255, 255, 255, 0.95); }
.toast.info { border-left: 4px solid var(--info-color); background: rgba(255, 255, 255, 0.95); }

/* ============================== */
/* 🔹 ELEMENTOS DIVERSOS */
/* ============================== */
.settings-group { margin-bottom: 24px; }
.settings-group h3 { margin-bottom: 16px; font-size: 16px; }
.setting-item { margin-bottom: 16px; }
.setting-item label { display: block; margin-bottom: 6px; font-weight: 500; font-size: 13px; }
.setting-description { margin-top: 4px; font-size: 12px; color: var(--text-muted); font-weight: 400; }

.pickup-stop { background: var(--primary-light); border: 1px solid var(--primary-color); padding: 12px; border-radius: var(--border-radius); margin-bottom: 8px; }

.route-info { background-color: var(--primary-color); color: var(--secondary-color); padding: 20px 24px; border-radius: var(--border-radius-lg); margin-bottom: 20px; display: flex; justify-content: space-between; align-items: center; box-shadow: var(--shadow); }
.route-info .route-stats { gap: 32px; }
.route-stat { display: flex; flex-direction: column; align-items: center; }
.route-stat strong { font-size: 20px; color: var(--secondary-color); font-weight: 700; }
.route-stat span { font-size: 11px; color: rgba(255, 247, 245, 0.8); text-transform: uppercase; }
.action-buttons { display: flex; gap: 12px; }

.new-route-section, .existing-routes, .search-section, .archived-routes { background: white; padding: 24px; border-radius: var(--border-radius-lg); box-shadow: var(--shadow); margin-bottom: 24px; border: 1px solid var(--border-light); }
.date-picker, .search-input { margin-bottom: 20px; }
.routes-header { padding: 20px 24px; border-bottom: 1px solid var(--border-light); display: flex; justify-content: space-between; align-items: center; }
.routes-list { padding: 0; }

/* Arquivo de Rotas */
.archive-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 20px; margin-bottom: 24px; }
.stat-card { background: white; padding: 20px; border-radius: var(--border-radius-lg); box-shadow: var(--shadow); text-align: center; border: 1px solid var(--border-light); }
.stat-number { font-size: 28px; font-weight: 700; color: var(--primary-color); display: block; }
.stat-label { color: var(--text-muted); font-size: 13px; font-weight: 500; margin-top: 4px; }
.search-form { display: flex; gap: 12px; align-items: center; }
.archived-route-card { background: white; padding: 20px 24px; cursor: pointer; transition: all 0.3s ease; border-bottom: 1px solid var(--border-light); }
.archived-route-card:hover { background-color: var(--light-gray); }
.archived-route-card:last-child { border-bottom: none; }
.archived-badge { background-color: #F6FFED; color: #52C41A; padding: 4px 8px; border-radius: 4px; font-size: 11px; font-weight: 600; border: 1px solid #B7EB8F; }

/* Botões de Ação Específicos */
.action-btn, .delete-route-btn, .archive-route-btn, .route-action-button { background: none; border: none; cursor: pointer; padding: 6px; border-radius: 4px; transition: all 0.2s ease; display: flex; align-items: center; justify-content: center; width: 28px; height: 28px; }
.action-btn:hover, .delete-route-btn:hover, .archive-route-btn:hover, .route-action-button:hover { transform: scale(1.1); }
.route-action-button { color: var(--text-light); font-size: 1.1rem; line-height: 1; margin-left: 4px; }
.complete-route-btn { color: var(--success-color); }
.delete-route-btn { color: var(--danger-color); }

/* Paginação */
.pagination { display: flex; justify-content: center; align-items: center; gap: 8px; padding: 20px; background: white; border-top: 1px solid var(--border-light); }
.pagination button { padding: 6px 12px; border: 1px solid var(--border-color); background: white; border-radius: var(--border-radius); cursor: pointer; transition: all 0.3s ease; font-weight: 500; font-size: 13px; }
.pagination button:hover:not(:disabled) { background-color: var(--primary-color); color: white; border-color: var(--primary-color); }
.pagination button:disabled { opacity: 0.5; cursor: not-allowed; }
.pagination .current-page { background-color: var(--primary-color); color: white; border-color: var(--primary-color); }

/* Estados */
.loading-state, .empty-state { text-align: center; padding: 40px; color: var(--text-muted); }
.empty-state h3 { margin-bottom: 10px; color: var(--text-dark); font-weight: 600; }
.loading { display: inline-block; width: 16px; height: 16px; border: 2px solid rgba(232, 165, 163, 0.3); border-radius: 50%; border-top-color: var(--primary-color); animation: spin 1s ease-in-out infinite; }
.btn .loading { width: 12px; height: 12px; border-top-color: currentColor; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ============================== */
/* 🔹 RESPONSIVIDADE (UNIFICADA) */
/* ============================== */
@media (max-width: 768px) {
    .container { padding: 16px; }
    .route-header, .archive-header { flex-direction: column; align-items: flex-start; gap: 12px; margin-top: 80px; }
    h1 { font-size: 20px; }
    .map-controls, .action-buttons { flex-direction: column; width: 100%; gap: 8px; }
    .route-info { flex-direction: column; gap: 16px; text-align: center; }
    .route-stats { width: 100%; justify-content: space-around; gap: 20px; }
    #map { height: 300px; }
    .modal-content { margin: 20px; width: calc(100% - 40px); }
    .form-row, .search-form { grid-template-columns: 1fr; }
    .archived-route-card, .route-card-header { flex-direction: column; align-items: flex-start; gap: 8px; }
    .route-actions { align-self: flex-end; }
    
    .delivery-info {
        padding-right: 0; /* No mobile, o texto pode usar todo o espaço */
    }
    .delivery-info h3 {
        font-size: 15px;
        margin: 0 0 3px 0;
    }
    .delivery-priority-and-order {
        position: static; /* Volta ao fluxo normal em telas menores */
        width: 100%;
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        margin-top: 8px;
    }
}

@media (max-width: 480px) {
    body { font-size: 13px; }
    .btn { padding: 8px 16px; font-size: 12px; }
    .form-group input, .form-group select, .form-group textarea { font-size: 13px; }
    .route-stat strong { font-size: 18px; }
    .home-container, .archive-container { padding: 80px 16px 16px 16px; }

    .order-control {
        gap: 4px;
        padding: 2px;
    }
    .order-number {
        min-width: 26px;
        padding: 2px 5px;
        font-size: 11px;
    }
    .order-btn {
        width: 20px;
        height: 16px;
        font-size: 8px;
    }
    .delivery-info h3 {
        margin: 0 0 2px 0;
    }
}

/* ============================== */
/* 🔹 UTILITÁRIOS E ACESSIBILIDADE */
/* ============================== */
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }

/* Animação */
@keyframes fadeIn { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--light-gray); }
::-webkit-scrollbar-thumb { background: var(--primary-color); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--primary-hover); }

/* Acessibilidade */
.btn:focus-visible, .form-control:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--primary-color); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* Impressão */
@media print {
    .navbar, .btn, .action-buttons, .delivery-actions, .route-actions, .modal-footer { display: none !important; }
    body { background: white !important; color: black !important; }
    .route-card, .delivery-item, .form-section { box-shadow: none !important; border: 1px solid #ddd !important; }
}

/* ========================================= */
/* 🔹 ESTILOS PARA OCR DISCRETO (NOVO)      */
/* ========================================= */

.form-section-header-ocr {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
}

.form-section-header-ocr h2 {
    margin-bottom: 0;
}

.ocr-icon-btn {
    background-color: var(--primary-light);
    color: var(--primary-color);
    font-size: 16px;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 1px solid transparent;
}

.ocr-icon-btn:hover {
    background-color: var(--primary-color);
    color: white;
    transform: scale(1.1);
    box-shadow: var(--shadow);
}

.ocr-progress-bar-container {
    margin-bottom: 20px;
    text-align: left;
}

.ocr-progress-bar-container #ocr-status {
    font-size: 12px;
    color: var(--text-medium);
    font-weight: 500;
    margin-bottom: 4px;
    display: block;
}

.ocr-progress-bar-container progress {
    width: 100%;
    height: 6px;
    -webkit-appearance: none;
    appearance: none;
    border: none;
    border-radius: 3px;
    overflow: hidden;
}

.ocr-progress-bar-container progress::-webkit-progress-bar {
    background-color: var(--border-light);
}

.ocr-progress-bar-container progress::-webkit-progress-value {
    background-color: var(--primary-color);
    transition: width 0.3s ease;
}

.ocr-progress-bar-container progress::-moz-progress-bar {
    background-color: var(--primary-color);
}

/* Estilos para o dropdown de exportação */
.export-dropdown {
    position: relative;
    display: inline-block;
    margin-right: 10px;
}

.export-toggle {
    background-color: #17a2b8;
    color: white;
    border: none;
    padding: 10px 15px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.export-toggle:hover {
    background-color: #138496;
    transform: translateY(-1px);
    box-shadow: 0 3px 8px rgba(0,0,0,0.12);
}

.dropdown-arrow {
    font-size: 10px;
    transition: transform 0.3s ease;
}

.export-toggle.active .dropdown-arrow {
    transform: rotate(180deg);
}

.export-menu {
    position: absolute;
    top: 100%;
    left: 0;
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    z-index: 1000;
    min-width: 120px;
    margin-top: 5px;
    animation: fadeInDown 0.3s ease;
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.export-option {
    display: block;
    width: 100%;
    padding: 12px 16px;
    border: none;
    background: none;
    text-align: left;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    color: #333;
    transition: background-color 0.2s ease;
    border-radius: 0;
}

.export-option:first-child {
    border-top-left-radius: 6px;
    border-top-right-radius: 6px;
}

.export-option:last-child {
    border-bottom-left-radius: 6px;
    border-bottom-right-radius: 6px;
}

.export-option:hover {
    background-color: #f8f9fa;
    color: #17a2b8;
}

.export-option:active {
    background-color: #e9ecef;
}

/* Responsive */
@media (max-width: 768px) {
    .deliveries-section-actions {
        flex-direction: column;
        gap: 10px;
        width: 100%;
    }
    
    .export-dropdown {
        margin-right: 0;
        width: 100%;
    }
    
    .export-toggle {
        width: 100%;
        justify-content: center;
    }
    
    .export-menu {
        width: 100%;
        left: 0;
        right: 0;
    }
}

/* Estado de loading para botão de exportação */
.export-toggle.loading {
    opacity: 0.7;
    cursor: not-allowed;
}

.export-toggle.loading .dropdown-arrow {
    animation: spin 1s linear infinite;
}
