/* =================================================== */
/* --- 1. ESTILOS GENERALES --- */
/* =================================================== */
body {
    font-family: 'Inter', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f8f9fa;
    overflow-x: hidden;
    margin: 0;
    padding: 0;
}

/* Ocultar secciones por defecto */
.portal-section {
    display: none;
    animation: fadeIn 0.3s ease-in-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* =================================================== */
/* --- 2. SIDEBAR Y LAYOUT (SOLUCIÓN MÓVIL DEFINITIVA) --- */
/* =================================================== */

/* Contenedor principal que envuelve todo (Body) */
body {
    display: flex; /* Usamos flexbox para el layout principal */
}

/* SIDEBAR - Estilos Base */
#sidebar-wrapper {
    /* Definir dimensiones fijas */
    height: 100vh;          /* Altura TOTAL de la pantalla */
    width: 16rem;
    
    /* Transición suave */
    transition: margin 0.3s ease-out;
    
    /* Colores */
    background-color: #2c3e50 !important; /* Azul oscuro */
    color: white;
    
    /* Posición fija (flotando sobre todo) */
    position: fixed;
    z-index: 2000;
    margin-left: -16rem; /* Oculto por defecto en móvil */
    top: 0;
    left: 0; /* Aseguramos que esté pegado a la izquierda */
    bottom: 0;

    /* --- CORRECCIÓN DE SCROLL MÓVIL --- */
    overflow-y: auto;                 /* Activar scroll vertical */
    overflow-x: hidden;               /* Ocultar scroll horizontal */
    -webkit-overflow-scrolling: touch; /* ¡CLAVE! Permite deslizar con el dedo en móviles */
    
    /* Espacio extra abajo para que no se corte el botón Salir en celulares */
    padding-bottom: 80px; 
    
    /* Estilo de la barra de scroll para navegadores PC */
    scrollbar-width: thin; 
    scrollbar-color: #1a252f #2c3e50; 
}

/* Opcional: Estilo para la barra de scroll en Chrome/Safari/Edge */
#sidebar-wrapper::-webkit-scrollbar {
    width: 6px;
}
#sidebar-wrapper::-webkit-scrollbar-track {
    background: #2c3e50;
}
#sidebar-wrapper::-webkit-scrollbar-thumb {
    background-color: #1a252f;
    border-radius: 20px;
}


/* SIDEBAR - Contenido interno */
#sidebar-wrapper .sidebar-heading {
    padding: 1.2rem 1.5rem;
    font-size: 1.3rem;
    font-weight: bold;
    background-color: #1a252f;
    color: #ecf0f1;
    border-bottom: 1px solid #34495e;
    display: flex;
    align-items: center;
    gap: 10px;
}
#sidebar-wrapper .logo-img { width: 35px; height: auto; }

#sidebar-wrapper .list-group { width: 100%; }

#sidebar-wrapper .list-group-item {
    background-color: transparent;
    color: #bdc3c7;
    border: none;
    padding: 1rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 15px;
    cursor: pointer;
    transition: all 0.2s;
    border-left: 4px solid transparent;
    font-size: 0.95rem;
    text-decoration: none; /* Asegura que no tengan subrayado */
}

#sidebar-wrapper .list-group-item:hover {
    background-color: #34495e;
    color: #fff;
    padding-left: 1.8rem;
}

#sidebar-wrapper .list-group-item.active {
    background-color: #212b35;
    color: #fff;
    border-left-color: #3498db;
    font-weight: 600;
}

/* CONTENIDO DE LA PÁGINA (el resto de la pantalla) */
#page-content-wrapper {
    width: 100%;
    /* En móvil, el contenido tiene un margin para compensar el menú,
       pero aquí lo dejamos sin margin horizontal por defecto,
       ya que la barra de navegación ya tiene padding. */
    min-width: 100vw;
    transition: margin-left 0.3s ease-out;
}


/* --- LÓGICA DE ACTIVACIÓN (TOGGLE) --- */

/* MÓVIL: Cuando se activa 'sb-sidenav-toggled', el menú entra */
body.sb-sidenav-toggled #sidebar-wrapper {
    margin-left: 0; /* Se muestra */
}

/* ESCRITORIO (min-width: 768px) */
@media (min-width: 768px) {
    body {
        display: flex; 
        flex-wrap: nowrap;
    }
    
    #sidebar-wrapper {
        position: sticky !important; /* La clave: se queda pegado */
        top: 0;                      /* Se alinea al tope de la pantalla */
        height: 100vh;               /* Mantiene siempre el alto total del monitor */
        margin-left: 0; 
        flex-shrink: 0; 
        z-index: 1000;
    }

    #page-content-wrapper {
        min-width: 0;
        width: 100%;
        flex-grow: 1;
        /* Añadimos un fondo gris muy claro para que las tarjetas blancas resalten */
        background-color: #f4f7f6; 
    }
}

/* =================================================== */
/* --- 3. TARJETAS DEL DASHBOARD (Flat Design) --- */
/* =================================================== */
.card-dashboard-flat {
    border: none;
    border-radius: 8px;
    color: white;
    position: relative;
    overflow: hidden;
    min-height: 140px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.07);
    transition: transform 0.2s, box-shadow 0.2s;
    display: flex; /* Usar flexbox para organizar el contenido */
    flex-direction: column;
}
.card-dashboard-flat:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 15px rgba(0,0,0,0.1);
}
.card-dashboard-flat .card-body { 
    padding: 25px; 
    z-index: 2; 
    position: relative; 
    flex-grow: 1; /* Permite que el cuerpo crezca */
}
.card-dashboard-flat h3 { 
    font-size: 2.8rem; 
    font-weight: 700; 
    margin: 0; 
    line-height: 1; 
}
.card-dashboard-flat span { 
    font-size: 0.9rem; 
    opacity: 0.9; 
    text-transform: uppercase; 
    letter-spacing: 1px; 
    font-weight: 500; 
}
.card-dashboard-flat .bg-icon {
    position: absolute; right: 15px; top: 15px;
    font-size: 90px !important; opacity: 0.12;
    transform: rotate(-15deg); z-index: 1;
}
.card-dashboard-flat .card-footer-btn {
    background-color: rgba(0,0,0,0.15); color: white;
    text-align: center; display: block; padding: 8px;
    text-decoration: none; font-size: 0.85rem; font-weight: 600;
    transition: background-color 0.2s;
}
.card-dashboard-flat .card-footer-btn:hover { background-color: rgba(0,0,0,0.25); color: white; }

.bg-flat-red { background-color: #e74c3c; }
.bg-flat-orange { background-color: #f39c12; }
.bg-flat-blue { 
    background-color: #3498db !important; 
    color: white !important;
}
.bg-flat-green { background-color: #27ae60; }

/* =================================================== */
/* --- 4. ESTILOS DE LOGIN --- */
/* =================================================== */
.auth-container-wrapper {
    width: 100vw;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: #2c3e50;
    padding: 20px;
}

/* =================================================== */
/* --- 5. ESTILOS MÓDULO DE CHAT --- */
/* =================================================== */
#chat-module-view .card { height: 80vh; border: none; }
.chat-sidebar-col { background-color: #fff; border-right: 1px solid #dee2e6; }
.chat-main-col { background-color: #f0f2f5; }

.chat-list-item {
    padding: 10px;
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    transition: background-color 0.2s;
    border-left: 3px solid transparent;
}
.chat-list-item:hover { background-color: #f8f9fa; }
.chat-list-item.active {
    background-color: #e3f2fd;
    border-left-color: #3498db; /* Azul de GLA */
}
.chat-info { flex-grow: 1; overflow: hidden; }
.customer-name { font-weight: bold; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.last-message { font-size: 0.85rem; color: #777; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.status-dot { height: 10px; width: 10px; border-radius: 50%; flex-shrink: 0; }
.status-needs_attention { background-color: #dc3545; } /* Rojo */
.status-human { background-color: #3498db; } /* Azul */
.status-bot { background-color: #27ae60; } /* Verde */

/* Mensajes en la ventana principal */
#chat-messages-container {
    display: flex;
    flex-direction: column;
    height: 100%;
}
.message {
    max-width: 75%;
    padding: 10px 15px;
    border-radius: 15px;
    margin-bottom: 10px;
    font-size: 0.95rem;
    position: relative;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}
.message.customer { background-color: #ffffff; align-self: flex-start; border-bottom-left-radius: 2px; }
.message.operator { background-color: #dcf8c6; align-self: flex-end; border-bottom-right-radius: 2px; }
.message.bot { background-color: #e3f2fd; align-self: flex-start; border: 1px dashed #90caf9; font-size: 0.9rem; }
.message-sender { font-size: 0.75rem; font-weight: bold; margin-bottom: 3px; color: #555; }
.message-timestamp { font-size: 0.7rem; color: #999; text-align: right; margin-top: 3px; }


/* =================================================== */
/* --- 6. OTROS ESTILOS (Widgets, Tablas, Menú) --- */
/* =================================================== */

/* --- Widgets de ROI y Progreso --- */
.roi-widget { text-align: center; padding: 20px; }
.roi-main-metric { font-size: 3rem; font-weight: 800; color: #2c3e50; }
.progress-bar-container { height: 15px; background: #e9ecef; border-radius: 10px; overflow: hidden; margin: 15px 0; }
.progress-bar-fill { height: 100%; background: linear-gradient(90deg, #3498db, #2980b9); transition: width 1s ease-in-out; }
.progress-bar-fill.completed { background: linear-gradient(90deg, #2ecc71, #27ae60); }

/* --- Estilos para la tabla de Pedidos y Estadísticas --- */
.filtros-pedidos .btn.active, #filtros-estadisticas .btn.active { background-color: #2c3e50; color: white; border-color: #2c3e50; }
.filtros-pedidos .btn, #filtros-estadisticas .btn { color: #2c3e50; border-color: #2c3e50; }
.filtros-pedidos .btn:hover, #filtros-estadisticas .btn:hover { background-color: #2c3e50; color: white; }

/* --- MEJORA VISUAL DEL MENÚ DIGITAL (ESTILO CARDS) --- */
.menu-category-section { margin-bottom: 40px; }
.menu-category-section h4 { 
    font-weight: 800; 
    color: #2c3e50; 
    margin-bottom: 20px; 
    border-left: 5px solid #3498db; 
    padding-left: 15px;
    text-transform: uppercase;
    font-size: 1.1rem;
    letter-spacing: 1px;
}

.menu-item-list { list-style: none; padding: 0; }

.menu-item { 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    padding: 20px;
    background-color: #ffffff;    /* Fondo blanco para resaltar */
    border-radius: 16px;          /* Bordes modernos */
    margin-bottom: 15px;          /* Espacio entre tarjetas */
    border: 1px solid #edf2f7; 
    box-shadow: 0 4px 6px rgba(0,0,0,0.02); /* Sombra suave */
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    flex-wrap: wrap; 
    gap: 15px;
}

/* Efecto Hover: La tarjeta se levanta */
.menu-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 20px rgba(0,0,0,0.08);
    border-color: #3498db;
}

.menu-item .item-info { flex-grow: 1; flex-basis: 60%; }
.menu-item .item-name { 
    font-size: 1.1rem; 
    font-weight: 700; 
    color: #2d3748; 
    display: block; 
}
.menu-item .item-description { 
    font-size: 0.9rem; 
    color: #718096; 
    display: block; 
    margin-top: 4px; 
}
.menu-item .item-price { 
    font-weight: 800; 
    color: #3498db; 
    font-size: 1.1rem;
    display: block;
    margin-top: 8px;
}

.menu-item .item-actions { display: flex; gap: 8px; flex-basis: 100%; margin-top: 10px; }

/* Botones dentro de la tarjeta */
.menu-item .item-actions button { 
    padding: 10px 15px; 
    font-size: 13px; 
    border-radius: 8px; 
    border: none; 
    color: white; 
    flex-grow: 1; 
    font-weight: 600;
    transition: opacity 0.2s;
}
.menu-item .item-actions button:hover { opacity: 0.9; }

.menu-item .item-actions .disponible { background-color: #27ae60; }
.menu-item .item-actions .agotado { background-color: #95a5a6; }
.menu-item .item-actions .edit-item-btn { background-color: #f39c12; }
.menu-item .item-actions .delete-item-btn { background-color: #e74c3c; }

@media (min-width: 768px) {
    .menu-item .item-actions { flex-basis: auto; margin-top: 0; }
    .menu-item .item-actions button { flex-grow: 0; min-width: 90px; }
}

/* --- Mensajes y Alertas --- */
.portal-message { padding: 8px 15px; border-radius: 5px; font-size: 0.9rem; font-weight: 500; }
.portal-message.error { background-color: #f8d7da; color: #721c24; border: 1px solid #f5c6cb; }
.portal-message.info { background-color: #d1ecf1; color: #0c5460; border: 1px solid #bee5eb; }
.portal-message.success { background-color: #d4edda; color: #155724; border: 1px solid #c3e6cb; }

/* --- Inputs de Configuración --- */
#tamanos-inputs-container input[type="number"], 
#adiciones-inputs-container input[type="number"], 
#tarifa-inputs-container input[type="number"] {
    display: block;
    width: 100%;
    padding: 0.375rem 0.75rem;
    font-size: 1rem;
    border: 1px solid #ced4da;
    border-radius: 0.25rem;
}

/* --- Widget ROI Compacto --- */
.roi-compact-wrapper {
    background-color: #fff;
    border-radius: 50px;
    padding: 10px 25px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    border: 1px solid #e9ecef;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 15px;
}
.roi-text-content { display: flex; flex-direction: column; }
.roi-title-small { font-size: 0.85rem; color: #777; margin: 0; text-transform: uppercase; letter-spacing: 0.5px; font-weight: 600; }
.roi-amount-small { font-size: 1.4rem; font-weight: 800; color: #2c3e50; line-height: 1; }
.roi-progress-wrapper { flex-grow: 1; max-width: 400px; }
.roi-bar-small { height: 8px; background-color: #e9ecef; border-radius: 4px; overflow: hidden; }
.roi-message-small { font-size: 0.8rem; color: #27ae60; font-weight: 600; margin-top: 4px; white-space: nowrap; }

@media (max-width: 768px) {
    .roi-compact-wrapper { flex-direction: column; align-items: flex-start; border-radius: 15px; }
    .roi-progress-wrapper { width: 100%; max-width: 100%; }
}

/* =================================================== */
/* --- 7. MEJORAS ESTÉTICAS (UI MODERNIZADA) --- */
/* =================================================== */

/* 1. Suavizar los Inputs (Cajas de texto) */
/* Hacemos que se vean más grandes, con bordes suaves y un brillo azul al hacer clic */
#tamanos-inputs-container input,
#adiciones-inputs-container input,
#tarifa-inputs-container input,
.form-control,
.form-select {
    border-radius: 10px !important;       /* Bordes más redondos */
    border: 1px solid #e0e0e0 !important; /* Borde gris muy suave */
    background-color: #fff;
    padding: 12px 15px !important;        /* Más espacio interno (aire) */
    transition: all 0.3s ease;
    box-shadow: none;
    font-size: 0.95rem;
}

/* Efecto cuando tocas un input */
#tamanos-inputs-container input:focus,
.form-control:focus,
.form-select:focus {
    border-color: #3498db !important;
    background-color: #fff;
    box-shadow: 0 0 0 4px rgba(52, 152, 219, 0.1) !important; /* Brillo suave azul */
}

/* 2. Transformar los "Basureros" (Botones de eliminar) */
/* Dejamos de usar el cuadro negro feo y los volvemos botones rojos y elegantes */
.delete-tamano-btn, 
.remove-tier-btn,
.delete-item-btn {
    background-color: #fff !important;    /* Fondo blanco */
    color: #e74c3c !important;            /* Icono Rojo */
    border: 1px solid #fadbd8 !important; /* Borde rojo muy pálido */
    border-radius: 12px !important;       /* Bordes redondeados */
    width: 45px;
    height: 45px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05); /* Sombrita sutil */
    margin-left: 5px;
}

/* Efecto al pasar el mouse por el basurero */
.delete-tamano-btn:hover, 
.remove-tier-btn:hover,
.delete-item-btn:hover {
    background-color: #e74c3c !important; /* Se vuelve rojo intenso */
    color: #fff !important;                /* Icono blanco */
    transform: translateY(-2px);           /* Se levanta un poquito */
    box-shadow: 0 5px 15px rgba(231, 76, 60, 0.3); /* Sombra roja brillante */
}

/* 3. Tarjetas de filas (Los contenedores de cada tamaño) */
.tamano-input-row, 
.tarifa-input-row {
    background: #ffffff !important;
    border: 1px solid #f0f0f0 !important; /* Borde casi invisible */
    border-radius: 15px !important;
    padding: 20px !important;
    margin-bottom: 15px !important;
    box-shadow: 0 4px 12px rgba(0,0,0,0.03); /* Efecto flotante */
    align-items: center !important; /* Centrado vertical perfecto */
}

/* 4. Etiquetas (Labels) */
label {
    font-weight: 600 !important;
    color: #555;
    font-size: 0.85rem;
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* 5. Botones Principales (Guardar y Añadir) */
.btn-primary, .btn-success {
    border-radius: 50px !important; /* Botones estilo "píldora" */
    padding: 10px 25px !important;
    font-weight: 600 !important;
    border: none !important;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    transition: transform 0.2s;
}

.btn-primary:hover, .btn-success:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0,0,0,0.15);
}

/* Botón "Añadir" específico (Borde azul, fondo blanco) */
#btn-add-tamano, #btn-add-tier {
    background-color: #fff !important;
    border: 2px dashed #3498db !important;
    color: #3498db !important;
    border-radius: 12px !important;
    padding: 10px 20px !important;
}

#btn-add-tamano:hover, #btn-add-tier:hover {
    background-color: #f0f8ff !important; /* Azul muy clarito al hover */
    border-style: solid !important;
}
/* =================================================== */
/* --- 8. ESTILOS MODERNOS TABLA DE PEDIDOS --- */
/* =================================================== */

/* Contenedor principal de la tabla */
.pedidos-table-container {
    background-color: transparent;
    margin-top: 10px;
}

.pedidos-table {
    width: 100%;
    border-collapse: separate; /* Importante para el espaciado entre filas */
    border-spacing: 0 8px;     /* Espacio vertical entre filas */
}

/* Encabezados */
.pedidos-table thead th {
    background: transparent;
    border: none;
    color: #8898aa; /* Gris suave */
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 0 15px 10px 15px;
}

/* Filas de datos (Tarjetas) */
.pedidos-table tbody tr {
    background-color: #ffffff;
    box-shadow: 0 2px 6px rgba(0,0,0,0.02); /* Sombra muy sutil */
    transition: transform 0.2s, box-shadow 0.2s;
}

.pedidos-table tbody tr:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.06);
    z-index: 10;
    position: relative;
}

/* Celdas */
.pedidos-table td {
    padding: 15px;
    vertical-align: middle;
    border: none; /* Sin bordes internos */
    font-size: 0.9rem;
    color: #525f7f;
}

/* Bordes redondeados para las esquinas de la fila */
.pedidos-table td:first-child {
    border-top-left-radius: 8px;
    border-bottom-left-radius: 8px;
    font-weight: 600; /* Fecha un poco más negrita */
}
.pedidos-table td:last-child {
    border-top-right-radius: 8px;
    border-bottom-right-radius: 8px;
}

/* --- Botón "Ver" Moderno (Estilo Píldora) --- */
.btn-ver-modern {
    background-color: #f0f2f5; /* Fondo gris muy claro */
    color: #2c3e50;
    border: none;
    border-radius: 20px;
    padding: 6px 16px;
    font-size: 0.85rem;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.btn-ver-modern:hover {
    background-color: #3498db; /* Azul al pasar el mouse */
    color: white;
    box-shadow: 0 2px 5px rgba(52, 152, 219, 0.3);
}

/* --- Badges (Etiquetas) de Estado --- */
.status-badge {
    padding: 5px 10px;
    border-radius: 6px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

/* Colores por estado */
.status-recibido { background-color: #e3f2fd; color: #1976d2; }
.status-confirmado-restaurante { background-color: #e8f5e9; color: #2e7d32; }
.status-en-preparacion { background-color: #fff3cd; color: #856404; }
.status-en-camino { background-color: #e0f7fa; color: #006064; }
.status-listo-para-retiro { background-color: #d1e7dd; color: #0f5132; }
.status-entregado { background-color: #d4edda; color: #155724; border: 1px solid #c3e6cb; }
.status-cancelado, .status-rechazado { background-color: #f8d7da; color: #721c24; }
.status-desconocido { background-color: #f2f2f2; color: #666; }

/* =================================================== */
/* --- 9. ESTILOS SECCIÓN DE PLANES (MIGRADO) --- */
/* =================================================== */

#planes-view .plans-grid {
    display: grid;
    grid-template-columns: 1fr; /* Una columna en móviles por defecto */
    gap: 25px;
    margin-top: 2rem;
}

#planes-view .plan-card {
    background-color: #ffffff;
    border: 1px solid #e0e0e0;
    border-radius: 15px;
    padding: 25px;
    display: flex;
    flex-direction: column;
    box-shadow: 0 4px 10px rgba(0,0,0,0.05);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    position: relative; /* Para el badge de recomendado */
    overflow: hidden; /* Para el badge */
}

#planes-view .plan-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.1);
}

#planes-view .plan-card h4 {
    margin-top: 0;
    font-size: 1.4em;
    color: #333;
    text-align: center;
    font-weight: bold;
}

#planes-view .plan-price {
    font-size: 2.2em;
    font-weight: bold;
    color: #1565c0;
    margin-bottom: 1.5rem;
    text-align: center;
}

#planes-view .plan-price .plan-period {
    font-size: 0.4em;
    font-weight: normal;
    color: #666;
}

#planes-view .plan-features {
    list-style: none;
    padding: 0;
    margin: 0 0 1.5rem 0;
    text-align: left;
    flex-grow: 1; /* Hace que la lista ocupe el espacio disponible */
}

#planes-view .plan-features li {
    padding: 8px 0 8px 28px;
    position: relative;
    border-bottom: 1px solid #f0f0f0;
    font-size: 0.9rem;
    color: #555;
}
#planes-view .plan-features li:last-child {
    border-bottom: none;
}

/* Iconos usando Material Symbols */
#planes-view .plan-features li::before {
    position: absolute;
    left: 0;
    top: 8px;
    font-family: 'Material Symbols Outlined';
    font-weight: normal;
    font-style: normal;
    font-size: 18px;
    line-height: 1;
    letter-spacing: normal;
    text-transform: none;
    display: inline-block;
    white-space: nowrap;
    word-wrap: normal;
    direction: ltr;
}

#planes-view .plan-features li.included::before {
    content: 'check_circle';
    color: #28a745; /* Verde */
}
#planes-view .plan-features li.excluded::before {
    content: 'cancel';
    color: #dc3545; /* Rojo */
    opacity: 0.6;
}

#planes-view .plan-button-container {
    margin-top: auto; /* Empuja el botón al final de la tarjeta */
    text-align: center;
}

/* Estilo para la tarjeta recomendada */
#planes-view .plan-card.recommended {
    border: 2px solid #1565c0;
    transform: scale(1.02); /* Un poquito más grande */
}

#planes-view .plan-badge {
    position: absolute;
    top: 15px;
    right: -30px;
    background-color: #1565c0;
    color: white;
    padding: 5px 30px;
    font-size: 0.7em;
    font-weight: bold;
    transform: rotate(45deg);
    z-index: 1;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

/* Media query para tabletas y escritorios */
@media (min-width: 992px) {
    #planes-view .plans-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}
/* =================================================== */
/* --- 5. ESTILOS MÓDULO DE CHAT (NUEVO) --- */
/* =================================================== */

/* Ajuste de altura para que el chat ocupe la pantalla */
#chat-module-view .card {
    height: 80vh; /* Altura fija para que el scroll funcione */
    border: none;
}

/* Columna izquierda (Lista de chats) */
.chat-sidebar-col {
    background-color: #fff;
    border-right: 1px solid #dee2e6;
}

/* Columna derecha (Chat activo) */
.chat-main-col {
    background-color: #f0f2f5;
}

/* --- Items de la lista de chats --- */
.chat-list-item {
    padding: 15px;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    transition: background-color 0.2s;
    border-bottom: 1px solid #f0f0f0;
    border-left: 4px solid transparent;
}

.chat-list-item:hover {
    background-color: #f8f9fa;
}

.chat-list-item.active {
    background-color: #e3f2fd;
    border-left-color: #3498db; /* Azul de GLA */
}

.chat-info {
    flex-grow: 1;
    overflow: hidden;
}

.customer-name {
    font-weight: bold;
    color: #333;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.last-message {
    font-size: 0.85rem;
    color: #777;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Puntos de estado (Semáforo) */
.status-dot {
    height: 12px;
    width: 12px;
    border-radius: 50%;
    flex-shrink: 0;
}
.status-needs_attention { background-color: #dc3545; box-shadow: 0 0 5px rgba(220,53,69,0.5); } /* Rojo brillante */
.status-human { background-color: #3498db; } /* Azul */
.status-bot { background-color: #27ae60; } /* Verde */

/* --- Ventana de Mensajes --- */
#chat-messages-container {
    display: flex;
    flex-direction: column;
    height: 100%;
}

/* Burbujas de chat */
.message {
    max-width: 75%;
    padding: 10px 15px;
    border-radius: 15px;
    margin-bottom: 10px;
    font-size: 0.95rem;
    position: relative;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
    word-wrap: break-word;
}

.message.customer {
    background-color: #ffffff;
    align-self: flex-start;
    border-bottom-left-radius: 2px;
}

.message.operator {
    background-color: #dcf8c6; /* Verde WhatsApp suave */
    align-self: flex-end;
    border-bottom-right-radius: 2px;
}

.message.bot {
    background-color: #e3f2fd;
    align-self: flex-start;
    border: 1px dashed #90caf9;
    font-size: 0.9rem;
    color: #555;
}

.message-sender {
    font-size: 0.75rem;
    font-weight: bold;
    margin-bottom: 3px;
    color: #555;
}

.message-timestamp {
    font-size: 0.7rem;
    color: #999;
    text-align: right;
    margin-top: 3px;
}

/* --- Estilos para IMÁGENES dentro del chat (El arreglo que buscas) --- */
.message img {
    display: block;            /* Para que respete márgenes */
    max-width: 100%;           /* Que nunca se salga de la burbuja */
    width: 260px;              /* Ancho ideal para una miniatura legible */
    max-height: 350px;         /* Límite de altura para que no sea eterna */
    object-fit: cover;         /* Recorta el exceso para que se vea ordenada */
    border-radius: 12px;       /* Bordes redondeados bonitos */
    margin-top: 8px;           /* Separación del texto si lo hay */
    cursor: pointer;           /* Manito para indicar que se puede abrir */
    border: 1px solid rgba(0,0,0,0.1); /* Borde sutil */
    transition: transform 0.2s ease, opacity 0.2s;
}

/* Efecto al pasar el mouse por encima de la foto */
.message img:hover {
    opacity: 0.95;
    transform: scale(1.02);    /* Un pequeño zoom elegante */
}

/* --- Ajustes de Chat para Móviles (CORREGIDO) --- */
@media (max-width: 767.98px) { /* Ajustado al breakpoint exacto de Bootstrap */
    
    /* 1. Por defecto: Solo mostramos la lista (Sidebar) */
    .chat-sidebar-col {
        display: flex !important; /* Forzamos que se vea */
        width: 100% !important;
        height: 100% !important;
    }
    
    .chat-main-col {
        display: none !important; /* Forzamos que se oculte */
        width: 100% !important;
        height: 100% !important;
    }

    /* 2. Cuando se activa un chat: Invertimos */
    /* El contenedor padre tendrá la clase .chat-active-mobile */
    
    #chat-module-view.chat-active-mobile .chat-sidebar-col {
        display: none !important; /* Ocultamos la lista */
    }
    
    #chat-module-view.chat-active-mobile .chat-main-col {
        display: flex !important; /* Mostramos el chat */
    }

    /* Botón atrás visible solo en móvil */
    .btn-back-chat-mobile {
        display: inline-block !important;
        margin-right: 10px;
        color: #555;
        cursor: pointer;
    }
}

/* En escritorio ocultamos el botón de atrás */
@media (min-width: 768px) {
    .btn-back-chat-mobile {
        display: none !important;
    }
}
/* =================================================== */
/* --- AJUSTE DE TARJETAS DASHBOARD EN MÓVIL --- */
/* =================================================== */

@media (max-width: 768px) {
    /* Reducimos el tamaño del número principal */
    .card-dashboard-flat h3 {
        font-size: 2rem !important; /* Bajamos de 2.8rem a 2rem */
    }
    
    /* Reducimos un poco el relleno para ganar espacio */
    .card-dashboard-flat .card-body {
        padding: 15px !important;
    }

    /* Ajustamos el ícono de fondo para que no estorbe */
    .card-dashboard-flat .bg-icon {
        font-size: 60px !important;
        top: 10px;
        right: 10px;
    }
}

        /* Estilos críticos in-line */
        body { background-color: #f8f9fa; overflow-x: hidden; }
        #tamanos-inputs-container input, #adiciones-inputs-container input, #tarifa-inputs-container input {
            display: block; width: 100%; padding: 0.375rem 0.75rem; font-size: 1rem;
            border: 1px solid #ced4da; border-radius: 0.25rem;
        }
		/* 3. Tarjetas de filas (Los contenedores de cada tamaño y tarifa) */
		.tamano-input-row, 
		.tarifa-input-row {
			background: #ffffff !important;
			border: 1px solid #f0f0f0 !important; /* Borde sutil */
			border-radius: 15px !important;        /* Bordes modernos */
			padding: 20px !important;              /* Espacio interno */
			margin-bottom: 15px !important;        /* Espacio entre filas */
			box-shadow: 0 4px 12px rgba(0,0,0,0.03); /* Efecto flotante */
			
			display: flex;
			gap: 10px;
			
			/* --- LA CLAVE PARA ALINEAR EL BOTÓN --- */
			/* flex-end baja el botón para que quede alineado con los inputs */
			align-items: flex-end !important; 
		}
        #adiciones-inputs-container table { width: 100%; background: white; border-collapse: collapse; }
        #adiciones-inputs-container th, #adiciones-inputs-container td { padding: 12px; border: 1px solid #dee2e6; }
        #sidebar-wrapper, #page-content-wrapper { display: none; }
		
		/* --- ESTILOS DEL LOGIN MODERNO (Agrega esto a tu <style>) --- */
        
        /* 1. Fondo de pantalla completo con degradado profesional */
        .auth-container-wrapper {
            background: linear-gradient(135deg, #2c3e50 0%, #4ca1af 100%); /* Azul petróleo elegante */
            min-height: 100vh;
            display: flex;
            align-items: center;
            justify-content: center;
            padding: 20px;
        }

        /* 2. Tarjeta de Login (Efecto flotante y limpio) */
        #login-section, #register-section {
            background: #ffffff;
            border-radius: 20px; /* Bordes más redondeados */
            box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2); /* Sombra profunda */
            border: none; /* Sin borde gris feo */
            padding: 3rem !important; /* Más espacio interno */
        }

        /* 3. Títulos y Textos */
        #login-section h3, #register-section h3 {
            font-weight: 800;
            color: #2c3e50;
            letter-spacing: -0.5px;
        }
        .text-muted.small {
            font-size: 0.9rem;
            color: #95a5a6 !important;
        }

        /* 4. Inputs (Campos de texto modernos) */
        #login-section input.form-control, #register-section input.form-control {
            background-color: #f8f9fa;
            border: 2px solid #eee;
            border-radius: 12px; /* Redonditos */
            padding: 12px 15px;
            font-size: 1rem;
            transition: all 0.3s ease;
            margin-bottom: 15px;
        }
        
        /* Efecto al hacer clic en el input */
        #login-section input.form-control:focus, #register-section input.form-control:focus {
            background-color: #fff;
            border-color: #4ca1af; /* Color del tema al enfocar */
            box-shadow: 0 0 0 4px rgba(76, 161, 175, 0.1);
        }

        /* Labels más limpios (quitamos negrita excesiva) */
        #login-section label, #register-section label {
            font-size: 0.85rem;
            font-weight: 600;
            color: #555;
            margin-bottom: 5px;
            text-transform: uppercase; /* Opcional: Mayúsculas pequeñas */
            letter-spacing: 0.5px;
        }

        /* 5. Botón de Iniciar Sesión (Gradiente y Sombra) */
        #btnPortalLogin, #btnPortalRegister {
            background: linear-gradient(to right, #11998e, #38ef7d); /* Gradiente Verde Moderno */
            border: none;
            border-radius: 12px;
            padding: 12px;
            font-size: 1rem;
            font-weight: bold;
            letter-spacing: 0.5px;
            transition: transform 0.2s, box-shadow 0.2s;
        }
        
        #btnPortalLogin:hover, #btnPortalRegister:hover {
            transform: translateY(-2px); /* Se levanta un poco */
            box-shadow: 0 5px 15px rgba(56, 239, 125, 0.4); /* Sombra brillante */
        }

        /* Enlaces */
        #login-section a, #register-section a {
            color: #11998e;
            font-weight: 600;
            transition: color 0.2s;
        }
        #login-section a:hover {
            color: #0c6b63;
            text-decoration: underline !important;
        }
		
		/* ========== ESTILOS REFINADOS PARA EL WIZARD ========== */
.wizard-stepper {
    display: flex;
    justify-content: space-between;
    position: relative;
    margin-bottom: 30px;
    padding: 0 20px;
}

.wizard-stepper::before {
    content: '';
    position: absolute;
    top: 20px; /* Mitad del círculo */
    left: 50px;
    right: 50px;
    height: 4px;
    background: #e0e0e0;
    z-index: 0;
}

.step {
    position: relative;
    z-index: 1;
    text-align: center;
    background: #f8f9fa; /* Mismo color del fondo para "cortar" la línea */
    padding: 0 10px;
    width: 100px; 
}

.step-circle {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: #fff;
    border: 3px solid #e0e0e0;
    color: #999;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    margin: 0 auto 10px auto; /* Centrado */
    transition: all 0.3s;
}

.step.active .step-circle {
    border-color: #1565c0;
    color: #1565c0;
    transform: scale(1.1);
}

.step.completed .step-circle {
    background-color: #1565c0;
    border-color: #1565c0;
    color: #fff;
}

.step-label {
    font-size: 0.85rem;
    color: #999;
    font-weight: 600;
}
.step.active .step-label { color: #1565c0; }
.step.completed .step-label { color: #333; }

/* =================================================== */
/* --- ESTILOS MAPA Y ZONAS (MOBILE FIRST) --- */
/* =================================================== */

/* 1. La Mira Central (Crosshair) - CORREGIDO */
/* SOLUCIÓN ROBUSTA PARA MÓVIL */
.crosshair-overlay {
    /* 1. Posicionamiento: Cubrir TODO el mapa */
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    
    /* 2. Capa superior máxima */
    z-index: 10000 !important;
    
    /* 3. Centrado perfecto con Flexbox */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    
    /* 4. Ignorar toques (CRUCIAL para poder mover el mapa) */
    pointer-events: none; 
    
    /* Color */
    color: #e74c3c;
}

.crosshair-icon {
    font-size: 40px !important;
    font-weight: 800 !important;
    filter: drop-shadow(0px 0px 2px white); /* Borde blanco para contraste */
    /* Asegurar que el icono tenga tamaño físico */
    width: 40px;
    height: 40px;
    line-height: 40px;
    text-align: center;
}

.crosshair-label {
    background-color: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    margin-top: 5px;
    white-space: nowrap; /* Evitar que el texto se rompa */
    font-weight: 600;
}

/* 2. Botones Flotantes de Dibujo (Sobre el mapa) */
.drawing-controls {
    position: absolute;
    bottom: 20px;
    left: 0;
    right: 0;
    padding: 0 20px;
    z-index: 100;
    display: flex;
    justify-content: center;
}

/* 3. Lista de Zonas (Tarjetas pequeñas) */
.zona-item-row {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    padding: 10px 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background 0.2s;
}

.zona-item-row:hover {
    background: #f9f9f9;
    border-color: #d0d0d0;
}

.zona-info h6 {
    margin: 0;
    font-weight: 700;
    font-size: 0.95rem;
    color: #2c3e50;
}

.zona-info small {
    color: #27ae60;
    font-weight: 600;
}

.btn-delete-zona {
    background: transparent;
    border: none;
    color: #e74c3c;
    padding: 5px;
    border-radius: 50%;
    transition: background 0.2s;
}

.btn-delete-zona:hover {
    background-color: #fadbd8;
}
/* --- CORRECCIÓN RESPONSIVA PARA TARJETAS DEL DASHBOARD --- */
/* Ajusta el tamaño de los números para que no se salgan en celulares */
.card-dashboard-flat h3 {
    font-size: clamp(1.1rem, 5vw, 1.75rem) !important; 
    white-space: nowrap;       /* Evita que el número se parta en dos líneas */
    overflow: hidden;          /* Corta el exceso si aún así es muy largo */
    text-overflow: ellipsis;   /* Pone "..." si no cabe */
}
#initial-loader {
    display: flex; /* O block, lo que use tu loader */
}

#legacy-views-container,
#sidebar-wrapper,
#page-content-wrapper {
    display: none;
}

@keyframes parpadeo {
    0% { opacity: 1; }
    50% { opacity: 0.5; }
    100% { opacity: 1; }
}

.parpadeo-grabando {
    animation: parpadeo 1.5s infinite;
}

/* Borde blanco para las letras del mapa */
.map-label-text {
    text-shadow: 
        2px 0 0 #fff, -2px 0 0 #fff, 0 2px 0 #fff, 0 -2px 0 #fff, 
        1px 1px #fff, -1px -1px #fff, 1px -1px #fff, -1px 1px #fff;
}
/* =================================================== */
/* --- 10. ESTILOS TARJETAS DEL WIZARD (PASO 3) --- */
/* =================================================== */

/* Contenedor base de la tarjeta en el Wizard */
.plan-card-container {
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1); /* Animación suave */
    border: 2px solid transparent !important; /* Preparamos el borde */
    overflow: hidden;
}

/* ESTADO SELECCIONADO (Clase que agrega el JS) */
.plan-card-container.border-primary {
    border-color: #1565c0 !important; /* Borde azul fuerte */
    background-color: #f0f7ff !important; /* Fondo azul muy clarito */
    box-shadow: 0 15px 30px rgba(21, 101, 192, 0.15) !important; /* Sombra flotante */
    transform: scale(1.05); /* Efecto POP (Crece un 5%) */
    z-index: 10; /* Se pone por encima de las otras */
}

/* Ajuste del Botón dentro de la tarjeta */
.plan-card-container .btn-select-plan {
    transition: all 0.3s ease;
    border-width: 2px;
}

/* Cuando el botón está activo/seleccionado */
.plan-card-container .btn-select-plan.btn-primary {
    background-color: #1565c0;
    border-color: #1565c0;
    box-shadow: 0 4px 10px rgba(21, 101, 192, 0.3);
}

/* Corrección Móvil: El efecto hover solo aplica en pantallas con puntero (mouse) */
@media (hover: hover) {
    .plan-card-container:not(.border-primary):hover {
        transform: translateY(-5px);
        box-shadow: 0 5px 15px rgba(0,0,0,0.05);
    }
}

/* SKELETON MEJORADO (Se adapta al color de la tarjeta) */
.skeleton-box {
    display: inline-block;
    height: 1.2em;
    width: 60px; /* Tamaño aproximado de un número */
    position: relative;
    overflow: hidden;
    background-color: rgba(255, 255, 255, 0.2); /* Blanco transparente */
    border-radius: 8px;
    vertical-align: middle;
}

.skeleton-box::after {
    position: absolute;
    top: 0; right: 0; bottom: 0; left: 0;
    transform: translateX(-100%);
    background-image: linear-gradient(
        90deg,
        rgba(255, 255, 255, 0) 0,
        rgba(255, 255, 255, 0.3) 20%,
        rgba(255, 255, 255, 0.5) 60%,
        rgba(255, 255, 255, 0)
    );
    animation: shimmer 2s infinite;
    content: '';
}

@keyframes shimmer {
    100% {
        transform: translateX(100%);
    }
}
#menu-items-container {
    min-height: 400px; /* Evita que el footer suba y baje bruscamente */
    contain: content;  /* Optimización de renderizado para listas largas */
}

/* =========================================
   NUEVOS ESTILOS PARA LA TARJETA DE PAGO (PASO 4)
   ========================================= */

/* Animación suave para los logos de confianza */
.logo-trust-container img, 
.logo-trust-container span {
    filter: grayscale(100%);
    opacity: 0.6;
    transition: all 0.3s ease;
    cursor: default;
}

/* Al pasar el mouse por la zona de logos, se colorean */
.logo-trust-container:hover img,
.logo-trust-container:hover span {
    filter: grayscale(0%);
    opacity: 1;
}

/* Efecto hover en la tarjeta completa para dar sensación Premium */
.wizard-step .card:hover {
    transform: translateY(-5px);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

/* Ajuste para el botón de garantía */
#btn-wizard-pay-setup {
    background: linear-gradient(45deg, #198754, #20c997);
    border: none;
    transition: all 0.2s ease;
}

#btn-wizard-pay-setup:hover {
    transform: scale(1.02);
    box-shadow: 0 5px 15px rgba(25, 135, 84, 0.4) !important;
}

/* =========================================================
   📱 CORRECCIONES MÓVILES (TABLA PEDIDOS & MODAL)
   ========================================================= */

/* =========================================================
   📱 CORRECCIONES MÓVILES (TABLA PEDIDOS & MODAL SCROLL)
   ========================================================= */

@media (max-width: 768px) {

    /* --- 1. TABLA CONVERTIDA EN TARJETAS (UberEats Style) --- */
    .pedidos-table thead {
        display: none; /* Adiós encabezados */
    }

    .pedidos-table tbody tr {
        display: block;
        background: #fff;
        border-radius: 16px; /* Más redondo */
        box-shadow: 0 4px 12px rgba(0,0,0,0.08);
        margin-bottom: 20px;
        border: 1px solid #f0f0f0;
        overflow: hidden;
    }

    .pedidos-table td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 12px 15px;
        border-bottom: 1px solid #f9f9f9;
        font-size: 0.95rem;
        text-align: right;
    }

    /* Etiquetas automáticas */
    .pedidos-table td:nth-of-type(1)::before { content: "ID"; font-weight: 700; color: #8898aa; }
    .pedidos-table td:nth-of-type(2)::before { content: "Fecha"; font-weight: 700; color: #8898aa; }
    .pedidos-table td:nth-of-type(3)::before { content: "Cliente"; font-weight: 700; color: #8898aa; }
    .pedidos-table td:nth-of-type(4)::before { content: "Total"; font-weight: 700; color: #8898aa; }
    .pedidos-table td:nth-of-type(5)::before { content: "Estado"; font-weight: 700; color: #8898aa; }

    /* Botón final sin borde y centrado */
    .pedidos-table td:last-child {
        border-bottom: none;
        justify-content: center;
        padding: 15px;
        background-color: #fcfcfc;
    }
    .ver-detalle-btn { width: 100%; justify-content: center; padding: 12px; font-size: 1rem; }

    /* --- 2. SOLUCIÓN AL MODAL CORTADO (SCROLL INTERNO) --- */
    
    #modalDetallePedido .modal-dialog {
        /* Márgenes para que no toque los bordes de la pantalla */
        margin: 0.5rem; 
        max-width: 100%;
        
        /* Truco para centrar sin cortar */
        display: flex;
        align-items: center;
        min-height: calc(100% - 1rem); 
    }
    
    #modalDetallePedido .modal-content {
        border-radius: 20px;
        /* Limitar la altura máxima de la tarjeta al 85% de la pantalla */
        max-height: 85vh; 
        display: flex;
        flex-direction: column;
    }

    #modalDetallePedido .modal-header,
    #modalDetallePedido .modal-footer {
        /* Encabezado y pie fijos (no scrollean) */
        flex-shrink: 0; 
        padding: 15px 20px;
    }

    /* ESTO ES LO QUE ARREGLA EL CORTE: */
    #modalDetallePedido .modal-body {
        overflow-y: auto; /* Activar scroll interno */
        padding: 20px;
        /* Scroll suave */
        -webkit-overflow-scrolling: touch; 
    }

    /* Ajustar tamaños de fuente para que quepa más info */
    #contenidoModal h5.fw-bold { font-size: 1.3rem; }
    #contenidoModal .fs-4 { font-size: 1.6rem !important; }
    
    /* Botones grandes y apilados para dedos */
    #panel-acciones-pedido .d-flex.gap-2 {
        flex-direction: column;
        gap: 10px !important;
    }
    #panel-acciones-pedido button {
        width: 100% !important;
        padding: 14px; /* Botones gorditos fáciles de tocar */
        font-size: 1rem;
    }
}

/* =================================================== */
/* --- 11. ANIMACIONES Y EXTRAS (BOTÓN PULSO) --- */
/* =================================================== */

/* Animación de latido para el botón de ayuda (Sales Bot) */
@keyframes pulse {
    0% { 
        transform: scale(1); 
        box-shadow: 0 4px 15px rgba(0,0,0, 0.2); 
    }
    50% { 
        transform: scale(1.1); 
        box-shadow: 0 0 20px rgba(37, 211, 102, 0.6); /* Brillo Verde */
    }
    100% { 
        transform: scale(1); 
        box-shadow: 0 4px 15px rgba(0,0,0, 0.2); 
    }
}

/* Asegura que el botón del bot siempre esté encima de todo */
#sales-bot-container {
    z-index: 9999 !important;
}