/* ============================================
   WICHECK - Estilos Personalizados
   ============================================ */

:root {
    --primary-color: #2563eb;
    --secondary-color: #1e40af;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    --dark-color: #1f2937;
    --light-color: #f9fafb;
    --sidebar-width: 250px;
    --sidebar-collapsed-width: 70px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--light-color);
    color: var(--dark-color);
    overflow-x: hidden;
    width: 100%;
    max-width: 100vw;
}

/* ============================================
   LOGIN
   ============================================ */

.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    padding: 20px;
}

.login-card {
    background: white;
    border-radius: 15px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
    padding: 40px;
    width: 100%;
    max-width: 400px;
}

/* Responsividade para login */
@media (max-width: 576px) {
    .login-container {
        padding: 10px;
    }
    
    .login-card {
        padding: 25px 20px;
        margin: 10px;
        border-radius: 12px;
    }
    
    .login-logo {
        margin-bottom: 20px;
    }
    
    .login-logo img {
        max-height: 70px;
    }
    
    .form-control {
        padding: 10px 12px;
        font-size: 16px; /* Evita zoom no iOS */
    }
    
    .btn-primary {
        padding: 10px;
        font-size: 16px;
    }
}

@media (max-width: 400px) {
    .login-card {
        padding: 20px 15px;
    }
    
    .login-logo img {
        max-height: 60px;
    }
}

.login-logo {
    text-align: center;
    margin-bottom: 30px;
}

.login-logo img {
    max-width: 100%;
    max-height: 80px;
    height: auto;
    width: auto;
    object-fit: contain;
    margin-bottom: 15px;
}

.form-label {
    font-weight: 600;
    color: var(--dark-color);
    margin-bottom: 8px;
}

.form-control {
    border-radius: 8px;
    border: 2px solid #e5e7eb;
    padding: 12px 15px;
    transition: all 0.3s;
}

.form-control:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(37, 99, 235, 0.25);
}

.btn-primary {
    background-color: var(--primary-color);
    border: none;
    border-radius: 8px;
    padding: 12px;
    font-weight: 600;
    transition: all 0.3s;
}

.btn-primary:hover {
    background-color: var(--secondary-color);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(37, 99, 235, 0.3);
}

.alert {
    border-radius: 8px;
    border: none;
}

/* ============================================
   SIDEBAR
   ============================================ */

.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    width: var(--sidebar-width);
    background: linear-gradient(180deg, var(--dark-color) 0%, #111827 100%);
    color: white;
    transition: all 0.3s ease;
    z-index: 1000;
    overflow-y: auto;
    overflow-x: visible;
    border-top-right-radius: 20px;
    border-bottom-right-radius: 20px;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
}

.sidebar.collapsed {
    width: var(--sidebar-collapsed-width);
}

.sidebar-header {
    padding: 20px;
    text-align: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

/* Quando collapsed, reduzir padding do header */
.sidebar.collapsed .sidebar-header {
    padding: 15px 10px;
}

.sidebar-header h3 {
    font-size: 20px;
    font-weight: 700;
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: auto;
}

.sidebar-header h3 img {
    max-width: 100%;
    max-height: 60px;
    width: auto;
    height: auto;
    object-fit: contain;
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
    will-change: auto;
}

/* Quando collapsed, mostrar apenas logo/imagem no header */
.sidebar.collapsed .sidebar-header h3 {
    display: flex !important;
    align-items: center;
    justify-content: center;
    margin: 0;
    padding: 0;
    font-size: 0; /* Esconder texto se houver */
    width: 100%;
    height: auto;
}

.sidebar.collapsed .sidebar-header h3 img {
    max-width: 50px !important;
    max-height: 50px !important;
    width: auto !important;
    height: auto !important;
    object-fit: contain !important;
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

.sidebar.collapsed .sidebar-header h3 i {
    display: inline-block !important;
    visibility: visible !important;
    opacity: 1 !important;
    font-size: 24px !important;
    margin: 0;
}

.sidebar-menu {
    list-style: none;
    padding: 20px 0;
}

.sidebar-menu li {
    margin-bottom: 5px;
}

.sidebar-menu a {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    padding: 15px 20px;
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    transition: all 0.3s;
    border-left: 3px solid transparent;
}

/* Quando collapsed, centralizar ícones */
.sidebar.collapsed .sidebar-menu a {
    justify-content: center;
    padding: 15px 10px;
}

.sidebar-menu a:hover,
.sidebar-menu a.active {
    background-color: rgba(255, 255, 255, 0.1);
    color: white;
    border-left-color: var(--primary-color);
}

.sidebar-menu a i {
    width: 24px;
    min-width: 24px;
    max-width: 24px;
    margin-right: 15px;
    font-size: 18px;
    display: inline-block;
    text-align: center;
    line-height: 1;
    flex-shrink: 0;
}

/* Quando collapsed, remover margin-right do ícone */
.sidebar.collapsed .sidebar-menu a i {
    margin-right: 0;
}

/* Garantir que todos os ícones da sidebar tenham o mesmo estilo */
.sidebar-menu a i.bi-person-fill,
.sidebar-menu a i.bi-speedometer2,
.sidebar-menu a i.bi-people,
.sidebar-menu a i.bi-calendar-check,
.sidebar-menu a i.bi-list-task,
.sidebar-menu a i.bi-check-square,
.sidebar-menu a i.bi-map,
.sidebar-menu a i.bi-geo-alt,
.sidebar-menu a i.bi-map-fill,
.sidebar-menu a i.bi-graph-up,
.sidebar-menu a i.bi-gear,
.sidebar-menu a i.bi-box-arrow-right {
    width: 24px !important;
    min-width: 24px !important;
    max-width: 24px !important;
    font-size: 18px !important;
    height: auto !important;
    display: inline-block !important;
    vertical-align: middle !important;
    line-height: 1 !important;
}

/* Corrigir ícones que aparecem escuros/preenchidos - apenas no conteúdo, não na sidebar */
.main-content .bi-person-fill {
    font-size: inherit !important;
    width: auto !important;
    height: auto !important;
    display: inline-block !important;
    vertical-align: middle !important;
    line-height: 1 !important;
    background: transparent !important;
    fill: currentColor !important;
}

.sidebar.collapsed .sidebar-menu a span {
    display: none !important;
    opacity: 0;
    visibility: hidden;
}

/* Garantir que os ícones fiquem visíveis quando collapsed */
.sidebar.collapsed .sidebar-menu a i {
    display: inline-block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

/* Garantir que todos os itens do menu sejam visíveis quando não collapsed */
.sidebar:not(.collapsed) .sidebar-menu li {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    height: auto !important;
    overflow: visible !important;
}

.sidebar:not(.collapsed) .sidebar-menu a {
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
}

.sidebar:not(.collapsed) .sidebar-menu a span {
    display: inline-block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

/* Prevenir que menus desapareçam ao navegar */
.sidebar-menu {
    overflow: visible !important;
}

.sidebar-menu li {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

.sidebar-toggle {
    position: fixed;
    top: 20px;
    left: calc(var(--sidebar-width) - 12px);
    background: linear-gradient(180deg, var(--dark-color) 0%, #111827 100%);
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.2);
    width: 35px;
    height: 35px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 3px 12px rgba(0, 0, 0, 0.25);
    z-index: 10000;
    transition: all 0.3s ease;
    font-size: 16px;
}

.sidebar-toggle:hover {
    background: linear-gradient(180deg, #374151 0%, #1f2937 100%);
    border-color: rgba(255, 255, 255, 0.4);
    transform: scale(1.1);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
}

/* Quando sidebar está collapsed, manter botão visível */
.sidebar.collapsed .sidebar-toggle {
    left: calc(var(--sidebar-collapsed-width) - 12px);
    top: 20px;
    width: 35px;
    height: 35px;
    z-index: 10000;
}

.sidebar.collapsed {
    width: var(--sidebar-collapsed-width);
}

.sidebar.hidden {
    transform: translateX(-100%) !important;
    width: 0 !important;
    overflow: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
    visibility: hidden !important;
}

.sidebar.hidden ~ .main-content {
    margin-left: 0 !important;
    transition: margin-left 0.3s ease;
}

.sidebar.hidden .sidebar-toggle {
    left: 20px;
    background: linear-gradient(180deg, var(--dark-color) 0%, #111827 100%);
    border: 2px solid rgba(255, 255, 255, 0.2);
    pointer-events: all;
    top: 20px;
    width: 35px;
    height: 35px;
    border-radius: 8px;
    z-index: 10000;
}

.sidebar.hidden .sidebar-toggle:hover {
    background: linear-gradient(180deg, #374151 0%, #1f2937 100%);
    border-color: rgba(255, 255, 255, 0.4);
    transform: scale(1.1);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
}

/* Botão de toggle quando sidebar está escondida */
.sidebar.hidden + .sidebar-toggle-show {
    position: fixed;
    top: 20px;
    left: 20px;
    background: var(--primary-color);
    color: white;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    z-index: 1001;
    transition: all 0.3s;
}

.sidebar.hidden + .sidebar-toggle-show:hover {
    background: var(--secondary-color);
    transform: scale(1.1);
}

/* ============================================
   MAIN CONTENT
   ============================================ */

.main-content {
    margin-left: var(--sidebar-width);
    transition: all 0.3s;
    min-height: 100vh;
    padding: 20px;
    overflow-x: hidden;
    width: calc(100vw - var(--sidebar-width));
    max-width: calc(100vw - var(--sidebar-width));
    box-sizing: border-box;
}

.sidebar.collapsed ~ .main-content,
body:has(.sidebar.collapsed) .main-content {
    margin-left: var(--sidebar-collapsed-width) !important;
    width: calc(100vw - var(--sidebar-collapsed-width)) !important;
    max-width: calc(100vw - var(--sidebar-collapsed-width)) !important;
}

.header {
    background: white;
    padding: 20px 30px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    margin-bottom: 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header h2 {
    margin: 0;
    color: var(--dark-color);
    font-size: 24px;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

/* Notificações */
#btnNotificacoes {
    position: relative;
    color: inherit;
    border: none;
    background: none;
    padding: 0;
    margin: 0;
}

#btnNotificacoes:hover {
    opacity: 0.8;
}

#badgeNotificacoes {
    font-size: 0.7rem;
    padding: 0.25em 0.5em;
    min-width: 1.2em;
    height: 1.2em;
    display: flex;
    align-items: center;
    justify-content: center;
}

#listaNotificacoes {
    min-width: 350px;
    max-width: 400px;
}

#listaNotificacoes .dropdown-item-text {
    border-bottom: 1px solid #e9ecef;
    transition: background-color 0.2s;
}

#listaNotificacoes .dropdown-item-text:hover {
    background-color: #f8f9fa;
}

#listaNotificacoes .dropdown-item-text:last-child {
    border-bottom: none;
}

.notificacao-nova {
    animation: pulse 1s ease-in-out;
    background-color: #e7f3ff !important;
}

@keyframes pulse {
    0% {
        background-color: #e7f3ff;
    }
    50% {
        background-color: #b3d9ff;
    }
    100% {
        background-color: #e7f3ff;
    }
}

/* Responsividade para notificações */
@media (max-width: 576px) {
    #listaNotificacoes {
        min-width: 280px;
        max-width: 320px;
    }
}

.user-info span {
    font-weight: 600;
    color: var(--dark-color);
}

/* ============================================
   CARDS
   ============================================ */

.stats-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 30px;
}

@media (max-width: 1200px) {
    .stats-cards {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 992px) {
    .stats-cards {
        grid-template-columns: repeat(2, 1fr);
    }
}

.stat-card {
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
    border-radius: 12px;
    padding: 18px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
    border: 1px solid rgba(0, 0, 0, 0.05);
    border-left: 4px solid #2563eb;
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
    opacity: 0;
    transition: opacity 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.stat-card:hover::before {
    opacity: 1;
}


.stat-card-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    margin-bottom: 12px;
    transition: all 0.3s ease;
    position: relative;
}

.stat-card:hover .stat-card-icon {
    transform: scale(1.1) rotate(5deg);
}

.stat-card-icon.primary {
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.15), rgba(37, 99, 235, 0.25));
    color: var(--primary-color);
    box-shadow: 0 4px 15px rgba(37, 99, 235, 0.2);
}

.stat-card-icon.success {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.15), rgba(16, 185, 129, 0.25));
    color: var(--success-color);
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.2);
}

.stat-card-icon.danger {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.15), rgba(239, 68, 68, 0.25));
    color: var(--danger-color);
    box-shadow: 0 4px 15px rgba(239, 68, 68, 0.2);
}

.stat-card-icon.warning {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.15), rgba(245, 158, 11, 0.25));
    color: var(--warning-color);
    box-shadow: 0 4px 15px rgba(245, 158, 11, 0.2);
}

.stat-card-icon.info {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.15), rgba(59, 130, 246, 0.25));
    color: #3b82f6;
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.2);
}

.stat-card-value {
    font-size: 28px;
    font-weight: 800;
    background: linear-gradient(135deg, var(--dark-color), #4b5563);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 6px;
    line-height: 1.2;
}

.stat-card-label {
    color: #6b7280;
    font-size: 13px;
    font-weight: 500;
    letter-spacing: 0.2px;
}

/* ============================================
   TABLES
   ============================================ */

.content-card {
    background: white;
    border-radius: 16px;
    padding: 30px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
    margin-bottom: 30px;
    border: 1px solid rgba(0, 0, 0, 0.05);
    overflow-x: hidden;
    width: 100%;
    box-sizing: border-box;
}

.chart-container {
    position: relative;
    height: 350px;
    margin-top: 20px;
}

@media (max-width: 768px) {
    .chart-container {
        height: 250px;
    }
}

@media (max-width: 576px) {
    .chart-container {
        height: 200px;
    }
}

.visitas-tempo-real {
    max-height: 500px;
    overflow-y: auto;
    overflow-x: hidden;
    width: 100%;
    box-sizing: border-box;
}

.visita-item-tempo-real {
    padding: 18px;
    border-left: 4px solid var(--primary-color);
    background: #f8fafc;
    border-radius: 10px;
    margin-bottom: 15px;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    width: 100%;
    box-sizing: border-box;
    overflow: hidden;
    max-width: 100%;
}

.visita-item-tempo-real:hover {
    background: #f1f5f9;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.visita-item-tempo-real.ativa {
    border-left-color: var(--success-color);
    background: linear-gradient(90deg, rgba(16, 185, 129, 0.08), rgba(16, 185, 129, 0.02));
}

.visita-item-tempo-real h6 {
    font-size: 15px;
    font-weight: 600;
    color: var(--dark-color);
    word-wrap: break-word;
    overflow-wrap: break-word;
    max-width: 100%;
}

.visita-item-tempo-real .text-muted.small {
    font-size: 13px;
    line-height: 1.6;
    word-wrap: break-word;
    overflow-wrap: break-word;
    max-width: 100%;
}

.visita-item-tempo-real a {
    text-decoration: none;
    transition: all 0.2s;
    word-break: break-word;
    display: inline-block;
    max-width: 100%;
}

.visita-item-tempo-real a:hover {
    text-decoration: underline;
}

.visita-item-tempo-real .d-flex {
    width: 100%;
    box-sizing: border-box;
    overflow: hidden;
}

.visita-item-tempo-real .flex-grow-1 {
    min-width: 0;
    overflow: hidden;
}

.visita-item-tempo-real .text-end {
    flex-shrink: 0;
    min-width: 0;
}

.badge-status {
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.875rem;
    font-weight: 500;
    white-space: nowrap;
    display: inline-block;
    text-align: center;
    line-height: 1.5;
    width: 100%;
    box-sizing: border-box;
}

.badge-status.d-block {
    display: block !important;
    text-align: center;
}

.badge-status.ativa {
    background: var(--success-color);
    color: white;
}

.badge-status.concluida {
    background: var(--primary-color);
    color: white;
}

/* Barra de progresso no rodapé do card de visita */
.progress-visita-footer {
    margin-top: 15px;
    padding-top: 15px;
    width: 100%;
    overflow: hidden;
    box-sizing: border-box;
}

.progress-visita-footer .d-flex {
    width: 100%;
    box-sizing: border-box;
    overflow: hidden;
}

.progress-visita-footer small {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1 1 auto;
    min-width: 0;
}

.progress-visita-bar-footer {
    width: 100%;
    height: 12px;
    background: rgba(0, 0, 0, 0.08);
    border-radius: 10px;
    overflow: hidden;
    position: relative;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1);
}

.progress-visita-fill-footer {
    height: 100%;
    background: linear-gradient(
        90deg,
        var(--success-color) 0%,
        #059669 25%,
        #10b981 50%,
        #059669 75%,
        var(--primary-color) 100%
    );
    background-size: 200% 100%;
    border-radius: 10px;
    transition: width 1.5s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    animation: progress-gradient 4s ease infinite, progress-pulse 3s ease-in-out infinite;
    box-shadow: 0 0 10px rgba(16, 185, 129, 0.3);
}

.progress-visita-fill-footer::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
        90deg,
        rgba(255, 255, 255, 0) 0%,
        rgba(255, 255, 255, 0.4) 50%,
        rgba(255, 255, 255, 0) 100%
    );
    animation: progress-shine-footer 3s infinite;
}

.progress-visita-fill-footer::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 50%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.6),
        transparent
    );
    animation: progress-wave 2.5s infinite;
}

@keyframes progress-gradient {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

@keyframes progress-shine-footer {
    0% {
        transform: translateX(-100%);
    }
    100% {
        transform: translateX(100%);
    }
}

@keyframes progress-wave {
    0% {
        left: -100%;
    }
    100% {
        left: 100%;
    }
}

@keyframes progress-pulse {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.4);
    }
    50% {
        box-shadow: 0 0 0 4px rgba(16, 185, 129, 0);
    }
}

.progress-visita-footer small {
    font-size: 11px;
}

.progress-visita-footer .text-success {
    color: var(--success-color) !important;
    font-weight: 600;
}

/* Animação para o badge "Atualizando..." */
#statusAtualizacao {
    position: relative;
    overflow: hidden;
}

#statusAtualizacao::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    animation: shimmer 2s infinite;
}

#statusAtualizacao i {
    animation: pulse-dot 1s ease-in-out infinite;
    display: inline-block;
    margin-right: 5px;
}

@keyframes pulse-dot {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.4;
        transform: scale(1.3);
    }
}

@keyframes shimmer {
    0% {
        left: -100%;
    }
    100% {
        left: 100%;
    }
}

.table-responsive {
    border-radius: 10px;
    overflow: hidden;
}

.table {
    margin-bottom: 0;
}

.table thead {
    background-color: var(--light-color);
}

.table thead th {
    border: none;
    font-weight: 600;
    color: var(--dark-color);
    padding: 15px;
}

.table tbody td {
    padding: 15px;
    vertical-align: middle;
}

.badge {
    padding: 6px 12px;
    border-radius: 20px;
    font-weight: 600;
    font-size: 12px;
}

/* ============================================
   MAP
   ============================================ */

.map-container {
    background: white;
    border-radius: 10px;
    padding: 0;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    overflow: hidden;
    height: 600px;
}

#map {
    width: 100%;
    height: 100%;
    border-radius: 10px;
}

/* ============================================
   FORMS
   ============================================ */

.form-card {
    background: white;
    border-radius: 10px;
    padding: 30px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

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

.btn-group-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

/* ============================================
   VENDEDOR TRACKING
   ============================================ */

.tracking-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 40px 20px;
}

.tracking-card {
    background: white;
    border-radius: 15px;
    padding: 40px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
    text-align: center;
}

.tracking-status {
    font-size: 48px;
    margin-bottom: 20px;
}

.tracking-status.active {
    color: var(--success-color);
}

.tracking-status.inactive {
    color: var(--danger-color);
}

.tracking-info {
    margin: 30px 0;
    padding: 20px;
    background: var(--light-color);
    border-radius: 10px;
}

.tracking-info-item {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
    padding-bottom: 10px;
    border-bottom: 1px solid #e5e7eb;
}

.tracking-info-item:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.btn-tracking {
    padding: 15px 40px;
    font-size: 18px;
    font-weight: 600;
    border-radius: 10px;
    border: none;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-tracking.start {
    background: var(--success-color);
    color: white;
}

.btn-tracking.start:hover {
    background: #059669;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(16, 185, 129, 0.3);
}

.btn-tracking.stop {
    background: var(--danger-color);
    color: white;
}

.btn-tracking.stop:hover {
    background: #dc2626;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(239, 68, 68, 0.3);
}

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 992px) {
    .stats-cards {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .visita-item-tempo-real .d-flex {
        flex-wrap: wrap;
    }
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        position: fixed;
        z-index: 9999;
        height: 100vh;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .sidebar.show {
        transform: translateX(0);
    }
    
    .sidebar.hidden {
        transform: translateX(-100%);
    }
    
    .main-content {
        margin-left: 0 !important;
        padding: 15px;
        overflow-x: hidden;
        max-width: 100vw !important;
        width: 100% !important;
    }
    
    .sidebar-toggle {
        display: block;
        position: fixed;
        top: 20px;
        left: 0;
        z-index: 10000;
        background: linear-gradient(180deg, var(--dark-color) 0%, #111827 100%);
        border: 2px solid rgba(255, 255, 255, 0.2);
        border-radius: 0 8px 8px 0;
        min-width: 44px;
        min-height: 44px;
    }
    
    .sidebar.hidden .sidebar-toggle {
        left: 0;
        right: auto;
        top: 20px;
        z-index: 10000;
    }
    
    /* Overlay para fechar sidebar ao clicar fora */
    .sidebar-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 9998;
    }
    
    .sidebar.show ~ .sidebar-overlay {
        display: block;
    }
    
    .stats-cards {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .header {
        flex-direction: column;
        gap: 15px;
        align-items: flex-start;
    }
    
    .content-card {
        padding: 20px;
    }
    
    .visitas-tempo-real {
        max-height: 400px;
    }
    
    .visita-item-tempo-real {
        padding: 15px;
    }
    
    .visita-item-tempo-real .d-flex {
        flex-direction: column;
        gap: 10px;
    }
    
    .visita-item-tempo-real .text-end {
        width: 100%;
        text-align: left !important;
        margin-top: 10px;
    }
    
    .progress-visita-footer .d-flex {
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
    }
    
    .progress-visita-footer small {
        width: 100%;
        margin-bottom: 5px;
    }
    
    .chart-container {
        height: 250px;
    }
}

@media (max-width: 576px) {
    .main-content {
        padding: 12px;
    }
    
    .content-card {
        padding: 15px;
    }
    
    .stats-cards {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    
    .stat-card {
        padding: 15px;
    }
    
    .stat-card-icon {
        width: 45px;
        height: 45px;
        font-size: 20px;
    }
    
    .stat-card-value {
        font-size: 28px;
    }
    
    .stat-card-label {
        font-size: 12px;
    }
    
    .visita-item-tempo-real {
        padding: 12px;
    }
    
    .visita-item-tempo-real h6 {
        font-size: 14px;
    }
    
    .visita-item-tempo-real .text-muted.small {
        font-size: 11px;
    }
    
    .chart-container {
        height: 200px;
    }
    
    .progress-visita-footer {
        margin-top: 10px;
        padding-top: 10px;
    }
    
    .progress-visita-footer small {
        font-size: 9px;
    }
    
    .header h2 {
        font-size: 20px;
    }
    
    .content-card h4,
    .content-card h5 {
        font-size: 18px;
    }
}

@media (max-width: 400px) {
    .main-content {
        padding: 10px;
    }
    
    .content-card {
        padding: 12px;
    }
    
    .stat-card {
        padding: 12px;
    }
    
    .stat-card-value {
        font-size: 24px;
    }
    
    .visita-item-tempo-real {
        padding: 10px;
    }
    
    .chart-container {
        height: 180px;
    }
}

/* Cards de vendedores online */
.card.border-success {
    transition: all 0.3s ease;
    border-width: 2px !important;
}

.card.border-success:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.2);
}

.card.border-success .bi-circle-fill {
    animation: pulse 2s infinite;
}

/* Estilos para informações de visita em andamento */
.card.border-success .border-top {
    border-color: rgba(0, 0, 0, 0.1) !important;
}

.card.border-success .badge {
    font-weight: 500;
}

/* Estilos para botão de rota */
.card.border-success .btn-outline-info {
    border-width: 1px;
}

/* ============================================
   RESPONSIVIDADE PARA TRANSPORTE E MOTORISTA
   ============================================ */

/* Tabelas responsivas */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.table-responsive table {
    min-width: 600px;
}

/* Cards de rota, despesa e entrega */
.rota-card, .despesa-card, .entrega-card {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.rota-card:hover, .despesa-card:hover, .entrega-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0,0,0,0.15);
}

/* Modais responsivos */
.modal-dialog {
    margin: 1rem auto;
}

/* Garantir centralização de modais com modal-dialog-centered */
.modal-dialog-centered {
    display: flex;
    align-items: center;
    min-height: calc(100% - 1rem);
}

.modal-dialog-centered::before {
    content: "";
    display: block;
    height: calc(100vh - 1rem);
    min-height: 100%;
}

.modal-content {
    border-radius: 15px;
}

.modal-header {
    border-bottom: 1px solid #e9ecef;
    padding: 1rem 1.25rem;
}

.modal-body {
    padding: 1.25rem;
}

.modal-footer {
    border-top: 1px solid #e9ecef;
    padding: 1rem 1.25rem;
    flex-wrap: wrap;
    gap: 0.5rem;
}

/* Botões em mobile */
.btn {
    min-height: 44px; /* Tamanho mínimo para touch */
    padding: 0.5rem 1rem;
    font-size: 0.95rem;
    white-space: nowrap;
}

.btn-sm {
    min-height: 36px;
    padding: 0.25rem 0.75rem;
    font-size: 0.875rem;
}

/* Formulários responsivos */
.form-control, .form-select {
    min-height: 44px; /* Tamanho mínimo para touch */
    font-size: 16px; /* Evita zoom no iOS */
}

.form-label {
    font-weight: 500;
    margin-bottom: 0.5rem;
}

/* Tabs responsivas */
.nav-tabs {
    flex-wrap: wrap;
    border-bottom: 2px solid #dee2e6;
}

.nav-tabs .nav-link {
    padding: 0.75rem 1rem;
    font-size: 0.9rem;
    white-space: nowrap;
    min-height: 44px;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.nav-tabs .nav-link i {
    font-size: 1rem;
}

/* Progress bars responsivas */
.progress {
    height: 30px;
    font-size: 0.9rem;
}

.progress-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
}

/* Badges responsivos */
.badge {
    padding: 0.4em 0.8em;
    font-size: 0.85em;
    font-weight: 500;
}

.status-badge {
    font-size: 0.85rem;
    padding: 0.4em 0.8em;
    border-radius: 0.375rem;
}

/* Lista de entregas */
#listaEntregas .card {
    margin-bottom: 1rem;
    border-radius: 12px;
    overflow: hidden;
}

#listaEntregas .card-body {
    padding: 1rem;
}

#listaEntregas .card-header {
    padding: 0.75rem 1rem;
    background-color: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
}

/* Canvas de assinatura responsivo */
#canvasAssinatura {
    max-width: 100%;
    height: auto;
    touch-action: none;
}

/* Grid de estatísticas */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

/* Media queries específicas para tablets */
@media (max-width: 1024px) {
    .main-content {
        padding: 1rem;
    }
    
    .header {
        padding: 1rem 1.5rem;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .nav-tabs .nav-link {
        font-size: 0.85rem;
        padding: 0.6rem 0.8rem;
    }
}

/* Media queries específicas para tablets pequenos e celulares grandes */
@media (max-width: 768px) {
    .main-content {
        padding: 0.75rem;
    }
    
    .header {
        padding: 1rem;
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    
    .header h2 {
        font-size: 1.5rem;
        margin: 0;
    }
    
    .user-info {
        width: 100%;
        justify-content: space-between;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .nav-tabs {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        flex-wrap: nowrap;
    }
    
    .nav-tabs .nav-link {
        white-space: nowrap;
        font-size: 0.8rem;
        padding: 0.5rem 0.75rem;
    }
    
    .nav-tabs .nav-link i {
        font-size: 0.9rem;
    }
    
    /* Cards de rota, despesa, entrega */
    .rota-card, .despesa-card, .entrega-card {
        padding: 1rem;
        margin-bottom: 1rem;
    }
    
    .rota-card h5, .despesa-card h5, .entrega-card h5 {
        font-size: 1.1rem;
    }
    
    /* Botões em grupos */
    .btn-group {
        flex-wrap: wrap;
    }
    
    .btn-group .btn {
        flex: 1 1 auto;
        min-width: 120px;
    }
    
    /* Modais */
    .modal-dialog {
        margin: 0.5rem;
        max-width: calc(100% - 1rem);
    }
    
    .modal-header h5 {
        font-size: 1.1rem;
    }
    
    .modal-body {
        padding: 1rem;
    }
    
    .modal-footer {
        flex-direction: column;
    }
    
    .modal-footer .btn {
        width: 100%;
        margin: 0.25rem 0;
    }
    
    /* Tabelas */
    .table-responsive {
        border-radius: 8px;
    }
    
    .table {
        font-size: 0.85rem;
    }
    
    .table th, .table td {
        padding: 0.5rem 0.4rem;
        white-space: nowrap;
    }
    
    /* Formulários */
    .row .col-md-6, .row .col-md-3, .row .col-md-4 {
        margin-bottom: 1rem;
    }
    
    /* Progress bars */
    .progress {
        height: 25px;
        font-size: 0.8rem;
    }
    
    /* Lista de entregas */
    #listaEntregas .card-body .d-flex {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    #listaEntregas .card-body .text-end {
        text-align: left !important;
        width: 100%;
    }
    
    /* Canvas de assinatura */
    #canvasAssinatura {
        width: 100%;
        height: 150px;
    }
    
    /* Filtros e botões de ação */
    .d-flex.justify-content-between {
        flex-direction: column;
        gap: 0.75rem;
    }
    
    .d-flex.justify-content-between > * {
        width: 100%;
    }
    
    .d-flex.gap-2 {
        flex-wrap: wrap;
        gap: 0.5rem !important;
    }
    
    .d-flex.gap-2 .btn {
        flex: 1 1 auto;
        min-width: 140px;
    }
}

/* Media queries específicas para celulares */
@media (max-width: 576px) {
    .main-content {
        padding: 0.5rem;
    }
    
    .header {
        padding: 0.75rem;
    }
    
    .header h2 {
        font-size: 1.25rem;
    }
    
    .header h2 i {
        font-size: 1.1rem;
    }
    
    .nav-tabs .nav-link {
        font-size: 0.75rem;
        padding: 0.5rem;
        min-width: auto;
    }
    
    .nav-tabs .nav-link span {
        display: none;
    }
    
    .nav-tabs .nav-link i {
        font-size: 1.1rem;
        margin: 0;
    }
    
    /* Cards */
    .rota-card, .despesa-card, .entrega-card {
        padding: 0.75rem;
    }
    
    .rota-card h5, .despesa-card h5, .entrega-card h5 {
        font-size: 1rem;
    }
    
    .rota-card .badge, .despesa-card .badge, .entrega-card .badge {
        font-size: 0.75rem;
        padding: 0.25em 0.5em;
    }
    
    /* Modais */
    .modal-dialog {
        margin: 0.25rem;
        max-width: calc(100% - 0.5rem);
    }
    
    .modal-header {
        padding: 0.75rem;
    }
    
    .modal-header h5 {
        font-size: 1rem;
    }
    
    .modal-body {
        padding: 0.75rem;
    }
    
    .modal-footer {
        padding: 0.75rem;
    }
    
    /* Tabelas */
    .table {
        font-size: 0.75rem;
    }
    
    .table th, .table td {
        padding: 0.4rem 0.3rem;
    }
    
    /* Botões */
    .btn {
        font-size: 0.85rem;
        padding: 0.5rem 0.75rem;
    }
    
    .btn i {
        font-size: 0.9rem;
    }
    
    /* Formulários */
    .form-control, .form-select {
        font-size: 16px; /* Evita zoom no iOS */
        padding: 0.5rem 0.75rem;
    }
    
    .form-label {
        font-size: 0.9rem;
    }
    
    /* Progress bars */
    .progress {
        height: 20px;
        font-size: 0.7rem;
    }
    
    /* Canvas de assinatura */
    #canvasAssinatura {
        height: 120px;
    }
    
    /* Estatísticas */
    .stat-card {
        padding: 1rem;
    }
    
    .stat-card-icon {
        font-size: 2rem;
    }
    
    .stat-card-value {
        font-size: 1.5rem;
    }
    
    .stat-card-label {
        font-size: 0.8rem;
    }
    
    /* Lista de entregas */
    #listaEntregas .card-body {
        padding: 0.75rem;
    }
    
    #listaEntregas .card-header {
        padding: 0.5rem 0.75rem;
    }
    
    /* Badges */
    .badge, .status-badge {
        font-size: 0.7rem;
        padding: 0.3em 0.6em;
    }
}

/* Media queries para telas muito pequenas */
@media (max-width: 400px) {
    .main-content {
        padding: 0.5rem;
    }
    
    .header h2 {
        font-size: 1.1rem;
    }
    
    .nav-tabs .nav-link {
        padding: 0.4rem;
        font-size: 0.7rem;
    }
    
    .btn {
        font-size: 0.8rem;
        padding: 0.4rem 0.6rem;
    }
    
    .modal-dialog {
        margin: 0.25rem;
    }
    
    .modal-header, .modal-body, .modal-footer {
        padding: 0.5rem;
    }
    
    .table {
        font-size: 0.7rem;
    }
    
    .rota-card, .despesa-card, .entrega-card {
        padding: 0.5rem;
    }
    
    .stat-card {
        padding: 0.75rem;
    }
    
    .stat-card-icon {
        font-size: 1.5rem;
    }
    
    .stat-card-value {
        font-size: 1.25rem;
    }
}

/* Melhorias para touch */
@media (hover: none) and (pointer: coarse) {
    .btn, .nav-link, .sidebar-menu a {
        -webkit-tap-highlight-color: rgba(0, 0, 0, 0.1);
    }
    
    .btn:active, .nav-link:active, .sidebar-menu a:active {
        transform: scale(0.98);
    }
}

/* Orientação landscape em mobile */
@media (max-width: 768px) and (orientation: landscape) {
    .modal-dialog {
        max-height: 90vh;
        overflow-y: auto;
    }
    
    .modal-body {
        max-height: calc(90vh - 120px);
        overflow-y: auto;
    }
}
padding: 2px 8px;
    font-size: 11px;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

/* ============================================
   LOADING & ANIMATIONS
   ============================================ */

.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.fade-in {
    animation: fadeIn 0.3s;
}

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

/* ============================================
   NOTIFICAÇÕES (TOAST) - CANTO SUPERIOR DIREITO
   ============================================ */

.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 400px;
    pointer-events: none;
}

.toast-notification {
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-width: 300px;
    max-width: 400px;
    opacity: 0;
    transform: translateX(400px);
    transition: all 0.3s ease-in-out;
    pointer-events: auto;
    border-left: 4px solid;
}

.toast-notification.show {
    opacity: 1;
    transform: translateX(0);
}

.toast-content {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
}

.toast-notification i.bi {
    font-size: 20px;
    flex-shrink: 0;
}

.toast-message {
    font-size: 14px;
    line-height: 1.5;
    color: #333;
    word-wrap: break-word;
}

.toast-close {
    background: none;
    border: none;
    padding: 4px;
    cursor: pointer;
    color: #666;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s;
    flex-shrink: 0;
}

.toast-close:hover {
    color: #000;
}

/* Cores por tipo */
.toast-success {
    border-left-color: var(--success-color);
    background: #f0fdf4;
}

.toast-success i.bi-check-circle-fill {
    color: var(--success-color);
}

.toast-danger,
.toast-error {
    border-left-color: var(--danger-color);
    background: #fef2f2;
}

.toast-danger i.bi-exclamation-triangle-fill,
.toast-error i.bi-exclamation-triangle-fill {
    color: var(--danger-color);
}

.toast-warning {
    border-left-color: var(--warning-color);
    background: #fffbeb;
}

.toast-warning i.bi-exclamation-circle-fill {
    color: var(--warning-color);
}

.toast-info {
    border-left-color: var(--primary-color);
    background: #eff6ff;
}

.toast-info i.bi-info-circle {
    color: var(--primary-color);
}

/* Responsividade */
@media (max-width: 768px) {
    .toast-container {
        top: 10px;
        right: 10px;
        left: 10px;
        max-width: none;
    }
    
    .toast-notification {
        min-width: auto;
        max-width: none;
    }
}

/* ============================================
   LISTA DE RESULTADOS DE BUSCA DE CLIENTES
   ============================================ */
#listaResultadosClientes {
    background-color: #fff;
    border: 1px solid #dee2e6;
    border-radius: 0.375rem;
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
    margin-top: 0.5rem;
}

#listaResultadosClientes .list-group-item {
    border: none;
    border-bottom: 1px solid #e9ecef;
    padding: 0.75rem 1rem;
    cursor: pointer;
    transition: background-color 0.2s;
}

#listaResultadosClientes .list-group-item:last-child {
    border-bottom: none;
}

#listaResultadosClientes .list-group-item:hover {
    background-color: #f8f9fa;
}

#listaResultadosClientes .list-group-item:active {
    background-color: #e9ecef;
}

#listaResultadosClientes .list-group-item .fw-bold {
    color: #212529;
    margin-bottom: 0.25rem;
}

#listaResultadosClientes .list-group-item small {
    color: #6c757d;
    display: block;
}

#clienteSelecionadoInfo {
    border: 1px solid #dee2e6;
    background-color: #f8f9fa;
}

#clienteSelecionadoInfo strong {
    color: #212529;
    display: block;
    margin-bottom: 0.25rem;
}

#clienteSelecionadoInfo .text-muted {
    font-size: 0.875rem;
}
