/* === ESTILOS DE AUTENTICACIÓN === */
.user-info {
    position: fixed;
    top: 20px;
    right: 20px;
    background: white;
    padding: 15px 20px;
    border-radius: 25px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    gap: 15px;
    z-index: 1000;
    border: 1px solid #e2e8f0;
}

.user-details {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.user-name {
    color: #2d3748;
    font-weight: 600;
    font-size: 0.9rem;
}

.user-role {
    color: #718096;
    font-size: 0.8rem;
}

.logout-btn {
    background: #e53e3e;
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9rem;
    opacity: 1;
    transform: translateX(0);
}

.logout-btn:hover {
    background: #c53030;
    transform: translateY(-1px);
}

/* Animación de auto-ocultamiento - TODO el elemento user-info */
.user-info.hidden {
    opacity: 0;
    transform: translateX(100%);
    pointer-events: none;
}

/* Animación suave al aparecer/desaparecer para user-info */
.user-info {
    transition: opacity 0.5s ease, transform 0.5s ease;
}

.user-details {
    flex: 1; /* Ocupar el espacio disponible */
    min-width: 0; /* Permitir que se ajuste */
}

/* Mejoras específicas para móvil */
@media (max-width: 768px) {
    .user-info {
        top: 10px;
        right: 10px;
        padding: 10px 15px;
        font-size: 0.85rem;
        max-width: calc(100vw - 40px); /* No exceder el ancho de pantalla */
    }
    
    .user-name {
        font-size: 0.8rem;
    }
    
    .user-role {
        font-size: 0.7rem;
    }
    
    .logout-btn {
        padding: 6px 10px;
        font-size: 0.8rem;
        min-width: 32px; /* Tamaño mínimo para toque fácil */
        min-height: 32px;
    }
    
    /* En móvil, transición más lenta para toda la info del usuario */
    .user-info {
        transition: opacity 0.6s ease, transform 0.6s ease;
    }
}

.admin-only {
    background: linear-gradient(135deg, #9f7aea 0%, #667eea 100%) !important;
}

.admin-only:hover {
    background: linear-gradient(135deg, #805ad5 0%, #553c9a 100%) !important;
}

/* Reset y estilos base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

/* Header */
.header {
    text-align: center;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 15px;
    padding: 30px;
    margin-bottom: 30px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

.header h1 {
    color: #4a5568;
    font-size: 2.5rem;
    margin-bottom: 10px;
}

.header p {
    color: #718096;
    font-size: 1.1rem;
}

/* Navegación */
.navigation {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-bottom: 30px;
    flex-wrap: wrap;
}

.nav-btn {
    background: rgba(255, 255, 255, 0.9);
    border: none;
    padding: 15px 25px;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 1rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.nav-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.nav-btn.active {
    background: #4299e1;
    color: white;
}

/* Contenido principal */
.main-content {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 15px;
    padding: 30px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

.content-section {
    display: none;
}

.content-section.active {
    display: block;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid #e2e8f0;
}

.section-header h2 {
    color: #4a5568;
    font-size: 1.8rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Búsqueda */
.search-container {
    display: flex;
    gap: 10px;
}

.search-container input {
    padding: 10px 15px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 1rem;
    width: 300px;
}

.search-container button {
    background: #4299e1;
    color: white;
    border: none;
    padding: 10px 15px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.3s ease;
}

.search-container button:hover {
    background: #3182ce;
}

/* Filtros */
.filters-container {
    background: white;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 30px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
}

.filters-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    cursor: pointer;
    padding: 10px 0;
}

.filters-header h3 {
    color: #4a5568;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.btn-toggle-filters {
    background: none;
    border: none;
    color: #718096;
    cursor: pointer;
    padding: 5px;
    border-radius: 5px;
    transition: all 0.3s ease;
}

.btn-toggle-filters:hover {
    background: #f7fafc;
    color: #4a5568;
}

.filters-content {
    overflow: hidden;
    transition: max-height 0.3s ease;
    max-height: 0;
}

.filters-content.expanded {
    max-height: 500px;
}

.filters-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.filter-group {
    display: flex;
    flex-direction: column;
}

.filter-group label {
    font-weight: 500;
    margin-bottom: 8px;
    color: #4a5568;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
}

.filter-group select {
    padding: 10px 12px;
    border: 2px solid #e2e8f0;
    border-radius: 6px;
    font-size: 0.9rem;
    background: white;
    transition: border-color 0.3s ease;
}

.filter-group select:focus {
    outline: none;
    border-color: #4299e1;
}

.filters-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 20px;
    border-top: 1px solid #e2e8f0;
}

.filter-results {
    color: #718096;
    font-weight: 500;
    font-size: 0.9rem;
}

.route-filters {
    background: #f7fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 20px;
}

.route-filters select {
    padding: 10px 12px;
    border: 2px solid #e2e8f0;
    border-radius: 6px;
    font-size: 0.9rem;
    background: white;
    transition: border-color 0.3s ease;
    cursor: pointer;
}

.route-filters select:focus {
    outline: none;
    border-color: #4299e1;
}

.route-filters-selects {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 15px;
}

.route-filters-buttons {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.btn-small {
    padding: 10px 16px;
    font-size: 0.85rem;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

.btn-small:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.btn-small.btn-success {
    background: #38a169;
    color: white;
}

.btn-small.btn-success:hover {
    background: #2f855a;
}

.btn-small.btn-warning {
    background: #ed8936;
    color: white;
}

.btn-small.btn-warning:hover {
    background: #dd6b20;
}

/* Grid de clientes */
.clients-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 20px;
}

.client-card {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
}

.client-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
}

.client-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 15px;
}

.client-name {
    font-weight: 600;
    font-size: 1.1rem;
    color: #2d3748;
}

.client-actions {
    display: flex;
    gap: 5px;
}

.btn-icon {
    background: none;
    border: none;
    padding: 8px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 1rem;
}

.btn-icon.edit {
    color: #4299e1;
}

.btn-icon.edit:hover {
    background: #ebf8ff;
}

.btn-icon.delete {
    color: #e53e3e;
}

.btn-icon.delete:hover {
    background: #fed7d7;
}

.client-info {
    margin-bottom: 10px;
}

.client-info i {
    color: #718096;
    width: 16px;
    margin-right: 8px;
}

.client-location {
    background: #f7fafc;
    padding: 10px;
    border-radius: 8px;
    border-left: 4px solid #4299e1;
    margin-top: 10px;
}

.client-coords {
    font-size: 0.9rem;
    color: #718096;
    margin-top: 5px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.btn-copy {
    background: #e2e8f0;
    color: #4a5568;
    border: none;
    padding: 4px 8px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8rem;
    transition: all 0.3s ease;
    margin-left: 10px;
}

.btn-copy:hover {
    background: #cbd5e0;
    transform: scale(1.05);
}

/* Formularios */
.client-form {
    background: white;
    border-radius: 12px;
    padding: 30px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group.full-width {
    grid-column: 1 / -1;
}

.form-group label {
    font-weight: 500;
    margin-bottom: 8px;
    color: #4a5568;
    display: flex;
    align-items: center;
    gap: 8px;
}

.form-group input {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
    box-sizing: border-box;
}

.form-group input:focus {
    outline: none;
    border-color: #4299e1;
}

.form-group select {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
    box-sizing: border-box;
    background: white;
}

.form-group select:focus {
    outline: none;
    border-color: #4299e1;
}

.form-group textarea {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
    box-sizing: border-box;
    resize: vertical;
    min-height: 100px;
}

.form-group textarea:focus {
    outline: none;
    border-color: #4299e1;
}

.location-input-wrapper {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.location-input-container {
    display: flex;
    gap: 10px;
    align-items: stretch;
}

.location-input-container input {
    flex: 1;
}

.btn-location {
    background: #38a169;
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
}

.btn-location:hover {
    background: #2f855a;
    transform: translateY(-2px);
}

.btn-location:disabled {
    background: #a0aec0;
    cursor: not-allowed;
    transform: none;
}

.btn-location.loading {
    background: #4299e1;
}

.btn-location.loading i {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.form-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    align-items: center;
    flex-wrap: wrap;
}

.form-actions .btn {
    min-width: 140px;
    white-space: nowrap;
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-primary {
    background: #4299e1;
    color: white;
}

.btn-primary:hover {
    background: #3182ce;
    transform: translateY(-2px);
}

.btn-secondary {
    background: #e2e8f0;
    color: #4a5568;
}

.btn-secondary:hover {
    background: #cbd5e0;
}

.btn-tertiary {
    background: #f7fafc;
    color: #718096;
    border: 1px solid #e2e8f0;
}

.btn-tertiary:hover {
    background: #edf2f7;
    color: #4a5568;
}

.btn-large {
    padding: 15px 30px;
    font-size: 1.1rem;
}

/* Planificación de rutas */
.route-planning {
    display: grid;
    gap: 30px;
}

.route-config {
    background: white;
    border-radius: 12px;
    padding: 30px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
}

.clients-selection h3 {
    color: #4a5568;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.route-clients-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.route-client-item {
    background: #f7fafc;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    padding: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 15px;
}

.route-client-item:hover {
    border-color: #4299e1;
    transform: translateY(-2px);
}

.route-client-item.selected {
    border-color: #4299e1;
    background: #ebf8ff;
}

.route-client-checkbox {
    width: 20px;
    height: 20px;
    accent-color: #4299e1;
}

.route-client-info {
    flex: 1;
}

.route-client-name {
    font-weight: 600;
    color: #2d3748;
    margin-bottom: 5px;
}

.route-client-details {
    font-size: 0.9rem;
    color: #718096;
}

.route-actions {
    text-align: center;
    padding: 20px 0;
}

/* Resultado de ruta */
.route-result {
    background: white;
    border-radius: 12px;
    padding: 30px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
}

.route-result h3 {
    color: #4a5568;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.route-summary {
    background: #f0fff4;
    border: 1px solid #9ae6b4;
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 20px;
}

.route-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin: 20px 0;
    flex-wrap: wrap;
}

.route-result-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin: 20px 0;
    flex-wrap: wrap;
}

.btn-maps {
    background: #4285f4;
    color: white;
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
}

.btn-maps:hover {
    background: #3367d6;
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(66, 133, 244, 0.3);
}

.btn-maps:active {
    transform: translateY(0);
}

.summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
}

.summary-item {
    text-align: center;
}

.summary-value {
    font-size: 1.5rem;
    font-weight: 600;
    color: #38a169;
    display: block;
}

.summary-label {
    font-size: 0.9rem;
    color: #718096;
}

.route-steps {
    margin-top: 20px;
}

.route-step {
    background: #f7fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 15px;
}

.step-number {
    background: #4299e1;
    color: white;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    flex-shrink: 0;
}

.step-info {
    flex: 1;
}

.step-client {
    font-weight: 600;
    color: #2d3748;
    margin-bottom: 5px;
}

.step-details {
    font-size: 0.9rem;
    color: #718096;
}

.step-distance {
    text-align: right;
    color: #4299e1;
    font-weight: 500;
}

/* ============================================
   HISTORIAL DE RUTAS
   ============================================ */

.route-history-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.route-history-card {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    border-left: 4px solid #4299e1;
}

.route-history-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.route-history-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 15px;
}

.route-history-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: #2d3748;
    margin: 0;
    flex: 1;
}

.route-history-actions {
    display: flex;
    gap: 8px;
}

.route-history-btn {
    background: none;
    border: none;
    color: #718096;
    cursor: pointer;
    padding: 5px 8px;
    border-radius: 5px;
    font-size: 0.9rem;
    transition: all 0.2s ease;
}

.route-history-btn:hover {
    background: #f7fafc;
    color: #2d3748;
}

.route-history-btn.btn-delete:hover {
    background: #fed7d7;
    color: #c53030;
}

.route-history-info {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 15px;
}

.route-history-info-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    color: #4a5568;
}

.route-history-info-item i {
    color: #4299e1;
    width: 20px;
}

.route-history-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 15px;
    border-top: 1px solid #e2e8f0;
    font-size: 0.85rem;
    color: #718096;
}

.route-history-date {
    display: flex;
    align-items: center;
    gap: 5px;
}

.route-history-clients-count {
    background: #4299e1;
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-weight: 500;
}

.route-history-footer {
    margin-top: 15px;
    display: flex;
    gap: 10px;
}

.route-history-footer .btn {
    flex: 1;
    padding: 8px 16px;
    font-size: 0.9rem;
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #718096;
}

.empty-state i {
    font-size: 4rem;
    color: #cbd5e0;
    margin-bottom: 20px;
    display: block;
}

.empty-state p {
    margin: 10px 0;
    font-size: 1.1rem;
}

/* Estadísticas */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
}

.stat-card {
    background: white;
    border-radius: 12px;
    padding: 25px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
}

.stat-card h3 {
    color: #4a5568;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.stat-number {
    font-size: 3rem;
    font-weight: 600;
    color: #4299e1;
    text-align: center;
    margin-bottom: 10px;
}

.stat-label {
    text-align: center;
    color: #718096;
    font-size: 1.1rem;
}

.stat-list {
    list-style: none;
}

.stat-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid #e2e8f0;
}

.stat-item:last-child {
    border-bottom: none;
}

.stat-item-name {
    color: #4a5568;
    font-weight: 500;
}

.stat-item-count {
    background: #4299e1;
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 500;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    backdrop-filter: blur(5px);
    padding: 20px;
    box-sizing: border-box;
}

.modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: white;
    border-radius: 15px;
    width: 100%;
    max-width: 800px;
    max-height: calc(100vh - 40px);
    overflow-y: auto;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
    margin: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 30px;
    border-bottom: 1px solid #e2e8f0;
}

.modal-header h3 {
    color: #4a5568;
    display: flex;
    align-items: center;
    gap: 10px;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #718096;
    padding: 5px;
    border-radius: 5px;
    transition: all 0.3s ease;
}

.modal-close:hover {
    background: #f7fafc;
    color: #4a5568;
}

/* Loading y estados */
.loading {
    text-align: center;
    padding: 40px;
    color: #718096;
    font-size: 1.1rem;
}

.loading i {
    font-size: 2rem;
    margin-bottom: 10px;
    display: block;
}

.no-data {
    text-align: center;
    padding: 40px;
    color: #718096;
}

.no-data i {
    font-size: 3rem;
    margin-bottom: 15px;
    display: block;
}

/* Notificaciones */
.notifications {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 2000;
}

.notification {
    background: white;
    border-radius: 10px;
    padding: 15px 20px;
    margin-bottom: 10px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    border-left: 4px solid;
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 300px;
    animation: slideIn 0.3s ease;
}

.notification.success {
    border-left-color: #38a169;
}

.notification.error {
    border-left-color: #e53e3e;
}

.notification.warning {
    border-left-color: #ed8936;
    background: #fffbf5;
}

.notification.info {
    border-left-color: #4299e1;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Responsive */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }
    
    .header h1 {
        font-size: 1.8rem;
    }
    
    .navigation {
        justify-content: stretch;
    }
    
    .nav-btn {
        flex: 1;
        justify-content: center;
    }
    
    .section-header {
        flex-direction: column;
        gap: 15px;
        align-items: stretch;
    }
    
    .search-container input {
        width: 100%;
    }
    
    .clients-grid {
        grid-template-columns: 1fr;
    }
    
    .form-grid {
        grid-template-columns: 1fr;
    }
    
    .form-actions {
        flex-direction: column;
        gap: 10px;
    }
    
    .form-actions .btn {
        width: 100%;
        min-width: auto;
        justify-content: center;
    }
    
    .modal-content {
        width: 95%;
    }
    
    .notifications {
        left: 10px;
        right: 10px;
    }
    
    .notification {
        min-width: auto;
    }
    
    .location-input-container {
        flex-direction: column;
        gap: 10px;
    }
    
    .location-input-wrapper {
        gap: 8px;
    }
    
    .coordinate-item-content {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .coordinate-location-info {
        width: 100%;
    }
    
    .coordinate-type-badge {
        align-self: flex-start;
    }
    
    .btn-location {
        justify-content: center;
        padding: 15px 20px;
    }
    
    .route-actions,
    .route-result-actions {
        flex-direction: column;
        align-items: stretch;
    }
    
    .btn-maps,
    .route-actions .btn,
    .route-result-actions .btn {
        justify-content: center;
        padding: 15px 20px;
    }
    
    .filters-grid {
        grid-template-columns: 1fr;
    }
    
    .filters-actions {
        flex-direction: column;
        gap: 15px;
        align-items: stretch;
    }
    
    .route-filters-selects {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    
    .route-filters-buttons {
        flex-direction: column;
        gap: 10px;
    }
    
    .btn-small {
        padding: 12px 15px;
        font-size: 0.9rem;
        justify-content: center;
    }
    
    /* Ensure form elements don't overflow on mobile */
    .form-group input,
    .form-group select,
    .form-group textarea {
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
        margin: 0 !important;
    }
    
    .form-group {
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
        margin: 0;
        padding: 0;
    }
    
    /* Prevent any container overflow */
    .main-content,
    .section {
        overflow-x: hidden;
    }
}

/* Estilos para los botones de navegación */
.client-navigation {
    margin-top: 15px;
    padding: 12px;
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    border-radius: 8px;
    border: 1px solid #cbd5e0;
}

.navigation-buttons {
    display: flex;
    gap: 8px;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
}

.btn-nav {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    border: none;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    min-width: 70px;
    justify-content: center;
}

.btn-nav:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.btn-nav.google-maps {
    background: linear-gradient(135deg, #4285f4 0%, #34a853 100%);
    color: white;
}

.btn-nav.google-maps:hover {
    background: linear-gradient(135deg, #3367d6 0%, #2d8a47 100%);
}

.btn-nav.waze {
    background: linear-gradient(135deg, #00d4aa 0%, #00b8d4 100%);
    color: white;
}

.btn-nav.waze:hover {
    background: linear-gradient(135deg, #00b894 0%, #0099cc 100%);
}

.btn-nav.copy {
    background: linear-gradient(135deg, #6c757d 0%, #495057 100%);
    color: white;
}

.btn-nav.copy:hover {
    background: linear-gradient(135deg, #5a6268 0%, #3d4042 100%);
}

.client-no-location {
    margin-top: 10px;
    padding: 8px 12px;
    background: #fff3cd;
    border: 1px solid #ffeaa7;
    border-radius: 6px;
    color: #856404;
    font-size: 0.9rem;
    text-align: center;
}

.text-warning {
    color: #f39c12 !important;
}

/* Responsive para botones de navegación */
@media (max-width: 768px) {
    .navigation-buttons {
        flex-direction: column;
        gap: 6px;
    }
    
    .btn-nav {
        width: 100%;
        min-width: auto;
    }
}

/* Footer */
.footer {
    margin-top: 60px;
    background: linear-gradient(135deg, #2c3e50 0%, #3498db 100%);
    color: white;
    padding: 40px 0 30px;
    position: relative;
    overflow: hidden;
}

.footer::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #e74c3c, #f39c12, #2ecc71, #3498db, #9b59b6);
}

.footer-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 30px;
}

.footer-info {
    flex: 1;
    min-width: 300px;
}

.footer-info p {
    margin: 0;
    font-size: 0.95rem;
    line-height: 1.6;
}

.footer-info strong {
    color: #3498db;
    font-weight: 600;
    font-size: 1.1rem;
}

.footer-subtitle {
    color: #bdc3c7;
    font-size: 0.85rem;
    margin-top: 5px !important;
    font-style: italic;
}

.footer-tech {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.tech-badge {
    background: rgba(255, 255, 255, 0.1);
    color: #ecf0f1;
    padding: 4px 10px;
    border-radius: 15px;
    font-size: 0.75rem;
    font-weight: 500;
    border: 1px solid rgba(255, 255, 255, 0.2);
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.tech-badge:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.4);
    transform: translateY(-2px);
}

/* Responsive Footer */
@media (max-width: 768px) {
    .footer {
        margin-top: 40px;
        padding: 30px 0 20px;
    }
    
    .footer-content {
        flex-direction: column;
        text-align: center;
        gap: 20px;
    }
    
    .footer-info {
        min-width: auto;
    }
    
    .footer-tech {
        justify-content: center;
    }
    
    .tech-badge {
        font-size: 0.7rem;
        padding: 3px 8px;
    }
}

@media (max-width: 480px) {
    .footer-info p {
        font-size: 0.9rem;
    }
    
    .footer-info strong {
        font-size: 1rem;
    }
    
    .tech-badge {
        font-size: 0.65rem;
        padding: 2px 6px;
    }
    
    /* Extra small screen form fixes */
    .form-group input,
    .form-group select,
    .form-group textarea {
        padding: 10px 12px !important;
        font-size: 16px !important; /* Prevents zoom on iOS */
    }
    
    .container {
        padding: 8px !important;
    }
    
    .main-content {
        padding: 15px !important;
    }
}

/* === BOTÓN SCROLL TO TOP FLOTANTE === */
.scroll-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 56px;
    height: 56px;
    background: #4299e1;
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    font-size: 20px;
    box-shadow: 0 4px 15px rgba(66, 153, 225, 0.4);
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transform: translateY(100px);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    -webkit-tap-highlight-color: rgba(66, 153, 225, 0.3);
    touch-action: manipulation;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    outline: none;
}

.scroll-to-top.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* Hover solo para dispositivos no táctiles */
@media (hover: hover) {
    .scroll-to-top:hover {
        background: #3182ce;
        transform: translateY(-3px);
        box-shadow: 0 6px 20px rgba(66, 153, 225, 0.4);
    }
}

.scroll-to-top:active {
    background: #2c5282;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(66, 153, 225, 0.6);
}

/* Estilos específicos para dispositivos táctiles */
@media (hover: none) {
    .scroll-to-top:active {
        background: #3182ce;
        transform: scale(0.95);
        transition: all 0.1s ease;
    }
}

/* === GRUPO DE INPUT DE DIRECCIÓN === */
.address-input-group {
    display: flex;
    gap: 10px;
    align-items: center;
}

.address-input-group input {
    flex: 1;
}

.btn-location {
    background: #48bb78;
    color: white;
    border: none;
    padding: 12px 16px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 14px;
    min-width: 50px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-location:hover {
    background: #38a169;
    transform: translateY(-1px);
}

.btn-location:disabled {
    background: #a0aec0;
    cursor: not-allowed;
    transform: none;
}

.btn-location.loading {
    background: #4299e1;
}

.btn-location.loading i {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Responsive para móviles */
@media (max-width: 768px) {
    .scroll-to-top {
        bottom: 20px;
        right: 20px;
        width: 60px;
        height: 60px;
        font-size: 22px;
        z-index: 15000;
        box-shadow: 0 6px 25px rgba(66, 153, 225, 0.6);
        border: 3px solid rgba(255, 255, 255, 0.4);
        background: #4299e1;
        min-width: 60px;
        min-height: 60px;
    }
    
    .scroll-to-top.visible {
        opacity: 1;
        visibility: visible;
        transform: translateY(0);
        animation: bounceIn 0.6s ease-out;
    }
    
    .address-input-group {
        flex-direction: column;
        align-items: stretch;
    }
    
    .btn-location {
        width: 100%;
        justify-content: center;
        margin-top: 5px;
    }
}

@keyframes bounceIn {
    0% { 
        opacity: 0; 
        transform: translateY(100px) scale(0.3); 
    }
    50% { 
        opacity: 1; 
        transform: translateY(-10px) scale(1.05); 
    }
    70% { 
        transform: translateY(5px) scale(0.9); 
    }
    100% { 
        transform: translateY(0) scale(1); 
    }
}

/* Estilos adicionales para móviles muy pequeños */
@media (max-width: 480px) {
    .scroll-to-top {
        bottom: 15px;
        right: 15px;
        width: 50px;
        height: 50px;
        font-size: 18px;
        z-index: 15000;
    }
}

/* Estilos para iOS Safari específicamente */
@supports (-webkit-touch-callout: none) {
    .scroll-to-top {
        -webkit-transform: translateZ(0);
        transform: translateZ(0);
        will-change: transform, opacity;
    }
}

/* Estilos específicos para WebViews */
.webview .scroll-to-top,
[data-webview] .scroll-to-top {
    position: fixed !important;
    bottom: 20px !important;
    right: 20px !important;
    width: 65px !important;
    height: 65px !important;
    background: #4299e1 !important;
    color: white !important;
    border: 3px solid rgba(255, 255, 255, 0.5) !important;
    border-radius: 50% !important;
    font-size: 24px !important;
    z-index: 999999 !important;
    cursor: pointer !important;
    box-shadow: 0 8px 30px rgba(66, 153, 225, 0.7) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: all 0.3s ease !important;
    -webkit-tap-highlight-color: rgba(66, 153, 225, 0.4) !important;
    touch-action: manipulation !important;
    -webkit-transform: translateZ(0) !important;
    transform: translateZ(0) !important;
    pointer-events: auto !important;
}

.webview .scroll-to-top.visible,
[data-webview] .scroll-to-top.visible {
    opacity: 1 !important;
    visibility: visible !important;
    transform: translateY(0px) translateZ(0) !important;
    -webkit-transform: translateY(0px) translateZ(0) !important;
}

.webview .scroll-to-top:active,
[data-webview] .scroll-to-top:active {
    background: #2c5282 !important;
    transform: scale(0.9) translateZ(0) !important;
    -webkit-transform: scale(0.9) translateZ(0) !important;
    border-color: rgba(255, 255, 255, 0.8) !important;
}



/* Detectar WebView por User Agent usando CSS */
@media screen and (-webkit-min-device-pixel-ratio:0) {
    body {
        --is-webview: 1;
    }
}

/* === ESTILOS PARA NUEVAS FUNCIONALIDADES === */

/* Campo de archivo (imagen) */
.file-input {
    border: 2px dashed #cbd5e0;
    border-radius: 8px;
    padding: 12px;
    background: #f7fafc;
    cursor: pointer;
    transition: all 0.3s ease;
}

.file-input:hover {
    border-color: #4299e1;
    background: #ebf8ff;
}

.file-input:focus {
    outline: none;
    border-color: #4299e1;
    box-shadow: 0 0 0 3px rgba(66, 153, 225, 0.1);
}

/* Preview de imagen */
.image-preview {
    margin-top: 10px;
    text-align: center;
}

.image-preview img {
    border: 2px solid #e2e8f0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Botón para ver imagen */
.view-image-btn {
    background: #4299e1;
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    text-decoration: none;
    border: 1px solid transparent;
}

.view-image-btn:hover {
    background: #3182ce;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(66, 153, 225, 0.3);
    color: white;
}

.view-image-btn:active {
    transform: translateY(0);
}

.view-image-btn:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(66, 153, 225, 0.2);
}

.client-image-link {
    margin-top: 5px;
}

/* Sección de acciones extendidas del cliente */
.client-actions-extended {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #f1f5f9;
}

.client-actions-extended button,
.client-actions-extended a {
    flex: 0 1 auto;
    white-space: nowrap;
}

/* Modal para imagen completa */
.image-modal-content {
    position: relative;
    margin: auto;
    padding: 20px;
    background: white;
    border-radius: 12px;
    max-width: 95vw;
    max-height: 95vh;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.image-modal-content .close {
    position: absolute;
    top: 10px;
    right: 15px;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    color: #999;
    z-index: 1001;
}

.image-modal-content .close:hover {
    color: #333;
}

/* Botón de teléfono */
.phone-button {
    background: #48bb78;
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    text-decoration: none;
}

.phone-button:hover {
    background: #38a169;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(72, 187, 120, 0.3);
    color: white;
}

.phone-button:active {
    transform: translateY(0);
}

/* Botón de registrar visita */
.visit-button {
    background: #9f7aea;
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.visit-button:hover {
    background: #805ad5;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(159, 122, 234, 0.3);
}

/* Botón de ver visitas */
.visits-history-button {
    background: #ed8936;
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.visits-history-button:hover {
    background: #dd6b20;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(237, 137, 54, 0.3);
}

/* Modal para registrar visitas */
#visit-modal .modal-content {
    max-width: 600px;
    width: 100%;
    margin: 0;
}

#visit-modal .form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    padding: 20px 30px;
}

@media (max-width: 600px) {
    #visit-modal .form-grid {
        padding: 15px;
    }
    
    #visit-modal .form-actions {
        padding: 15px;
    }
}

#visit-modal .form-group.full-width {
    grid-column: 1 / -1;
}

#visit-modal .form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #4a5568;
}

#visit-modal .form-group input,
#visit-modal .form-group select,
#visit-modal .form-group textarea {
    width: 100%;
    max-width: 100%;
    padding: 12px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.3s ease;
    box-sizing: border-box;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

#visit-modal .form-group input:focus,
#visit-modal .form-group select:focus,
#visit-modal .form-group textarea:focus {
    outline: none;
    border-color: #4299e1;
    box-shadow: 0 0 0 3px rgba(66, 153, 225, 0.1);
}

#visit-modal .form-group textarea {
    resize: vertical;
    min-height: 100px;
}

#visit-modal .form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 15px;
    padding: 20px 30px;
    border-top: 1px solid #e2e8f0;
    background: #f7fafc;
    border-bottom-left-radius: 15px;
    border-bottom-right-radius: 15px;
}

#visit-modal .modal-header h2 {
    margin: 0;
    color: #2d3748;
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

#visit-modal .close {
    background: none;
    border: none;
    font-size: 2rem;
    cursor: pointer;
    color: #718096;
    padding: 5px;
    border-radius: 5px;
    transition: all 0.3s ease;
    line-height: 1;
}

#visit-modal .close:hover {
    background: #f7fafc;
    color: #4a5568;
}

/* Modal para historial de visitas */
#visits-list-modal .modal-content {
    max-width: 800px;
    width: 90%;
}

/* Modal grande para listas de visitas */
.modal-large .modal-content {
    max-width: 800px;
    width: 90%;
}

/* Lista de visitas */
.visits-list {
    max-height: 500px;
    overflow-y: auto;
    margin-top: 15px;
}

.visit-item {
    background: #f7fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 12px;
    transition: all 0.3s ease;
}

.visit-item:hover {
    background: #ebf8ff;
    border-color: #4299e1;
}

.visit-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.visit-date {
    font-weight: 600;
    color: #2d3748;
}

.visit-result {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 500;
}

.visit-result.exitosa {
    background: #c6f6d5;
    color: #22543d;
}

.visit-result.reagendar {
    background: #fbb6ce;
    color: #702459;
}

.visit-result.no-disponible {
    background: #fed7d7;
    color: #742a2a;
}

.visit-notes {
    color: #4a5568;
    font-style: italic;
    margin-top: 8px;
}

/* Estilos responsive mejorados */
@media (max-width: 768px) {
    /* Mejoras generales de padding para móviles */
    .modal {
        padding: 10px;
    }
    
    .modal-content {
        max-height: calc(100vh - 20px);
        border-radius: 12px;
    }
    
    /* Botones de acciones de cliente */
    .view-image-btn {
        padding: 6px 10px;
        font-size: 0.8rem;
    }
    
    .phone-button,
    .visit-button,
    .visits-history-button {
        padding: 6px 10px;
        font-size: 0.8rem;
    }
    
    .client-actions-extended {
        justify-content: center;
        gap: 6px;
    }
    
    .client-actions-extended button,
    .client-actions-extended a {
        flex: 1 1 auto;
        min-width: 0;
        text-align: center;
    }
    
    /* Modal de imagen */
    .image-modal-content {
        margin: 0;
        padding: 15px;
        border-radius: 12px;
    }
    
    /* Modal de historial de visitas */
    .modal-large .modal-content {
        margin: 0;
    }
    
    /* Modal de registrar visita - responsive */
    #visit-modal .modal-content {
        margin: 0;
        border-radius: 12px;
    }
    
    #visit-modal .form-grid {
        grid-template-columns: 1fr;
        padding: 15px;
        gap: 15px;
    }
    
    #visit-modal .form-actions {
        padding: 15px;
        flex-direction: column;
        gap: 10px;
    }
    
    #visit-modal .form-actions .btn {
        width: 100%;
        text-align: center;
        padding: 12px;
        font-size: 1rem;
    }
    
    #visit-modal .modal-header {
        padding: 15px;
    }
    
    #visit-modal .modal-header h2 {
        font-size: 1.3rem;
    }
    
    /* Historial de visitas responsive */
    .visit-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    /* Formularios en general */
    .form-grid {
        grid-template-columns: 1fr !important;
        gap: 15px;
    }
    
    .client-form {
        padding: 20px;
        margin: 10px;
    }
}

/* Responsive para pantallas muy pequeñas */
@media (max-width: 480px) {
    .modal {
        padding: 5px;
    }
    
    #visit-modal .form-grid,
    #visit-modal .form-actions,
    #visit-modal .modal-header {
        padding: 10px;
    }
    
    #visit-modal .modal-header h2 {
        font-size: 1.2rem;
    }
    
    .client-actions-extended {
        flex-direction: column;
        gap: 8px;
    }
    
    .client-actions-extended button,
    .client-actions-extended a {
        width: 100%;
        justify-content: center;
    }
    
    /* Prevent horizontal overflow on very small screens - ONLY IN MODALS */
    .modal-content * {
        max-width: 100%;
        box-sizing: border-box;
    }
    
    /* Specific fixes for form elements - ONLY IN MODALS */
    .modal-content input, 
    .modal-content select, 
    .modal-content textarea, 
    .modal-content button {
        min-width: 0;
        word-wrap: break-word;
        overflow-wrap: break-word;
    }
    
    /* Force text wrapping in modals */
    .modal-content {
        word-wrap: break-word;
        overflow-wrap: break-word;
        hyphens: auto;
    }
}

/* === ESTILOS MEJORADOS PARA VISITAS === */

/* Actualización del visit-header */
.visit-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 10px;
    flex-wrap: wrap;
    gap: 10px;
}

.visit-info {
    flex: 1;
    min-width: 200px;
}

.visit-date-time {
    font-weight: 600;
    color: #2d3748;
    margin-bottom: 5px;
}

.visit-date-time i {
    color: #4299e1;
    margin-right: 5px;
}

.visit-type {
    color: #4a5568;
    font-size: 0.9rem;
}

.visit-type i {
    color: #38a169;
    margin-right: 5px;
}

.visit-status {
    flex-shrink: 0;
}

.status-badge {
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.status-badge.exitosa {
    background: #c6f6d5;
    color: #22543d;
}

.status-badge.cliente-no-disponible {
    background: #fed7d7;
    color: #742a2a;
}

.status-badge.reagendar {
    background: #faf089;
    color: #744210;
}

.status-badge.sin-respuesta {
    background: #e2e8f0;
    color: #4a5568;
}

.status-badge.pendiente {
    background: #bee3f8;
    color: #2b6cb0;
}

/* Mantener compatibilidad con estados anteriores */
.status-badge.programada {
    background: #bee3f8;
    color: #2b6cb0;
}

.status-badge.completada {
    background: #c6f6d5;
    color: #22543d;
}

.visit-details {
    margin: 10px 0 15px 0;
    padding: 10px;
    background: #f7fafc;
    border-radius: 6px;
    border-left: 4px solid #4299e1;
}

.visit-user {
    color: #4a5568;
    font-size: 0.9rem;
    margin-bottom: 8px;
}

.visit-user i {
    color: #4299e1;
    margin-right: 5px;
}

.visit-observations {
    color: #2d3748;
    font-style: italic;
    line-height: 1.5;
}

.visit-observations i {
    color: #ed8936;
    margin-right: 5px;
}

.visit-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #e2e8f0;
}

.btn-small {
    padding: 6px 10px;
    font-size: 0.8rem;
    min-width: auto;
}

.btn-small i {
    font-size: 0.9rem;
}

/* Responsive para visitas */
@media (max-width: 768px) {
    .visit-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .visit-info {
        min-width: 100%;
    }
    
    .visit-status {
        align-self: flex-start;
    }
    
    .visit-actions {
        justify-content: center;
    }
    
    .status-badge {
        font-size: 0.75rem;
        padding: 4px 8px;
    }
}

/* ==========================================
   OPTIMIZACIÓN COMPLETA PARA MÓVILES Y TABLETS
   ========================================== */

/* Variables CSS para altura de viewport móvil */
:root {
    --vh: 1vh;
    --animation-duration: 0.3s;
}

/* Optimización base para dispositivos táctiles */
* {
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

/* Permitir selección de texto donde sea necesario */
input, textarea, .selectable, p, h1, h2, h3, h4, h5, h6 {
    -webkit-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
    user-select: text;
}

/* Optimización de scroll para dispositivos táctiles */
.container, .modal-content, .visits-list {
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
}

/* === BREAKPOINTS PARA TABLETS (768px - 1024px) === */
@media (min-width: 768px) and (max-width: 1024px) {
    .container {
        padding: 15px;
    }
    
    .clients-grid {
        grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
        gap: 15px;
    }
    
    .user-info {
        top: 15px;
        right: 15px;
        padding: 12px 16px;
    }
    
    .search-container {
        margin-bottom: 20px;
    }
    
    .btn-add {
        padding: 12px 20px;
        font-size: 0.95rem;
    }
}

/* === BREAKPOINTS PARA MÓVILES GRANDES (481px - 767px) === */
@media (max-width: 767px) {
    .container {
        padding: 10px;
        margin-top: 80px; /* Espacio para user-info */
    }
    
    .user-info {
        position: fixed;
        top: 10px;
        left: 10px;
        right: 10px;
        flex-direction: column;
        gap: 10px;
        padding: 15px;
        border-radius: 15px;
        text-align: center;
    }
    
    .user-details {
        align-items: center;
    }
    
    .logout-btn {
        width: 100%;
        padding: 10px;
        border-radius: 10px;
    }
    
    /* Grid responsive para móviles */
    .clients-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .client-card {
        padding: 15px;
        border-radius: 12px;
    }
    
    .client-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .client-actions {
        width: 100%;
        justify-content: space-between;
        gap: 8px;
    }
    
    .btn-icon {
        padding: 8px;
        min-width: 40px;
        min-height: 40px;
    }
    
    /* Búsqueda optimizada */
    .search-container {
        margin-bottom: 15px;
    }
    
    .search-input {
        font-size: 16px; /* Evita zoom en iOS */
        padding: 12px 15px;
        border-radius: 10px;
    }
    
    .btn-add {
        width: 100%;
        padding: 15px;
        font-size: 1rem;
        border-radius: 10px;
        margin-bottom: 20px;
    }
    
    /* Información del cliente más legible */
    .client-info p {
        margin-bottom: 8px;
        font-size: 0.9rem;
        line-height: 1.4;
    }
    
    .client-image {
        max-width: 100%;
        height: auto;
        border-radius: 8px;
    }
}

/* === BREAKPOINTS PARA MÓVILES PEQUEÑOS (hasta 480px) === */
@media (max-width: 480px) {
    .container {
        padding: 8px;
        margin-top: 90px;
    }
    
    .user-info {
        padding: 12px;
        font-size: 0.85rem;
    }
    
    .user-name {
        font-size: 0.85rem;
    }
    
    .user-role {
        font-size: 0.75rem;
    }
    
    .client-card {
        padding: 12px;
    }
    
    .client-name {
        font-size: 1.1rem;
    }
    
    .client-info p {
        font-size: 0.85rem;
    }
    
    .btn-icon {
        padding: 6px;
        min-width: 36px;
        min-height: 36px;
    }
    
    .btn-icon i {
        font-size: 0.9rem;
    }
    
    .status-badge {
        font-size: 0.7rem;
        padding: 3px 6px;
    }
}

/* === OPTIMIZACIÓN DE MODALES PARA MÓVILES === */
@media (max-width: 767px) {
    .modal {
        padding: 10px;
        align-items: flex-start;
        padding-top: 20px;
    }
    
    .modal-content {
        width: 100%;
        max-width: 100%;
        margin: 0;
        border-radius: 15px 15px 0 0;
        max-height: 90vh;
        overflow-y: auto;
    }
    
    .modal-header {
        padding: 20px 20px 15px;
        border-bottom: 1px solid #e2e8f0;
    }
    
    .modal-header h2 {
        font-size: 1.3rem;
    }
    
    .close {
        font-size: 24px;
        padding: 5px;
        min-width: 30px;
        min-height: 30px;
        line-height: 1;
    }
    
    .modal-body {
        padding: 20px;
    }
    
    .form-group {
        margin-bottom: 20px;
    }
    
    .form-group label {
        font-size: 0.9rem;
        margin-bottom: 8px;
    }
    
    .form-control {
        font-size: 16px; /* Evita zoom en iOS */
        padding: 12px;
        border-radius: 8px;
    }
    
    textarea.form-control {
        min-height: 80px;
    }
    
    .modal-footer {
        padding: 15px 20px 20px;
        gap: 10px;
    }
    
    .modal-footer .btn {
        flex: 1;
        padding: 12px;
        font-size: 0.95rem;
        border-radius: 8px;
    }
}

/* === OPTIMIZACIÓN DE FORMULARIOS PARA MÓVILES === */
@media (max-width: 767px) {
    .form-row {
        display: flex;
        flex-direction: column;
        gap: 15px;
    }
    
    .image-preview {
        max-width: 100%;
        text-align: center;
    }
    
    .image-preview img {
        max-width: 100%;
        height: auto;
        border-radius: 8px;
    }
    
    .btn-small {
        padding: 8px 12px;
        font-size: 0.85rem;
        border-radius: 6px;
        min-height: 36px;
    }
    
    .file-input-wrapper {
        position: relative;
        overflow: hidden;
        display: inline-block;
        width: 100%;
    }
    
    .file-input-wrapper input[type=file] {
        position: absolute;
        left: -9999px;
    }
    
    .file-input-label {
        display: block;
        padding: 12px;
        background: #f7fafc;
        border: 2px dashed #cbd5e0;
        border-radius: 8px;
        text-align: center;
        cursor: pointer;
        transition: all 0.3s ease;
    }
    
    .file-input-label:hover {
        background: #edf2f7;
        border-color: #a0aec0;
    }
}

/* === OPTIMIZACIÓN ESPECÍFICA PARA VISITAS === */
@media (max-width: 767px) {
    .visits-section {
        margin-top: 20px;
    }
    
    .visits-header {
        flex-direction: column;
        gap: 15px;
        align-items: stretch;
    }
    
    .visits-list {
        gap: 10px;
    }
    
    .visit-item {
        padding: 12px;
        border-radius: 8px;
        display: flex;
        flex-direction: column;
        gap: 8px;
    }
    
    .visit-header {
        display: flex;
        justify-content: space-between;
        align-items: flex-start;
        flex-wrap: wrap;
        gap: 8px;
    }
    
    .visit-date {
        font-size: 0.85rem;
        color: #666;
    }
    
    .visit-actions {
        display: flex;
        gap: 5px;
    }
    
    .visit-actions .btn-icon {
        padding: 5px;
        min-width: 32px;
        min-height: 32px;
    }
}

/* === MEJORAS DE ACCESIBILIDAD PARA TÁCTIL === */
@media (hover: none) and (pointer: coarse) {
    .btn, .btn-icon, .close {
        min-height: 44px; /* Tamaño mínimo recomendado para elementos táctiles */
        min-width: 44px;
    }
    
    .form-control, .search-input {
        min-height: 44px;
        font-size: 16px; /* Evita zoom automático en iOS */
    }
    
    .client-card {
        cursor: default;
    }
    
    .client-card:hover {
        transform: none; /* Desactivar hover en dispositivos táctiles */
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    }
}

/* === OPTIMIZACIÓN PARA LANDSCAPE EN MÓVILES === */
@media (max-width: 767px) and (orientation: landscape) {
    .container {
        margin-top: 70px;
    }
    
    .user-info {
        flex-direction: row;
        padding: 10px 15px;
    }
    
    .modal-content {
        max-height: 85vh;
    }
}

/* === ESTILOS ESPECÍFICOS PARA TABLETS EN PORTRAIT === */
@media (min-width: 768px) and (max-width: 1024px) and (orientation: portrait) {
    .clients-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .modal-content {
        width: 90%;
        max-width: 600px;
    }
}

/* === ESTILOS ESPECÍFICOS PARA TABLETS EN LANDSCAPE === */
@media (min-width: 768px) and (max-width: 1024px) and (orientation: landscape) {
    .clients-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .modal-content {
        width: 80%;
        max-width: 700px;
    }
}

/* === ESTILOS PARA INFORMACIÓN DE SEGMENTOS DE RUTA === */
.segment-info {
    background: #e3f2fd;
    border: 1px solid #90caf9;
    border-radius: 8px;
    padding: 12px;
    margin-top: 15px;
    color: #1976d2;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.segment-info i {
    color: #1976d2;
    font-size: 1rem;
}

/* Ajustes para móviles */
@media (max-width: 767px) {
    .segment-info {
        font-size: 0.85rem;
        padding: 10px;
    }
    
    .segment-info i {
        font-size: 0.9rem;
    }
    
    .summary-grid {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
        gap: 10px;
    }
    
    .summary-item {
        text-align: center;
        padding: 8px;
    }
    
    .summary-value {
        font-size: 1.2rem;
        font-weight: bold;
        color: #4299e1;
        display: block;
    }
    
    .summary-label {
        font-size: 0.8rem;
        color: #666;
        display: block;
        margin-top: 4px;
    }
}

/* ==========================================
   MODAL DE CONTACTO MEJORADO
   ========================================== */

.contact-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    backdrop-filter: blur(3px);
}

.contact-modal-content {
    background: white;
    border-radius: 15px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
    max-width: 400px;
    width: 90%;
    overflow: hidden;
    animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-30px) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.contact-modal-header {
    background: linear-gradient(135deg, #4299e1 0%, #3182ce 100%);
    color: white;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.contact-modal-header h3 {
    margin: 0;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.close-contact-modal {
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    padding: 5px;
    border-radius: 50%;
    width: 35px;
    height: 35px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.close-contact-modal:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: rotate(90deg);
}

.contact-modal-body {
    padding: 25px;
}

.contact-options {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.contact-option {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    background: white;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: left;
}

.contact-option:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
}

.contact-option.whatsapp {
    border-color: #25d366;
}

.contact-option.whatsapp:hover {
    background: #f0fdf4;
    border-color: #16a34a;
}

.contact-option.whatsapp i {
    color: #25d366;
    font-size: 24px;
}

.contact-option.phone-call {
    border-color: #4299e1;
}

.contact-option.phone-call:hover {
    background: #f0f9ff;
    border-color: #3182ce;
}

.contact-option.phone-call i {
    color: #4299e1;
    font-size: 20px;
}

.contact-option.copy-phone {
    border-color: #8b5cf6;
}

.contact-option.copy-phone:hover {
    background: #faf5ff;
    border-color: #7c3aed;
}

.contact-option.copy-phone i {
    color: #8b5cf6;
    font-size: 18px;
}

.option-info {
    display: flex;
    flex-direction: column;
    gap: 3px;
    flex: 1;
}

.option-title {
    font-weight: 600;
    font-size: 1rem;
    color: #2d3748;
}

.option-desc {
    font-size: 0.85rem;
    color: #718096;
}

/* Botón de contacto principal */
.contact-button {
    background: linear-gradient(135deg, #4299e1 0%, #3182ce 100%);
    color: white;
    border: none;
    padding: 10px 15px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    font-weight: 500;
}

.contact-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(66, 153, 225, 0.3);
    background: linear-gradient(135deg, #3182ce 0%, #2c5aa0 100%);
}

.contact-button i {
    font-size: 1rem;
}

/* Responsive para móviles */
@media (max-width: 767px) {
    .contact-modal-content {
        width: 95%;
        margin: 20px;
    }
    
    .contact-modal-header {
        padding: 15px;
    }
    
    .contact-modal-header h3 {
        font-size: 1rem;
    }
    
    .contact-modal-body {
        padding: 20px;
    }
    
    .contact-option {
        padding: 12px;
        gap: 12px;
    }
    
    .contact-option i {
        font-size: 20px !important;
    }
    
    .option-title {
        font-size: 0.95rem;
    }
    
    .option-desc {
        font-size: 0.8rem;
    }
    
    .contact-button {
        padding: 12px 16px;
        font-size: 0.95rem;
        border-radius: 10px;
    }
}

/* Animaciones táctiles */
@media (hover: none) and (pointer: coarse) {
    .contact-option:active {
        transform: scale(0.98);
    }
    
    .contact-button:active {
        transform: scale(0.95);
    }
    
    .close-contact-modal:active {
        transform: scale(0.9);
    }
}

/* ==========================================
   DASHBOARD DE ESTADÍSTICAS MEJORADO
   ========================================== */

.stats-dashboard {
    display: grid;
    gap: 25px;
    padding: 20px 0;
}

.stats-filters {
    display: flex;
    gap: 10px;
    align-items: center;
}

.stats-filters select {
    padding: 8px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: white;
    color: #2d3748;
    font-size: 0.9rem;
}

.refresh-btn {
    background: #4299e1;
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.refresh-btn:hover {
    background: #3182ce;
    transform: translateY(-1px);
}

/* Métricas principales */
.stats-metrics {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.metric-card {
    background: white;
    border-radius: 15px;
    padding: 25px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    border: 1px solid #f1f5f9;
    display: flex;
    align-items: center;
    gap: 20px;
    transition: all 0.3s ease;
}

.metric-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

.metric-icon {
    width: 60px;
    height: 60px;
    border-radius: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: white;
}

.metric-icon.visits {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.metric-icon.compliance {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

.metric-icon.daily {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
}

.metric-icon.contacts {
    background: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%);
}

.metric-info {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.metric-value {
    font-size: 2rem;
    font-weight: 700;
    color: #2d3748;
    line-height: 1;
}

.metric-label {
    font-size: 0.9rem;
    color: #718096;
    font-weight: 500;
}

/* Gráficos */
.stats-charts {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 25px;
    margin-bottom: 30px;
}

.chart-container {
    background: white;
    border-radius: 15px;
    padding: 25px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    border: 1px solid #f1f5f9;
}

.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #f1f5f9;
}

.chart-header h3 {
    margin: 0;
    font-size: 1.1rem;
    color: #2d3748;
    display: flex;
    align-items: center;
    gap: 10px;
}

.compliance-legend {
    display: flex;
    gap: 15px;
    font-size: 0.85rem;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 5px;
}

.legend-color {
    width: 12px;
    height: 12px;
    border-radius: 2px;
}

.legend-color.goal {
    background: #ef4444;
}

.chart-content {
    position: relative;
    height: 300px;
}

/* Estadísticas detalladas */
.detailed-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 25px;
}

.stats-section {
    background: white;
    border-radius: 15px;
    padding: 25px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    border: 1px solid #f1f5f9;
}

.stats-section h3 {
    margin: 0 0 20px 0;
    font-size: 1.1rem;
    color: #2d3748;
    display: flex;
    align-items: center;
    gap: 10px;
    padding-bottom: 15px;
    border-bottom: 1px solid #f1f5f9;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 15px;
}

.stat-item {
    text-align: center;
    padding: 15px;
    border-radius: 10px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
}

.stat-item .stat-value {
    font-size: 1.5rem;
    font-weight: 600;
    color: #4299e1;
    display: block;
}

.stat-item .stat-label {
    font-size: 0.8rem;
    color: #718096;
    margin-top: 5px;
}

.activity-list {
    max-height: 300px;
    overflow-y: auto;
}

.activity-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid #f1f5f9;
}

.activity-item:last-child {
    border-bottom: none;
}

.activity-icon {
    width: 35px;
    height: 35px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    color: white;
}

.activity-icon.visit {
    background: #4299e1;
}

.activity-icon.contact {
    background: #48bb78;
}

.activity-icon.client {
    background: #ed8936;
}

.activity-details {
    flex: 1;
}

.activity-text {
    font-size: 0.9rem;
    color: #2d3748;
    margin-bottom: 2px;
}

.activity-time {
    font-size: 0.8rem;
    color: #718096;
}

/* Responsive para móviles */
@media (max-width: 767px) {
    .stats-dashboard {
        padding: 15px 0;
        gap: 20px;
    }
    
    .stats-metrics {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .metric-card {
        padding: 20px;
        gap: 15px;
    }
    
    .metric-icon {
        width: 50px;
        height: 50px;
        font-size: 20px;
    }
    
    .metric-value {
        font-size: 1.5rem;
    }
    
    .stats-charts {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .chart-container {
        padding: 20px;
    }
    
    .chart-content {
        height: 250px;
    }
    
    .detailed-stats {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .stats-section {
        padding: 20px;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
    
    .stats-filters {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }
    
    .stats-filters select,
    .refresh-btn {
        width: 100%;
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .metric-card {
        flex-direction: column;
        text-align: center;
        gap: 12px;
    }
    
    .metric-value {
        font-size: 1.8rem;
    }
    
    .chart-content {
        height: 200px;
    }
}

/* ==========================================
   ESTILOS PARA ESTADÍSTICAS LEGACY
   ========================================== */

.stats-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: white;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    display: flex;
    align-items: center;
    transition: transform 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
}

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 15px;
    font-size: 24px;
    color: white;
}

.stat-icon.visits {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.stat-icon.compliance.success {
    background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
}

.stat-icon.compliance.warning {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

.stat-icon.compliance.danger {
    background: linear-gradient(135deg, #fc466b 0%, #3f5efb 100%);
}

.stat-icon.daily {
    background: linear-gradient(135deg, #ffecd2 0%, #fcb69f 100%);
    color: #8b5a2b;
}

.stat-icon.clients {
    background: linear-gradient(135deg, #a8edea 0%, #fed6e3 100%);
    color: #2c3e50;
}

.stat-info h3 {
    margin: 0;
    font-size: 2.2em;
    font-weight: bold;
    color: #2c3e50;
}

.stat-info p {
    margin: 5px 0 0 0;
    color: #7f8c8d;
    font-size: 0.9em;
}

.stats-details {
    background: white;
    border-radius: 10px;
    padding: 25px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.compliance-info h4, .recent-visits h4 {
    color: #2c3e50;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.compliance-info p {
    margin: 8px 0;
    color: #34495e;
}

.status {
    padding: 4px 8px;
    border-radius: 15px;
    font-weight: bold;
    font-size: 0.9em;
}

.status.success {
    background-color: #d4edda;
    color: #155724;
}

.status.warning {
    background-color: #fff3cd;
    color: #856404;
}

.status.danger {
    background-color: #f8d7da;
    color: #721c24;
}

.recent-visits {
    margin-top: 25px;
    padding-top: 25px;
    border-top: 1px solid #ecf0f1;
}

.visits-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.visit-item {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 15px;
    border-left: 4px solid #3498db;
}

.visit-info strong {
    color: #2c3e50;
    font-size: 1.1em;
}

.visit-details {
    display: block;
    color: #7f8c8d;
    font-size: 0.9em;
    margin: 4px 0;
}

.visit-user {
    display: block;
    color: #95a5a6;
    font-size: 0.85em;
    font-style: italic;
}

/* Responsive para estadísticas legacy */
@media (max-width: 768px) {
    .stats-summary {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .stat-card {
        padding: 15px;
    }
    
    .stat-icon {
        width: 50px;
        height: 50px;
        font-size: 20px;
        margin-right: 12px;
    }
    
    .stat-info h3 {
        font-size: 1.8em;
    }
    
    .stats-details {
        padding: 20px;
    }
    
    .visit-item {
        padding: 12px;
    }
}

/* ============================================
   MÓDULO DE OPTIMIZACIÓN POR COORDENADAS
   ============================================ */

.coordinates-route-planning {
    max-width: 1200px;
    margin: 0 auto;
}

.info-box {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 30px;
    display: flex;
    align-items: flex-start;
    gap: 15px;
    box-shadow: 0 4px 6px rgba(102, 126, 234, 0.2);
}

.info-box i {
    font-size: 1.5rem;
    margin-top: 3px;
    flex-shrink: 0;
}

.info-box strong {
    display: block;
    font-size: 1.1rem;
    margin-bottom: 8px;
}

.info-box p {
    margin: 0;
    opacity: 0.95;
    line-height: 1.5;
}

.coordinates-input-method {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    border-bottom: 2px solid #e2e8f0;
}

.btn-method {
    flex: 1;
    padding: 12px 20px;
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    color: #718096;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-method:hover {
    color: #4299e1;
    background: rgba(66, 153, 225, 0.05);
}

.btn-method.active {
    color: #4299e1;
    border-bottom-color: #4299e1;
    background: rgba(66, 153, 225, 0.1);
}

.coordinates-entry {
    animation: fadeIn 0.3s ease;
}

.coordinates-items-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 20px;
}

.coordinate-item {
    background: #f7fafc;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    padding: 20px;
    transition: all 0.3s ease;
}

.coordinate-item:hover {
    border-color: #cbd5e0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.coordinate-item-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 15px;
}

.coordinate-item-number {
    background: #4299e1;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.9rem;
}

.coordinate-item-remove {
    background: #fc8181;
    color: white;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.coordinate-item-remove:hover {
    background: #f56565;
    transform: scale(1.1);
}

.coordinate-item-content {
    display: flex;
    align-items: center;
    gap: 10px;
}

.coordinate-location-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.coordinate-label {
    font-weight: 600;
    color: #2d3748;
    font-size: 0.95rem;
}

.coordinate-location-text {
    font-family: 'Courier New', monospace;
    font-size: 0.85rem;
    color: #4a5568;
    padding: 6px 10px;
    background: #f7fafc;
    border-radius: 4px;
    border: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    gap: 6px;
}

.coordinate-location-text i {
    color: #4299e1;
}

.coordinate-type-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

.coordinate-type-badge.type-coordinates {
    background: #bee3f8;
    color: #2c5282;
}

.coordinate-type-badge.type-pluscode {
    background: #c6f6d5;
    color: #22543d;
}

.coordinate-item-fields {
    display: grid;
    grid-template-columns: 1fr 1fr 2fr;
    gap: 15px;
}

.coordinate-field {
    display: flex;
    flex-direction: column;
}

.coordinate-field label {
    font-size: 0.85rem;
    color: #4a5568;
    margin-bottom: 5px;
    font-weight: 500;
}

.coordinate-field input {
    padding: 10px 12px;
    border: 1px solid #cbd5e0;
    border-radius: 6px;
    font-size: 0.95rem;
    transition: border-color 0.2s ease;
}

.coordinate-field input:focus {
    outline: none;
    border-color: #4299e1;
    box-shadow: 0 0 0 3px rgba(66, 153, 225, 0.1);
}

.btn-add {
    width: 100%;
    margin-top: 10px;
}

.coordinates-preview {
    background: #f7fafc;
    border: 2px dashed #cbd5e0;
    border-radius: 10px;
    padding: 20px;
    margin-top: 20px;
}

.coordinates-preview h4 {
    color: #2d3748;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.coordinates-preview-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 10px;
    margin-bottom: 15px;
}

.coord-preview-item {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 12px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.coord-preview-icon {
    background: #4299e1;
    color: white;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    font-weight: 600;
    flex-shrink: 0;
}

.coord-preview-info {
    flex: 1;
    min-width: 0;
}

.coord-preview-label {
    font-weight: 500;
    color: #2d3748;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.coord-preview-coords {
    font-size: 0.85rem;
    color: #718096;
    font-family: 'Courier New', monospace;
}

.badge-new {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 2px 4px rgba(245, 87, 108, 0.3);
}

/* Responsive para módulo de coordenadas */
@media (max-width: 768px) {
    .coordinates-input-method {
        flex-direction: column;
    }

    .btn-method {
        border-bottom: none;
        border-left: 3px solid transparent;
        justify-content: flex-start;
    }

    .btn-method.active {
        border-bottom-color: transparent;
        border-left-color: #4299e1;
    }

    .coordinate-item-fields {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .coordinates-preview-list {
        grid-template-columns: 1fr;
    }

    .info-box {
        flex-direction: column;
        text-align: center;
    }

    .info-box i {
        margin: 0 auto 10px;
    }
}

/* Animaciones */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}