/* ==========================================
   1. VARIABLES & PALETA DE COLORES (BRANDING)
   ========================================== */
:root {
    --bobby-yellow: #F2C823;       /* Amarillo mostaza vibrante del perro */
    --bobby-red: #D32F2F;          /* Rojo kétchup / salchicha */
    --bobby-red-hover: #B71C1C;    /* Rojo oscuro para hover */
    --bobby-dark: #121212;         /* Negro delineado / moderno */
    --bobby-cream: #FCF9F2;        /* Fondo suave para simular el pan y confort visual */
    --bobby-white: #FFFFFF;
    --bobby-gray-light: #F1EFF5;
    --bobby-text-muted: #6C757D;
    --radius-lg: 20px;             /* Bordes suavizados premium */
    --radius-md: 12px;
}

/* ==========================================
   2. ESTILOS GENERALES Y ACCESIBILIDAD MÓVIL
   ========================================== */
body {
    font-family: 'Rubik', sans-serif;
    background-color: var(--bobby-cream);
    color: var(--bobby-dark);
    -webkit-tap-highlight-color: transparent; /* Elimina recuadro azul táctil en iOS/Android */
    overflow-x: hidden;
}

/* Scrollbars estilizados */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-thumb {
    background-color: var(--bobby-yellow);
    border-radius: 10px;
}

/* Evitar acumulación de sombras en modales de Bootstrap */
.modal-backdrop {
    z-index: 1050 !important;
}
.modal {
    z-index: 1060 !important;
}
body.modal-open {
    overflow: hidden !important;
    padding-right: 0 !important;
}

/* ==========================================
   3. LOGO Y TEXTO DE ENCABEZADO (PÚBLICO)
   ========================================== */
.bobby-logo-menu {
    max-height: 90px;
    width: 90px;
    object-fit: cover;
    border-radius: 50%;
    border: 3px solid var(--bobby-yellow);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease;
}

.bobby-logo-menu:hover {
    transform: rotate(5deg) scale(1.05);
}

.bobby-title {
    font-size: 1.8rem;
    color: var(--bobby-red);
    letter-spacing: -0.5px;
    margin-bottom: 2px;
}

.bobby-subtitle {
    font-size: 0.9rem;
    color: var(--bobby-text-muted);
}

/* ==========================================
   4. OPTIMIZACIÓN DEL MENÚ ADMINISTRATIVO (NAVBAR)
   ========================================== */
#nav-container .navbar, 
.navbar {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    padding: 0.5rem 1.25rem !important;
}

#nav-container .navbar-nav,
.navbar-nav {
    display: flex !important;
    flex-direction: row !important; /* Fuerza mantener la fila */
    align-items: center !important;
    gap: 8px !important; /* Espaciado uniforme controlado */
    margin: 0 auto !important; /* Centra el menú */
}

/* Enlaces individuales (Icono + Texto) */
#nav-container .nav-link,
.navbar-nav .nav-link {
    display: flex !important;
    flex-direction: column; /* Icono arriba, texto abajo por defecto */
    align-items: center;
    justify-content: center;
    font-size: 0.82rem !important;
    font-weight: 500 !important;
    color: rgba(255, 255, 255, 0.85) !important;
    padding: 6px 12px !important;
    border-radius: 10px;
    transition: all 0.2s ease-in-out;
    text-align: center;
}

#nav-container .nav-link:hover,
#nav-container .nav-link.active,
.navbar-nav .nav-link:hover,
.navbar-nav .nav-link.active {
    color: #FFFFFF !important;
    background-color: rgba(255, 255, 255, 0.12);
}

#nav-container .nav-link i,
#nav-container .nav-link .bi,
.navbar-nav .nav-link .bi {
    font-size: 1.15rem !important;
    margin-bottom: 2px !important;
}

/* ==========================================
   5. REJILLA DE CATEGORÍAS (AUTO-AJUSTABLE)
   ========================================== */
.bobby-category-grid {
    display: flex;
    flex-wrap: wrap; /* Baja ordenadamente en pantallas móviles si no caben */
    justify-content: center; /* Centra los botones */
    gap: 8px; /* Espacio uniforme entre cápsulas */
    width: 100%;
}

/* Botones de categorías individuales */
.bobby-category-grid .btn,
#cat-publico .btn {
    border-radius: 50px; /* Forma de cápsula */
    font-size: 0.85rem;
    font-weight: 600;
    padding: 8px 16px;
    border: 2px solid transparent;
    transition: all 0.2s ease-in-out;
    text-transform: uppercase;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 38px; /* Tamaño táctil para el dedo */
}

/* Categoría no seleccionada */
.bobby-category-grid .btn-outline-danger,
#cat-publico .btn-outline-danger {
    background-color: var(--bobby-white);
    color: var(--bobby-dark);
    border-color: var(--bobby-gray-light);
}

.bobby-category-grid .btn-outline-danger:hover,
#cat-publico .btn-outline-danger:hover {
    background-color: rgba(242, 200, 35, 0.1);
    border-color: var(--bobby-yellow);
    color: var(--bobby-dark);
}

/* Categoría activa (Color amarillo Bobby Hot Dog) */
.bobby-category-grid .btn-danger,
#cat-publico .btn-danger,
.bobby-category-grid .btn-outline-danger.active,
#cat-publico .btn-outline-danger.active {
    background-color: var(--bobby-yellow) !important;
    color: var(--bobby-dark) !important;
    border-color: var(--bobby-yellow) !important;
    font-weight: 700;
    box-shadow: 0 4px 10px rgba(242, 200, 35, 0.3);
}

/* ==========================================
   6. CONTENEDOR DE MODALES ESTILO "MOBILE-APP"
   ========================================== */
.modal-content {
    border: none;
    border-radius: var(--radius-lg);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.15);
    background-color: var(--bobby-white);
    overflow: hidden;
}

.header-bobby-dark {
    background-color: var(--bobby-dark);
    color: var(--bobby-white);
    border-bottom: 3px solid var(--bobby-yellow);
    padding: 1.25rem 1.5rem;
}

.header-bobby-red {
    background-color: var(--bobby-red);
    color: var(--bobby-white);
    border-bottom: 3px solid var(--bobby-yellow);
    padding: 1.25rem 1.5rem;
}

.section-title {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--bobby-text-muted);
    letter-spacing: 0.8px;
    margin-bottom: 12px;
    display: block;
}

.price-tag {
    font-size: 1.3rem;
    font-weight: 800;
    color: var(--bobby-red);
    background-color: rgba(211, 47, 47, 0.08);
    display: inline-block;
    padding: 4px 16px;
    border-radius: 50px;
}

/* ==========================================
   7. INPUTS, SWITCHES Y COMPONENTES INTERACTIVOS
   ========================================== */
/* Switches de ingredientes */
.form-check.form-switch {
    display: flex;
    align-items: center;
    background-color: var(--bobby-white);
    border: 1px solid rgba(0,0,0,0.08);
    padding: 10px 14px 10px 45px;
    border-radius: var(--radius-md);
    transition: all 0.2s ease-in-out;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0,0,0,0.02);
}

.form-check.form-switch:hover,
.form-check.form-switch:focus-within {
    border-color: var(--bobby-yellow);
    transform: translateY(-1px);
}

/* Personalización visual de los switches activos de ingredientes */
.form-switch .form-check-input {
    width: 2.5em !important;
    height: 1.25em !important;
    margin-left: -2.8em !important;
    cursor: pointer;
}

/* Estilo para checkboxes normales (Evita que se oculten en las tablas de reparto) */
.table .form-check-input {
    width: 1.25em !important;
    height: 1.25em !important;
    margin-left: 0 !important; /* Resetea el margen de los switches */
    cursor: pointer;
    border: 2px solid #ced4da;
}

.table .form-check-input:checked {
    background-color: var(--bobby-red) !important;
    border-color: var(--bobby-red) !important;
}

.form-check-input:checked {
    background-color: var(--bobby-red);
    border-color: var(--bobby-red);
}

.form-check-input:focus {
    border-color: var(--bobby-red);
    box-shadow: 0 0 0 0.25rem rgba(211, 47, 47, 0.2);
}

/* Inputs de texto y notas */
.quantity-input,
.text-area-custom {
    border: 2px solid var(--bobby-gray-light);
    border-radius: var(--radius-md);
    padding: 10px 14px;
    font-size: 0.95rem;
    color: var(--bobby-dark);
    transition: all 0.2s ease;
}

.quantity-input:focus,
.text-area-custom:focus {
    border-color: var(--bobby-yellow);
    box-shadow: 0 0 0 0.25rem rgba(242, 200, 35, 0.15);
    outline: none;
}

.quantity-input {
    height: 48px;
    text-align: center;
    font-weight: 700;
    font-size: 1.1rem;
}

/* ==========================================
   8. BOTONES & MICRO-INTERACCIONES
   ========================================== */
.btn-bobby-primary {
    background-color: var(--bobby-red);
    color: var(--bobby-white);
    font-weight: 700;
    font-size: 1rem;
    padding: 14px 20px;
    border-radius: 50px;
    border: none;
    box-shadow: 0 4px 12px rgba(211, 47, 47, 0.3);
    transition: transform 0.1s ease, background-color 0.2s ease;
}

.btn-bobby-primary:hover {
    background-color: var(--bobby-red-hover);
    color: var(--bobby-white);
}

.btn-bobby-primary:active,
.btn-pos:active {
    transform: scale(0.96);
    transition: 0.05s;
}

.btn-pos {
    border-radius: var(--radius-md);
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
    border: 2px solid transparent;
}

.btn-pos:hover {
    border-color: var(--bobby-yellow);
    box-shadow: 0 8px 16px rgba(0,0,0,0.06);
}

.btn-pos img {
    border-radius: 10px 10px 0 0;
}

/* ==========================================
   9. BOTÓN FLOTANTE DEL CARRITO & FORMULARIOS
   ========================================== */
#btn-carrito-flotante {
    background: linear-gradient(to top, rgba(252, 249, 242, 0.95) 70%, rgba(252, 249, 242, 0));
    backdrop-filter: blur(4px);
    border-top: 1px solid rgba(0,0,0,0.03);
}

#btn-carrito-flotante button {
    background-color: var(--bobby-red);
    border: none;
    font-size: 1rem;
    padding: 14px;
    box-shadow: 0 8px 24px rgba(211, 47, 47, 0.35) !important;
    transition: transform 0.1s ease;
}

#btn-carrito-flotante button:active {
    transform: scale(0.97);
}

/* Formulario del pedido */
#formFinalizarPedido input,
#formFinalizarPedido select {
    border-radius: var(--radius-md);
    padding: 10px 12px;
    border: 1px solid var(--bobby-gray-light);
    font-size: 0.9rem;
}

#formFinalizarPedido input:focus,
#formFinalizarPedido select:focus {
    border-color: var(--bobby-yellow);
    box-shadow: 0 0 0 0.2rem rgba(242, 200, 35, 0.15);
}

#formFinalizarPedido .btn-success {
    background-color: #2E7D32;
    border: none;
    padding: 14px;
    font-size: 1rem;
    box-shadow: 0 4px 12px rgba(46, 125, 50, 0.3);
}

/* ==========================================
   10. MEDIA QUERIES (RESPONSIVE DE NAVBAR & DISPOSITIVOS)
   ========================================== */

/* Ajuste para pantallas medianas o barra en pantalla dividida (split-screen) */
@media (max-width: 1250px) {
    #nav-container .navbar-brand,
    .navbar-brand {
        font-size: 1.1rem !important;
    }
    #nav-container .navbar-brand img,
    .navbar-brand img {
        max-height: 35px !important;
    }

    /* Redirige el diseño de iconos apilados a iconos laterales (al lado del texto) */
    #nav-container .nav-link,
    .navbar-nav .nav-link {
        flex-direction: row !important; 
        gap: 6px !important;
        padding: 8px 10px !important;
        font-size: 0.8rem !important;
    }

    #nav-container .nav-link i,
    #nav-container .nav-link .bi,
    .navbar-nav .nav-link .bi {
        font-size: 1rem !important;
        margin-bottom: 0 !important;
    }

    #nav-container .navbar-nav,
    .navbar-nav {
        gap: 4px !important;
    }

    /* Compacta el bloque administrativo para ahorrar espacio */
    #nav-container .profile-box,
    .navbar-profile,
    div[class*="Administrador"] { 
        padding: 4px 8px !important;
        font-size: 0.8rem !important;
    }
    
    #nav-container .profile-box span.small,
    .navbar-profile span.text-muted {
        display: none !important; /* Oculta el texto repetido secundario */
    }
}

/* Modificación para tabletas (scroll horizontal suave en nav si es necesario) */
@media (max-width: 991px) {
    #nav-container .navbar-collapse,
    .navbar-collapse {
        overflow-x: auto;
        white-space: nowrap;
        -webkit-overflow-scrolling: touch;
    }
    
    #nav-container .navbar-nav,
    .navbar-nav {
        flex-wrap: nowrap !important;
    }
}

/* Modificaciones extremas para móviles (Efecto Bottom-Sheet en Modales) */
@media (max-width: 576px) {
    .modal-dialog {
        margin: 0;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        width: 100%;
        max-width: 100%;
    }
    
    .modal-content {
        border-radius: var(--radius-lg) var(--radius-lg) 0 0;
        max-height: 92vh;
        overflow-y: auto;
    }
}

/* Obligar a la lista de Google a estar por encima del modal */
.pac-container {
    z-index: 2000 !important; 
    border-radius: 8px;
    font-family: 'Rubik', sans-serif;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

/* Limita la descripción a 2 líneas y pone puntos suspensivos (...) si es más larga */
#prod-publico p.text-muted {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Efecto al presionar el producto */
#prod-publico .card {
    transition: transform 0.2s;
}
#prod-publico .card:active {
    transform: scale(0.96);
}
.text-decoration-line-through {
    color: #adb5bd !important; /* Gris suave para el precio anterior */
}

.card-body h6 {
    color: #333;
    font-size: 0.9rem;
}
/* Contenedor de Imagen con Zoom */
.bobby-card-img-container {
    height: 130px;
    overflow: hidden;
    position: relative;
    background-color: var(--bobby-gray-light);
}

.bobby-img {
    height: 100%;
    width: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.bobby-card:hover .bobby-img {
    transform: scale(1.1);
}

/* Títulos y Descripciones */
.bobby-product-title {
    font-size: 0.95rem;
    color: var(--bobby-dark);
    line-height: 1.2;
}

.bobby-product-desc {
    font-size: 0.72rem;
    color: var(--bobby-text-muted);
    height: 2.8em;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

/* Precios */
.bobby-price-normal {
    font-size: 1.15rem;
    font-weight: 800;
    color: var(--bobby-red);
}

.bobby-price-new {
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--bobby-red);
    line-height: 1;
}

.bobby-price-old {
    font-size: 0.8rem;
    color: var(--bobby-text-muted);
    text-decoration: line-through;
    margin-bottom: -2px;
}

/* Badges y Etiquetas */
.bobby-badge-promo {
    position: absolute;
    top: 10px;
    left: 10px;
    background-color: var(--bobby-yellow);
    color: var(--bobby-dark);
    font-weight: 800;
    font-size: 0.65rem;
    padding: 4px 10px;
    border-radius: 50px;
    z-index: 10;
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.bobby-vence-tag {
    font-size: 0.62rem;
    font-weight: 700;
    color: #FFFFFF;
    background-color: var(--bobby-dark);
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    margin-top: 4px;
    text-transform: uppercase;
}

/* Botón de Agregar Estilizado */
.btn-bobby-add {
    background-color: var(--bobby-yellow);
    color: var(--bobby-dark);
    border: none;
    font-weight: 700;
    font-size: 0.85rem;
    padding: 8px;
    border-radius: 12px;
    transition: all 0.2s;
}

.btn-bobby-add:hover {
    background-color: var(--bobby-dark);
    color: var(--bobby-yellow);
}

.btn-bobby-add:active {
    transform: scale(0.95);
}

/* Card General */
.bobby-card {
    border-radius: var(--radius-lg);
    background: var(--bobby-white);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.bobby-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0,0,0,0.1) !important;
}

/* ==========================================
   MEJORAS RESPONSIVE PARA EL ADMIN
   ========================================== */

@media (max-width: 768px) {
    /* Ajuste de títulos */
    h2.fw-bold {
        font-size: 1.5rem;
    }

    /* Forzar que las celdas de las tablas no sean tan anchas en móvil */
    .table td, .table th {
        font-size: 0.85rem;
        padding: 0.5rem !important;
        white-space: nowrap; /* Evita que el texto rompa en mil líneas */
    }

    /* Hacer que las imágenes de la tabla sean más pequeñas */
    .table img {
        width: 40px !important;
        height: 40px !important;
    }

    /* Botones de acción en tablas: para que no se vean gigantes */
    .btn-sm {
        padding: 0.25rem 0.5rem;
        font-size: 0.75rem;
    }

    /* Modales: Ajustar para que el contenido no pegue a los bordes */
    .modal-body {
        padding: 1rem !important;
    }

    /* Quitar el borde lateral en modales en móvil */
 @media (min-width: 768px) {
    .border-end-md {
        border-right: 1px solid #dee2e6 !important;
    }
}
@media (max-width: 767px) {
    .border-end-md {
        border-bottom: 1px solid #dee2e6 !important;
        margin-bottom: 1.5rem;
        padding-bottom: 1.5rem;
    }
}
}

/* Optimización para el Modal OCR (Tabla muy ancha) */
#bodyResultadosOCR input, 
#bodyResultadosOCR select {
    min-width: 100px; /* Evita que los inputs colapsen en el OCR */
}

/* Estilo "Mobile First" para las acciones de la tabla */
.table .d-flex.gap-1 {
    justify-content: flex-start;
}

/* Ajuste para que los inputs en modales sean fáciles de tocar con el dedo */
input, select, textarea {
    min-height: 44px; /* Tamaño mínimo recomendado por Apple/Google para touch */
}

/* Mejorar el scroll horizontal de las tablas en móvil */
.table-responsive {
    border: 0;
    margin-bottom: 0;
    -webkit-overflow-scrolling: touch; /* Scroll suave en iOS */
}

/* Media query para el borde lateral de los modales */
@media (min-width: 768px) {
    .border-end-md {
        border-right: 1px solid #dee2e6 !important;
    }
}

/* Ajuste de inputs para evitar zoom automático en iPhone */
@media screen and (max-width: 767px) {
    input, select, textarea {
        font-size: 16px !important;
    }
    .modal-fullscreen-md-down .modal-content {
        border-radius: 0;
    }
}

/* Estilo para las líneas de la receta */
#tablaComposicion tr td {
    padding: 8px 4px;
    vertical-align: middle;
}

/* Evitar que las tablas se vean amontonadas */
.table td {
    white-space: nowrap;
}