:root {
    --primary: #4CAF50;
    --primary-dark: #388E3C;
    --secondary: #FF9800;
    --light: #f5f5f5;
    --dark: #333;
    --gray: #757575;
    --white: #ffffff;
    --shadow: 0 2px 10px rgba(0,0,0,0.1);
    --danger: #f44336;
    --success: #4CAF50;
    --warning: #FF9800;
    --sidebar-width: 280px;
    --bottom-nav-height: 70px; /* ALTURA FIJA PARA NAV INFERIOR */
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, 'Roboto', sans-serif;
    -webkit-tap-highlight-color: transparent;
}

body {
    background-color: var(--light);
    color: var(--dark);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
    padding-bottom: var(--bottom-nav-height); /* PADDING PARA NAV INFERIOR */
}

.app-container {
    display: flex;
    min-height: 100vh;
    position: relative;
}

/* Sidebar Overlay */
.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 999;
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.sidebar-overlay.active {
    display: block;
    opacity: 1;
}

/* Sidebar */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--white);
    box-shadow: 2px 0 10px rgba(0,0,0,0.1);
    z-index: 1000;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.sidebar.active {
    transform: translateX(0);
}

.sidebar-header {
    padding: 20px;
    background: var(--primary);
    color: var(--white);
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
}

.sidebar-logo {
    font-size: 2rem;
    margin-right: 10px;
}

.sidebar-header h2 {
    font-size: 1.2rem;
    flex: 1;
}

.sidebar-close {
    background: none;
    border: none;
    color: var(--white);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 5px;
}

.sidebar-menu {
    flex: 1;
    padding: 20px 0;
}

.sidebar-item {
    display: flex;
    align-items: center;
    padding: 15px 20px;
    color: var(--dark);
    text-decoration: none;
    border-left: 3px solid transparent;
    transition: all 0.3s;
    position: relative;
}

.sidebar-item:hover {
    background: var(--light);
    color: var(--primary);
    border-left-color: var(--primary);
}

.sidebar-item.active {
    background: var(--light);
    color: var(--primary);
    border-left-color: var(--primary);
    font-weight: 600;
}

.sidebar-item i {
    width: 24px;
    margin-right: 15px;
    font-size: 1.1rem;
}

.badge {
    background: var(--danger);
    color: var(--white);
    border-radius: 50%;
    padding: 2px 8px;
    font-size: 0.8rem;
    margin-left: auto;
}

.sidebar-footer {
    padding: 20px;
    border-top: 1px solid #eee;
}

.user-info {
    display: flex;
    align-items: center;
    margin-bottom: 20px;
}

.user-info i {
    font-size: 2rem;
    margin-right: 10px;
    color: var(--primary);
}

.user-info div {
    flex: 1;
}

.user-info strong {
    display: block;
    font-size: 0.9rem;
}

.user-info small {
    color: var(--gray);
    font-size: 0.8rem;
}

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: calc(100vh - var(--bottom-nav-height)); /* AJUSTE PARA NAV INFERIOR */
    width: 100%;
    transition: margin-left 0.3s ease;
}

.sidebar.active + .main-content {
    margin-left: var(--sidebar-width);
}

/* Header */
header {
    background: var(--white);
    color: var(--dark);
    padding: 15px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 100;
}

.menu-toggle {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--primary);
    cursor: pointer;
    padding: 5px 10px;
    display: none;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
}

.logo h1 {
    font-size: 1.5rem;
    font-weight: 600;
}

.logo-icon {
    font-size: 1.8rem;
    color: var(--primary);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 15px;
}

.current-date {
    font-size: 0.9rem;
    color: var(--gray);
    text-align: right;
}

/* Main Content */
main {
    flex: 1;
    padding: 20px;
    animation: fadeIn 0.3s;
    -webkit-animation: fadeIn 0.3s;
    padding-bottom: 30px; /* ESPACIO EXTRA PARA NAV INFERIOR */
}

.page {
    display: none;
}

.page.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Dashboard */
.dashboard-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.dashboard-card {
    background: var(--white);
    border-radius: 12px;
    padding: 20px;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 15px;
    transition: transform 0.3s;
}

.dashboard-card:hover {
    transform: translateY(-5px);
}

.dashboard-icon {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--primary);
    color: var(--white);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.dashboard-info h3 {
    font-size: 0.9rem;
    color: var(--gray);
    margin-bottom: 5px;
}

.dashboard-value {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--primary);
}

.dashboard-subtitle {
    font-size: 0.9rem;
    color: var(--gray);
    margin-top: 5px;
}

.quick-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
    margin-bottom: 30px;
}

.quick-action-btn {
    background: var(--white);
    border: 2px solid var(--light);
    border-radius: 10px;
    padding: 20px 15px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
}

.quick-action-btn:hover {
    border-color: var(--primary);
    transform: scale(1.05);
}

.quick-action-btn i {
    font-size: 2rem;
    color: var(--primary);
    margin-bottom: 10px;
}

.quick-action-btn span {
    display: block;
    font-weight: 600;
    color: var(--dark);
}

/* Orders Page */
.order-status-filter {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    overflow-x: auto;
    padding-bottom: 10px;
}

.status-btn {
    padding: 8px 15px;
    border: 2px solid var(--light);
    background: var(--white);
    border-radius: 20px;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.3s;
}

.status-btn.active {
    background: var(--primary);
    color: var(--white);
    border-color: var(--primary);
}

.status-btn:hover:not(.active) {
    border-color: var(--primary);
}

.order-item {
    background: var(--white);
    border-radius: 10px;
    padding: 15px;
    margin-bottom: 15px;
    box-shadow: var(--shadow);
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-left: 4px solid var(--primary);
}

.order-item.pending {
    border-left-color: var(--warning);
}

.order-item.delivered {
    border-left-color: var(--success);
}

.order-item.cancelled {
    border-left-color: var(--danger);
}

.order-info h3 {
    margin-bottom: 5px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.order-status {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 600;
}

.order-status.pending {
    background: #FFF3CD;
    color: #856404;
}

.order-status.delivered {
    background: #D4EDDA;
    color: #155724;
}

.order-status.cancelled {
    background: #F8D7DA;
    color: #721C24;
}

.order-details {
    color: var(--gray);
    font-size: 0.9rem;
    margin: 5px 0;
}

.order-delivery {
    color: var(--primary);
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 5px;
}

.order-actions {
    display: flex;
    gap: 10px;
}

/* Map Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    padding: 20px;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--white);
    border-radius: 12px;
    width: 100%;
    max-width: 800px;
    max-height: 90vh;
    overflow-y: auto;
    animation: modalFadeIn 0.3s;
}

@keyframes modalFadeIn {
    from { opacity: 0; transform: translateY(-20px); }
    to { opacity: 1; transform: translateY(0); }
}

.modal-header {
    padding: 20px;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: 10px;
}

.close-modal {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--gray);
    cursor: pointer;
    padding: 8px;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s;
}

.close-modal:hover {
    background: rgba(244, 67, 54, 0.1);
    color: var(--danger);
    transform: rotate(90deg);
}

.close-modal:active {
    transform: rotate(90deg) scale(0.9);
}

.modal-body {
    padding: 20px;
}

.map-coordinates {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-top: 15px;
    margin-bottom: 20px;
}

.coordinate label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    color: var(--dark);
}

.coordinate input {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 0.9rem;
}

.map-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

/* Form Styles */
.card {
    background: var(--white);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: var(--shadow);
    transition: transform 0.2s;
}

.card:active {
    transform: scale(0.98);
}

.card h2, .card h3 {
    margin-bottom: 15px;
    color: var(--primary);
}

.btn {
    padding: 12px 20px;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 1rem;
    touch-action: manipulation;
    user-select: none;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn:active {
    transform: scale(0.95);
}

.btn-primary {
    background: var(--primary);
    color: var(--white);
}

.btn-primary:hover, .btn-primary:active {
    background: var(--primary-dark);
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--primary);
    color: var(--primary);
    padding: 10px 15px;
}

.btn-outline:hover, .btn-outline:active {
    background: var(--primary);
    color: var(--white);
}

.btn-danger {
    background: var(--danger);
    color: var(--white);
}

.btn-success {
    background: var(--success);
    color: var(--white);
}

.btn-warning {
    background: var(--warning);
    color: var(--white);
}

.form-group {
    margin-bottom: 15px;
}

.form-label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    color: var(--dark);
}

.form-input {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 1rem;
    background: var(--white);
    -webkit-appearance: none;
    appearance: none;
}

.form-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(76, 175, 80, 0.2);
}

select.form-input {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%23757575' viewBox='0 0 16 16'%3E%3Cpath d='M7.247 11.14 2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px;
    padding-right: 40px;
}

.location-info {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 10px;
    padding: 10px;
    background: var(--light);
    border-radius: 8px;
    font-size: 0.9rem;
}

.location-icon {
    color: var(--primary);
    flex-shrink: 0;
}

.client-list, .sales-list, .orders-list {
    list-style: none;
}

.client-item, .sale-item, .order-item {
    padding: 15px;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background-color 0.2s;
}

.client-item:active, .sale-item:active, .order-item:active {
    background-color: var(--light);
}

.client-actions {
    display: flex;
    gap: 5px;
    flex-shrink: 0;
}

.client-actions .btn {
    padding: 8px 12px;
    font-size: 0.9rem;
    min-width: auto;
}

.client-info h3, .sale-info h3 {
    margin-bottom: 5px;
    font-size: 1rem;
}

/* ESTILOS PARA TELÉFONO Y UBICACIÓN CLICABLES */
.client-phone {
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 8px;
    border-radius: 6px;
    background-color: rgba(76, 175, 80, 0.1);
    transition: all 0.2s;
}

.client-phone:hover {
    background-color: rgba(76, 175, 80, 0.2);
    transform: translateY(-1px);
}

.client-phone:active {
    transform: scale(0.98);
}

.client-location {
    color: var(--gray);
    font-size: 0.85rem;
    margin: 3px 0;
}

.client-location-link {
    color: var(--secondary);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 8px;
    border-radius: 6px;
    background-color: rgba(255, 152, 0, 0.1);
    transition: all 0.2s;
    cursor: pointer;
}

.client-location-link:hover {
    background-color: rgba(255, 152, 0, 0.2);
    transform: translateY(-1px);
}

.client-location-link:active {
    transform: scale(0.98);
}

.sale-details {
    color: var(--gray);
    font-size: 0.85rem;
}

.sale-amount {
    font-weight: 600;
    color: var(--primary);
    font-size: 1.1rem;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.stat-card {
    background: var(--white);
    border-radius: 10px;
    padding: 15px;
    text-align: center;
    box-shadow: var(--shadow);
}

.stat-value {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--primary);
    margin: 10px 0;
}

.stat-label {
    font-size: 0.9rem;
    color: var(--gray);
}

.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--gray);
}

.empty-state-icon {
    font-size: 3rem;
    margin-bottom: 15px;
    opacity: 0.5;
    color: var(--primary);
}

.notification {
    position: fixed;
    top: 70px;
    right: 15px;
    left: 15px;
    background: var(--primary);
    color: var(--white);
    padding: 12px 15px;
    border-radius: 8px;
    box-shadow: var(--shadow);
    z-index: 1000;
    display: none;
    text-align: center;
    font-weight: 500;
    animation: slideDown 0.3s;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

@keyframes slideDown {
    from { transform: translateY(-20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.receipt-preview {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 90%;
    max-width: 400px;
    max-height: 80vh;
    overflow-y: auto;
    z-index: 1000;
    background: white;
    padding: 20px;
    border-radius: 10px;
    margin: 15px 0;
    box-shadow: 0 5px 30px rgba(0,0,0,0.3);
    display: none;
}

.receipt-header {
    text-align: center;
    margin-bottom: 20px;
    border-bottom: 2px solid var(--primary);
    padding-bottom: 15px;
    position: relative;
}

.receipt-header h2 {
    color: var(--primary);
    margin-bottom: 8px;
    font-size: 1.8rem;
    font-weight: 700;
}

.receipt-header p {
    color: var(--gray);
    font-size: 0.95rem;
    margin: 5px 0;
    line-height: 1.5;
}

.receipt-details {
    margin: 15px 0;
}

.receipt-details p {
    margin: 10px 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px dashed #eee;
}

.receipt-details strong {
    color: var(--dark);
    display: flex;
    align-items: center;
    gap: 8px;
}

.receipt-details hr {
    border: none;
    border-top: 2px solid var(--primary);
    margin: 15px 0;
}

.receipt-total {
    font-size: 1.2rem;
    font-weight: bold;
    text-align: right;
    margin-top: 20px;
    padding-top: 10px;
    border-top: 2px solid #eee;
    color: var(--primary);
}

.sale-actions {
    display: flex;
    gap: 10px;
    margin-top: 10px;
}

.sale-actions .btn {
    flex: 1;
}

.receipt-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
    flex-wrap: wrap;
}

.receipt-actions .btn {
    flex: 1;
    min-width: 120px;
}

/* Estilos para impresión */
@media print {
    body * {
        visibility: hidden;
    }
    
    .receipt-preview,
    .receipt-preview * {
        visibility: visible;
    }
    
    .receipt-preview {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        max-width: 100%;
        height: auto;
        max-height: none;
        transform: none;
        box-shadow: none;
        border-radius: 0;
        padding: 20mm;
        margin: 0;
        overflow: visible;
    }
    
    .receipt-actions,
    .close-receipt {
        display: none !important;
    }
    
    .receipt-header {
        border-bottom: 3px solid #4CAF50;
        padding-bottom: 15px;
        margin-bottom: 25px;
    }
    
    .receipt-header h2 {
        font-size: 28pt;
        color: #4CAF50;
        margin-bottom: 8px;
    }
    
    .receipt-header p {
        font-size: 12pt;
        color: #666;
    }
    
    .receipt-details p {
        font-size: 11pt;
        padding: 10px 0;
        border-bottom: 1px dashed #ccc;
    }
    
    .receipt-details strong {
        font-size: 11pt;
        color: #333;
    }
    
    .receipt-total {
        font-size: 18pt;
        color: #4CAF50;
        border-top: 3px solid #4CAF50;
        padding-top: 15px;
        margin-top: 25px;
    }
    
    .receipt-details hr {
        border-top: 2px solid #4CAF50;
        margin: 20px 0;
    }
    
    /* Agregar pie de página */
    .receipt-preview::after {
        content: "Gracias por su compra - GallOli";
        display: block;
        text-align: center;
        margin-top: 30px;
        padding-top: 20px;
        border-top: 1px solid #ccc;
        font-size: 10pt;
        color: #999;
    }
}

/* Bottom Navigation - MEJORADA */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--white);
    display: none;
    justify-content: space-around;
    padding: 10px 0 15px 0; /* MÁS PADDING ABAJO */
    box-shadow: 0 -2px 15px rgba(0,0,0,0.1);
    z-index: 100;
    border-top: 1px solid #eee;
    height: var(--bottom-nav-height);
    backdrop-filter: blur(10px);
    background-color: rgba(255, 255, 255, 0.95);
}

.bottom-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 8px 5px;
    background: none;
    border: none;
    color: var(--gray);
    font-size: 0.75rem;
    cursor: pointer;
    touch-action: manipulation;
    width: 20%;
    transition: all 0.3s;
    position: relative;
    border-radius: 10px;
}

.bottom-nav-item.active {
    color: var(--primary);
    background-color: rgba(76, 175, 80, 0.1);
    transform: translateY(-5px);
}

.bottom-nav-item:hover:not(.active) {
    color: var(--primary-dark);
    background-color: rgba(76, 175, 80, 0.05);
}

.bottom-nav-icon {
    font-size: 1.4rem;
    margin-bottom: 5px;
    transition: transform 0.3s;
}

.bottom-nav-item.active .bottom-nav-icon {
    transform: scale(1.1);
}

.badge-mini {
    position: absolute;
    top: 0;
    right: 5px;
    background: var(--danger);
    color: var(--white);
    border-radius: 50%;
    width: 18px;
    height: 18px;
    font-size: 0.7rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    box-shadow: 0 2px 5px rgba(244, 67, 54, 0.3);
}

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255,255,255,0.9);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 2000;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--light);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Date Filter */
.date-filter {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

.date-input {
    flex: 1;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 8px;
}

/* Responsive */
@media (max-width: 1024px) {
    .menu-toggle {
        display: block;
    }
    
    .sidebar {
        transform: translateX(-100%);
    }
    
    .sidebar.active {
        transform: translateX(0);
    }
    
    .sidebar.active + .main-content {
        margin-left: 0;
    }
    
    .header-actions .btn {
        padding: 8px 12px;
    }
}

@media (max-width: 768px) {
    .dashboard-stats {
        grid-template-columns: 1fr;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .quick-actions {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .bottom-nav {
        display: flex;
    }
    
    .sidebar-footer {
        display: none;
    }
    
    .current-date {
        font-size: 0.8rem;
    }
    
    /* Ajustes para móviles */
    main {
        padding-bottom: calc(var(--bottom-nav-height) + 20px);
    }
}

@media (max-width: 480px) {
    main {
        padding: 15px;
        padding-bottom: calc(var(--bottom-nav-height) + 30px);
    }
    
    .card {
        padding: 15px;
    }
    
    .btn {
        padding: 10px 15px;
        font-size: 0.9rem;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
    
    .stat-card {
        padding: 10px;
    }
    
    .stat-value {
        font-size: 1.5rem;
    }
    
    .quick-actions {
        grid-template-columns: 1fr;
    }
    
    .modal-content {
        margin: 10px;
    }
    
    .map-coordinates {
        grid-template-columns: 1fr;
    }
    
    /* Bottom nav más compacta en móviles muy pequeños */
    .bottom-nav-item {
        font-size: 0.7rem;
        padding: 6px 3px;
    }
    
    .bottom-nav-icon {
        font-size: 1.2rem;
    }
}

/* NUEVOS ESTILOS PARA BACKUP */
.backup-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
    margin: 15px 0;
}

.backup-stat {
    text-align: center;
    padding: 15px;
    background: var(--light);
    border-radius: 8px;
}

.backup-actions {
    display: flex;
    gap: 10px;
    margin-top: 15px;
}

.backup-actions .btn {
    flex: 1;
}

/* Mejoras para el mapa */
#location-map {
    border-radius: 8px;
    margin-bottom: 15px;
    border: 1px solid #ddd;
}

.map-coordinates input:read-only {
    background-color: #f5f5f5;
    color: #666;
}

/* Estilos para la sección de rutas */
#mapa-ruta-permanente {
    border: 1px solid #ddd;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.numero-marcador {
    background: none !important;
    border: none !important;
}

/* Mejora para los números en los marcadores */
.leaflet-div-icon {
    background: transparent !important;
    border: none !important;
}

/* Estilos para la lista de rutas */
.client-item.ruta-item {
    display: flex;
    align-items: center;
    padding: 10px;
    margin-bottom: 10px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.numero-ruta {
    width: 30px;
    height: 30px;
    background: var(--primary);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    margin-right: 10px;
    flex-shrink: 0;
}

.info-ruta {
    flex: 1;
}

.distancia-ruta {
    color: var(--primary);
    font-weight: bold;
    font-size: 0.9rem;
}

/* Ocultar completamente el datetime */
.current-date {
    display: none !important;
}

/* Responsive para backup */
@media (max-width: 768px) {
    .backup-actions {
        flex-direction: column;
    }
    
    .backup-stats {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    .backup-stats {
        grid-template-columns: 1fr;
    }
    
    .modal-content {
        width: 95%;
        margin: 10px;
    }
    
    .map-actions {
        flex-direction: column;
    }
    
    .map-actions .btn {
        width: 100%;
        margin-bottom: 10px;
    }
    
    /* Responsive para mapa de rutas */
    #mapa-ruta-permanente {
        height: 250px !important;
    }
}

@media (max-width: 480px) {
    #mapa-ruta-permanente {
        height: 200px !important;
    }
    
    .client-item.ruta-item {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .numero-ruta {
        margin-bottom: 5px;
    }
}

/* ===== ESTILOS NUEVOS PARA EL MAPA PERMANENTE ===== */

/* Estilos para el mapa de ruta permanente */
#mapa-ruta-permanente {
    border: 1px solid #ddd;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    z-index: 1;
}

/* Mejoras para los controles del mapa */
.leaflet-control-zoom {
    border: 1px solid #ddd !important;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1) !important;
}

.leaflet-control-zoom a {
    background-color: var(--white) !important;
    color: var(--dark) !important;
    border-bottom: 1px solid #eee !important;
}

.leaflet-control-zoom a:hover {
    background-color: var(--light) !important;
}

/* Estilos para los popups */
.leaflet-popup-content-wrapper {
    border-radius: 8px !important;
    box-shadow: 0 3px 15px rgba(0,0,0,0.2) !important;
    border: 1px solid #ddd !important;
}

.leaflet-popup-tip {
    box-shadow: none !important;
}

/* Estilos para la polyline de la ruta */
.leaflet-interactive {
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* Estilos para los popups del mapa */
.leaflet-popup-content {
    font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, 'Roboto', sans-serif;
}

.leaflet-popup-content .order-status {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 600;
}

.leaflet-popup-content .order-status.pending {
    background: #FFF3CD;
    color: #856404;
}

.leaflet-popup-content .order-status.delivered {
    background: #D4EDDA;
    color: #155724;
}

.leaflet-popup-content .order-status.cancelled {
    background: #F8D7DA;
    color: #721C24;
}

/* Leyenda de colores para la página de rutas */
.leyenda-colores {
    display: flex;
    gap: 15px;
    margin-top: 10px;
    flex-wrap: wrap;
}

.leyenda-item {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.85rem;
}

.leyenda-color {
    width: 15px;
    height: 15px;
    border-radius: 50%;
}

.leyenda-color.pendiente {
    background: var(--primary);
}

.leyenda-color.entregado {
    background: var(--success);
}

.leyenda-color.cancelado {
    background: var(--danger);
}

/* Controles del mapa para móviles */
.leaflet-control-container .leaflet-top {
    z-index: 1000;
}

/* Responsive para el mapa permanente */
@media (max-width: 768px) {
    #mapa-ruta-permanente {
        height: 300px !important;
    }
}

@media (max-width: 480px) {
    #mapa-ruta-permanente {
        height: 250px !important;
    }
    
    /* Ajustar controles del mapa en móviles */
    .leaflet-control-zoom {
        transform: scale(0.9);
        transform-origin: top left;
    }
    
    .leyenda-colores {
        gap: 10px;
    }
    
    .leyenda-item {
        font-size: 0.8rem;
    }
}

/* Botones de control del mapa en la página de rutas */
.controles-mapa {
    display: flex;
    gap: 10px;
    margin-top: 15px;
    flex-wrap: wrap;
}

.controles-mapa .btn {
    flex: 1;
    min-width: 120px;
}

/* Estilos para los marcadores numerados */
.marcador-numerado {
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    border: 3px solid white;
    box-shadow: 0 2px 5px rgba(0,0,0,0.3);
}

/* Estilos específicos para la página de rutas */
#rutas-page .card {
    margin-bottom: 20px;
}

#rutas-page .btn {
    white-space: nowrap;
}

/* Mejora para la visualización de la lista de clientes en rutas */
#clientes-ruta .client-item {
    cursor: pointer;
    transition: all 0.2s;
}

#clientes-ruta .client-item:hover {
    background-color: rgba(76, 175, 80, 0.05);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}
/* Agregar al final del archivo styles.css */

/* Estilos para el mapa del dashboard */
#mapa-dashboard {
    border: 1px solid #ddd;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    background-color: #f8f9fa;
}

/* Ajustar altura del mapa en dashboard para móviles */
@media (max-width: 768px) {
    #mapa-dashboard {
        height: 200px !important;
    }
}

@media (max-width: 480px) {
    #mapa-dashboard {
        height: 180px !important;
    }
}

/* Estilos para los botones del mapa en dashboard */
#dashboard-page .btn-outline {
    padding: 8px 12px;
    font-size: 0.9rem;
}

/* Asegurar que el mapa se muestre correctamente */
#mapa-dashboard .leaflet-container {
    font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, 'Roboto', sans-serif;
}

/* Estilos para mensajes cuando no hay pedidos */
#mapa-dashboard .no-pedidos-message {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    padding: 20px;
    text-align: center;
    color: var(--gray);
}

#mapa-dashboard .no-pedidos-message i {
    font-size: 2.5rem;
    margin-bottom: 10px;
    opacity: 0.5;
}

#mapa-dashboard .no-pedidos-message p {
    margin-bottom: 15px;
    font-size: 0.9rem;
}

/* Ajustar tamaño de los marcadores en dashboard */
#mapa-dashboard .leaflet-div-icon {
    background: transparent !important;
    border: none !important;
}
/* ===== ESTILOS PARA LA PÁGINA DE CONFIGURACIÓN ===== */
.config-section {
    margin-bottom: 20px;
}

.config-group {
    background: var(--white);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 15px;
    box-shadow: var(--shadow);
}

.config-group h4 {
    color: var(--primary);
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.1rem;
}

.color-picker-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.color-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 10px;
    border-radius: 8px;
    border: 2px solid #eee;
    cursor: pointer;
    transition: all 0.3s;
}

.color-option:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}

.color-option.active {
    border-color: var(--primary);
    background: rgba(76, 175, 80, 0.05);
}

.color-preview {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    margin-bottom: 8px;
    border: 3px solid white;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.color-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--dark);
    margin-bottom: 3px;
}

.color-value {
    font-size: 0.75rem;
    color: var(--gray);
}

/* Predefinidos de colores */
.color-primary { background: #4CAF50; }
.color-primary-dark { background: #388E3C; }
.color-secondary { background: #FF9800; }
.color-light { background: #f5f5f5; }
.color-dark { background: #333; }
.color-gray { background: #757575; }
.color-white { background: #ffffff; }
.color-danger { background: #f44336; }
.color-success { background: #4CAF50; }
.color-warning { background: #FF9800; }

/* Temas predefinidos */
.themes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 15px;
}

.theme-option {
    border-radius: 10px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s;
    border: 2px solid #eee;
}

.theme-option:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.theme-option.active {
    border-color: var(--primary);
}

.theme-preview {
    height: 30px;
    display: flex;
}

.theme-info {
    padding: 10px;
    background: white;
}

.theme-name {
    font-weight: 600;
    font-size: 0.9rem;
    margin-bottom: 3px;
}

.theme-colors {
    display: flex;
    gap: 5px;
    margin-top: 5px;
}

.theme-color-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

/* Inputs de color personalizado */
.custom-color-inputs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-top: 15px;
}

.color-input-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.color-input-group label {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--dark);
}

.color-input-wrapper {
    display: flex;
    gap: 10px;
    align-items: center;
}

.color-input {
    flex: 1;
    height: 40px;
    border-radius: 6px;
    border: 1px solid #ddd;
    cursor: pointer;
}

.color-hex-input {
    width: 100px;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-family: monospace;
    font-size: 0.9rem;
}

/* Configuración de logo */
.logo-upload-container {
    border: 2px dashed #ddd;
    border-radius: 10px;
    padding: 30px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
    background: var(--light);
}

.logo-upload-container:hover {
    border-color: var(--primary);
    background: rgba(76, 175, 80, 0.05);
}

.logo-upload-container i {
    font-size: 2.5rem;
    color: var(--primary);
    margin-bottom: 15px;
}

.logo-preview {
    max-width: 200px;
    max-height: 80px;
    margin: 20px auto;
    display: block;
}

.logo-preview img {
    max-width: 100%;
    max-height: 100%;
    border-radius: 8px;
}

/* Emoji selector */
.emoji-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 10px;
    margin-top: 15px;
}

.emoji-option {
    width: 40px;
    height: 40px;
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    background: var(--light);
}

.emoji-option:hover {
    transform: scale(1.1);
    background: var(--primary);
    color: white;
}

.emoji-option.active {
    background: var(--primary);
    color: white;
    transform: scale(1.05);
}

/* Configuración de texto */
.text-config-inputs {
    display: grid;
    grid-template-columns: 1fr;
    gap: 15px;
}

/* Acciones de configuración */
.config-actions {
    display: flex;
    gap: 15px;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #eee;
}

.config-actions .btn {
    flex: 1;
}

/* Preview en tiempo real */
.config-preview {
    position: fixed;
    top: 100px;
    right: 20px;
    width: 300px;
    background: var(--white);
    border-radius: 12px;
    padding: 15px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.15);
    z-index: 1000;
    display: none;
}

.config-preview h5 {
    margin-bottom: 10px;
    color: var(--primary);
}

.preview-item {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 8px 0;
    padding: 8px;
    border-radius: 6px;
    background: var(--light);
}

.preview-color {
    width: 20px;
    height: 20px;
    border-radius: 4px;
}

/* Responsive para configuración */
@media (max-width: 768px) {
    .color-picker-container {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    }
    
    .themes-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .custom-color-inputs {
        grid-template-columns: 1fr;
    }
    
    .config-preview {
        display: none !important;
    }
    
    .emoji-grid {
        grid-template-columns: repeat(5, 1fr);
    }
}

@media (max-width: 480px) {
    .themes-grid {
        grid-template-columns: 1fr;
    }
    
    .color-picker-container {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .emoji-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}
/* Estilos para logos dinámicos */
.logo-emoji, .logo-image-custom {
    transition: all 0.3s ease;
}

.logo-image-custom {
    object-fit: cover;
    border: 2px solid rgba(255,255,255,0.1);
}

/* Sidebar logo específico */
.sidebar-header .logo-emoji {
    font-size: 2rem !important;
    margin-right: 10px !important;
}

.sidebar-header .logo-image-custom {
    width: 50px !important;
    height: 50px !important;
    border-radius: 10px !important;
}

/* Header logo específico */
.logo .logo-emoji {
    font-size: 1.8rem !important;
    margin-right: 10px !important;
}

.logo .logo-image-custom {
    width: 40px !important;
    height: 40px !important;
    border-radius: 8px !important;
}

/* Asegurar que los logos se muestren correctamente */
.logo {
    display: flex;
    align-items: center;
    gap: 10px;
}

.sidebar-header {
    display: flex;
    align-items: center;
}


/* Estilos mejorados para botones de cerrar */
.close-receipt {
    position: absolute;
    top: 10px;
    right: 10px;
    padding: 8px 12px !important;
    border-radius: 50% !important;
    width: 36px !important;
    height: 36px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 1.2rem !important;
}

.close-receipt:hover {
    background: var(--danger) !important;
    border-color: var(--danger) !important;
    color: var(--white) !important;
    transform: rotate(90deg);
}

.close-receipt:active {
    transform: rotate(90deg) scale(0.9);
}

.close-notification {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    padding: 5px;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s;
    font-size: 1.1rem;
}

.close-notification:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: rotate(90deg);
}

.close-notification:active {
    transform: rotate(90deg) scale(0.9);
}


/* Estilos para formulario rápido de cliente */
#quick-client-form,
#quick-client-form-order {
    border-left: 3px solid var(--primary);
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

#quick-client-form h4,
#quick-client-form-order h4 {
    display: flex;
    align-items: center;
    gap: 8px;
}

#quick-client-form .form-input,
#quick-client-form-order .form-input {
    background: var(--white);
}

#quick-client-form .btn,
#quick-client-form-order .btn {
    font-size: 0.9rem;
}

/* Animación suave para el formulario */
@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

#quick-client-form[style*="display: block"],
#quick-client-form-order[style*="display: block"] {
    animation: slideDown 0.3s ease;
}

/* Botón de agregar cliente compacto */
.btn.btn-outline[onclick*="toggleQuickClientForm"] {
    min-width: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Responsive para formulario rápido */
@media (max-width: 480px) {
    #quick-client-form,
    #quick-client-form-order {
        padding: 12px;
    }
    
    #quick-client-form h4,
    #quick-client-form-order h4 {
        font-size: 0.9rem;
    }
}

/* Toggle Switch para Modo Desarrollo - MEJORADO */
.switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 26px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(145deg, #4CAF50, #45a049);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 26px;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.2), 0 2px 8px rgba(76, 175, 80, 0.3);
}

.slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 3px;
    background: linear-gradient(145deg, #ffffff, #f0f0f0);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 50%;
    box-shadow: 0 2px 6px rgba(0,0,0,0.3), 0 0 0 1px rgba(255,255,255,0.1);
}

.slider:after {
    content: "\f00c";
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    position: absolute;
    left: 7px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 10px;
    color: rgba(255,255,255,0.9);
    transition: opacity 0.2s;
}

input:checked + .slider {
    background: linear-gradient(145deg, #FF9800, #f57c00);
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.2), 0 2px 8px rgba(255, 152, 0, 0.4);
}

input:checked + .slider:before {
    transform: translateX(24px);
}

input:checked + .slider:after {
    content: "\f121";
    left: auto;
    right: 7px;
    opacity: 1;
}

input:not(:checked) + .slider:after {
    opacity: 1;
}

.slider:hover {
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.2), 0 4px 12px rgba(76, 175, 80, 0.5);
}

input:checked + .slider:hover {
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.2), 0 4px 12px rgba(255, 152, 0, 0.6);
}

.dev-mode-toggle {
    animation: fadeIn 0.3s;
    transition: all 0.3s;
}

.dev-mode-toggle:hover {
    background-color: var(--light);
    color: var(--primary);
    border-left-color: var(--primary);
}

/* Estilos específicos para el modo desarrollo en el sidebar */
.dev-mode-toggle.sidebar-item {
    padding: 15px 20px;
    border-left: 3px solid transparent;
    transition: all 0.3s;
}

.dev-mode-toggle.sidebar-item:hover {
    background: var(--light);
    color: var(--primary);
    border-left-color: var(--primary);
}
