/* ===== MODERN TAB NAVIGATION STYLES ===== */

/* Remove default button styling and outlines */
/* CSS variables defined in :root (no empty rulesets) */

:root{
    /* Nueva paleta moderna (Indigo/Purple/Fuchsia) */
    --brand-500: #6366F1; /* Indigo 500 */
    --brand-600: #8B5CF6; /* Violet 500 */
    --brand-rgb: 99, 102, 241; /* Indigo 500 RGB */
    --accent-100: #EEF2FF; /* Indigo 50 */
    --muted-700: #374151;
    --muted-500: #6b7280;
    --bg-soft: #f8fafc;
}

*{box-sizing:border-box}

/* smoother default font rendering */
body{ -webkit-font-smoothing:antialiased; -moz-osx-font-smoothing:grayscale }

.tab-button{
    border: none;
    outline: none;
    background: transparent;
    cursor: pointer;
    position: relative;
    padding: 10px 18px;
    margin: 0 6px;
    border-radius: 10px 10px 0 0;
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--muted-500);
    transition: all 0.22s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

/* Remove any default borders */
.tab-button:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(var(--brand-rgb), 0.12);
    border-radius: 10px;
}

/* Hover state - subtle background */
.tab-button:hover:not(.active) {
    background: rgba(var(--brand-rgb), 0.08);
    color: var(--brand-500);
    transform: translateY(-2px);
}

/* Active tab - modern elevated design */
.tab-button.active {
    background: linear-gradient(135deg, var(--brand-500) 0%, var(--brand-600) 100%);
    color: white;
    border: none;
    box-shadow: 0 6px 18px rgba(var(--brand-rgb), 0.22);
    transform: translateY(-2px);
}

/* Icon styling within tabs */
.tab-button i {
    font-size: 1rem;
    transition: transform 0.22s ease;
}

.tab-button.active i { transform: scale(1.06); }

/* Alternative: Pills Design (Rounded) */
.tab-button-pills {
    border-radius: 24px;
    padding: 10px 20px;
    margin: 0 6px;
}

/* Loading animation */
.loading {
    border: 3px solid #eef2f6;
    border-top: 3px solid var(--brand-500);
    border-radius: 50%;
    width: 36px;
    height: 36px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Smooth transition for all interactive elements */
button, select, input { transition: all 0.16s ease }

/* Remove default focus outline on buttons, use custom */
button:focus { outline: none }

/* Status badges modern styling */
.status-badge{
    display:inline-flex;align-items:center;padding:4px 12px;border-radius:12px;font-size:0.75rem;font-weight:600;transition:all 0.18s ease
}

/* Card hover effects */
.card-hover{transition:all 0.24s ease}
.card-hover:hover{transform:translateY(-4px);box-shadow:0 10px 22px rgba(0,0,0,0.12)}

/* Scroll sutil */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}

/* Ocultar botones de scroll */
::-webkit-scrollbar-button {
    display: none;
}

::-webkit-scrollbar-button:single-button:hover {
    background-color: #ea580c;
}

/* Añadir iconos a las flechas de scroll */
::-webkit-scrollbar-button:single-button:vertical:decrement {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='white' viewBox='0 0 16 16'%3E%3Cpath d='M8 4l4 4H4z'/%3E%3C/svg%3E");
    background-position: center;
    background-repeat: no-repeat;
}

::-webkit-scrollbar-button:single-button:vertical:increment {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='white' viewBox='0 0 16 16'%3E%3Cpath d='M8 12l-4-4h8z'/%3E%3C/svg%3E");
    background-position: center;
    background-repeat: no-repeat;
}

/* Indicador de scroll */
.scroll-indicator {
    position: absolute;
    right: 16px;
    bottom: 16px;
    background: rgba(249, 115, 22, 0.9);
    color: white;
    padding: 8px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.3s ease;
    pointer-events: none;
    z-index: 100;
}

/* Clase para contenedor scrollable */
.scrollable-content {
    position: relative;
    overflow-y: auto;
    scroll-behavior: smooth;
}

/* Mostrar indicador cuando hay scroll */
.has-scroll .scroll-indicator {
    opacity: 1;
    transform: translateY(0);
}

/* Efecto de sombra superior e inferior para indicar scroll */
.scrollable-content::before,
.scrollable-content::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    height: 20px;
    pointer-events: none;
    z-index: 10;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.scrollable-content::before {
    top: 0;
    background: linear-gradient(to bottom, rgba(255,255,255,0.9) 0%, rgba(255,255,255,0) 100%);
}

.scrollable-content::after {
    bottom: 0;
    background: linear-gradient(to top, rgba(255,255,255,0.9) 0%, rgba(255,255,255,0) 100%);
}

.has-scroll.scroll-top::before,
.has-scroll.scroll-bottom::after {
    opacity: 1;
}

/* Modal animations */
@keyframes fadeIn{from{opacity:0;transform:scale(.98)}to{opacity:1;transform:scale(1)}}
.modal-content{animation:fadeIn .26s ease}

/* Notification pulse animation */
@keyframes pulse{0%,100%{opacity:1;transform:scale(1)}50%{opacity:.85;transform:scale(1.02)}}
.animate-pulse{animation:pulse 2.4s cubic-bezier(.4,0,.6,1) infinite}

/* Modern input focus states */
input:focus, select:focus, textarea:focus{outline:none;border-color:var(--brand-500);box-shadow:0 0 0 4px rgba(249,115,22,0.06)}

/* Button group spacing */
.button-group {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    width: 100%;
}

/* Acción de botones en pedidos */
.action-buttons {
    display: grid;
    grid-template-columns: repeat(2, 1fr); /* 2 columnas */
    gap: 12px;
    margin-top: 16px;
    width: 100%;
    padding: 16px;
    background: white;
    border-top: 1px solid #e5e7eb;
}

.action-buttons button {
    width: 100%;
    padding: 12px 16px;
    font-size: 0.9rem;
    font-weight: 500;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    white-space: nowrap;
    min-height: 44px;
    border: none;
    background: #f3f4f6;
    color: #374151;
    transition: all 0.2s ease;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.action-buttons button:hover {
    background: #e5e7eb;
    transform: translateY(-1px);
}

.action-buttons button i {
    font-size: 1.1rem;
}

.action-buttons button:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* Estilos específicos para el botón eliminar */
.action-buttons button[onclick*="deletePedido"] {
    flex: 1 1 100%;
    max-width: 100%;
    background-color: #fee2e2;
    color: #dc2626;
    border-color: #fecaca;
    margin-top: 4px;
    font-weight: 600;
}

.action-buttons button[onclick*="deletePedido"]:hover {
    background-color: #ef4444;
    color: white;
    border-color: #dc2626;
}

/* Glassmorphism effect for modern cards */
.glass-card {
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

/* Smooth page transitions */
.tab-content {
    animation: fadeInContent 0.4s ease;
}

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

/* Modern gradient backgrounds */
.gradient-bg {
    background: linear-gradient(135deg, #f97316 0%, #ea580c 100%);
}

/* Responsive adjustments */
/* Desktop styles */
@media (min-width: 1024px) {
    .scroll-instruction {
        text-align: center;
        padding: 12px;
        background: #fff3e0;
        color: #92400e;
        margin-bottom: 16px;
        border-radius: 8px;
        font-size: 0.95rem;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 8px;
        box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    }

    .scroll-instruction i {
        font-size: 1.2rem;
        animation: pulse 2s infinite;
    }

    @keyframes pulse {
        0%, 100% { transform: translateY(0); }
        50% { transform: translateY(-3px); }
    }

    #pedidos-container {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
        gap: 24px;
        padding: 24px;
        background: #f9fafb;
        min-height: calc(100vh - 120px);
        overflow-y: auto;
    }

    /* Contenedor de pedido individual */
    #pedidos-container > div {
        background: white;
        border-radius: 12px;
        box-shadow: 0 1px 3px rgba(0,0,0,0.1);
        transition: all 0.2s ease;
        display: flex;
        flex-direction: column;
        height: fit-content;
        max-height: none;
        padding: 0;
    }

    /* Contenido del pedido */
    .pedido-content {
        padding: 20px;
        flex: 1;
    }

    /* Info principal del pedido */
    .pedido-header {
        padding-bottom: 16px;
        margin-bottom: 16px;
        border-bottom: 1px solid #e5e7eb;
    }

    /* Detalles del pedido */
    .pedido-details {
        margin: 16px 0;
    }

    /* Estado del pedido */
    .status-badge {
        display: inline-flex;
        align-items: center;
        padding: 6px 12px;
        border-radius: 20px;
        font-weight: 600;
        font-size: 0.875rem;
    }

    /* Efecto hover para indicar interactividad */
    #pedidos-container > div:hover {
        transform: translateY(-2px);
        box-shadow: 0 4px 12px rgba(0,0,0,0.12);
    }

    /* Indicadores de scroll superior e inferior */
    #pedidos-container > div::before,
    #pedidos-container > div::after {
        content: '⌄';
        position: absolute;
        left: 50%;
        transform: translateX(-50%);
        font-size: 24px;
        font-weight: bold;
        color: #f97316;
        background: rgba(255, 255, 255, 0.9);
        padding: 4px 16px;
        border-radius: 20px;
        box-shadow: 0 2px 8px rgba(0,0,0,0.1);
        pointer-events: none;
        opacity: 0;
        transition: all 0.3s ease;
        z-index: 10;
    }

    #pedidos-container > div::before {
        content: '⌃';
        top: 8px;
    }

    #pedidos-container > div::after {
        bottom: 8px;
        animation: bounce 2s infinite;
    }

    @keyframes bounce {
        0%, 100% { transform: translateX(-50%) translateY(0); }
        50% { transform: translateX(-50%) translateY(-5px); }
    }

    /* Mostrar indicadores cuando hay scroll */
    #pedidos-container > div.has-scroll::before {
        opacity: 1;
    }

    #pedidos-container > div.has-scroll::after {
        opacity: 1;
    }

    /* Agregar texto indicador de scroll */
    #pedidos-container > div.has-scroll {
        border: 2px solid #f97316;
    }

    /* Añadir borde punteado para indicar área scrolleable */
    #pedidos-container > div {
        border: 2px dashed #e5e7eb;
    }

    /* Agregar mensaje de scroll */
    #pedidos-container > div.has-scroll::before {
        content: 'Desliza hacia arriba ⌃';
        font-size: 12px;
        padding: 4px 12px;
        white-space: nowrap;
    }

    #pedidos-container > div.has-scroll::after {
        content: 'Desliza hacia abajo ⌄';
        font-size: 12px;
        padding: 4px 12px;
        white-space: nowrap;
    }

    /* Estilo para las tarjetas de pedidos */
    #pedidos-container > div {
        background: white;
        border-radius: 8px;
        box-shadow: 0 2px 4px rgba(0,0,0,0.1);
        padding: 16px;
        max-height: 100%;
        overflow-y: auto;
        display: flex;
        flex-direction: column;
    }

    .action-buttons {
        grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
        margin-top: auto; /* Mantiene los botones al final de la tarjeta */
    }
}

/* Tablet styles */
@media (min-width: 641px) and (max-width: 1023px) {
    #pedidos-container {
        grid-template-columns: repeat(2, 1fr);
        gap: 16px;
        max-height: calc(100vh - 180px);
    }

    #pedidos-container > div {
        max-height: 600px;
    }

    .action-buttons {
        grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
        position: sticky;
        bottom: 0;
        background: white;
        padding-top: 8px;
        border-top: 1px solid rgba(0,0,0,0.1);
    }
}

/* Mobile styles */
@media (max-width: 640px) {
    .tab-button {
        padding: 8px 12px;
        font-size: 0.875rem;
        margin: 0 2px;
    }
    
    .tab-button i {
        font-size: 0.875rem;
    }

    .action-buttons {
        gap: 4px;
        padding: 6px;
        position: sticky;
        bottom: 0;
        background: #f8f9fa;
        border-radius: 0;
        border-top: 1px solid rgba(0,0,0,0.1);
        box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
    }

    .action-buttons button {
        flex: 1 1 calc(50% - 4px); /* 2 botones por fila en móvil */
        min-width: 0;
        max-width: none;
        font-size: 0.75rem;
        padding: 6px;
        min-height: 32px;
    }

    /* Ajuste para los botones de filtro y búsqueda */
    #filter-status, 
    #search-pedidos,
    .button-group button {
        width: 100%;
        margin: 4px 0;
    }

    /* Ajuste para el contenedor de pedidos */
    #pedidos-container {
        grid-template-columns: 1fr;
        gap: 12px;
        max-height: calc(100vh - 160px);
        padding-bottom: 80px; /* Espacio para los botones sticky */
        padding-left: 8px;
        padding-right: 8px;
    }

    #pedidos-container > div {
        margin-bottom: 12px;
        padding: 12px;
    }

    /* Botón eliminar más visible en móvil */
    .action-buttons button[onclick*="deletePedido"] {
        flex: 1 1 100%;
        margin-top: 4px;
        min-height: 40px;
        font-size: 0.875rem;
        background-color: #fee2e2;
        color: #dc2626;
        font-weight: 600;
        order: 999;
    }
}

/* Accessibility improvements */
.tab-button:focus-visible {
    outline: 2px solid #f97316;
    outline-offset: 2px;
}

/* Logo image helper: prefer transparent background and consistent sizing */
.logo-img{background:transparent!important;display:inline-block;object-fit:contain;border-radius:6px}

/* Print styles */
@media print {
    /* Ocultar elementos de navegación */
    .tab-button,
    nav,
    header,
    button {
        display: none !important;
    }
    
    /* Optimizar página de impresión */
    @page {
        size: 80mm auto; /* Ancho de ticket térmico */
        margin: 2mm;
    }
    
    body {
        margin: 0;
        padding: 0;
    }
    
    /* Reducir espacios en comanda */
    .comanda-print {
        font-size: 10px !important;
        line-height: 1.2 !important;
        max-width: 76mm;
    }
    
    .comanda-print h1 {
        font-size: 14px !important;
        margin-bottom: 4px !important;
    }
    
    .comanda-print h3 {
        font-size: 11px !important;
        margin-bottom: 2px !important;
    }
    
    .comanda-print p,
    .comanda-print td {
        font-size: 9px !important;
        margin: 0 !important;
        padding: 1px 0 !important;
    }
    
    .comanda-print .mb-4,
    .comanda-print .mb-3,
    .comanda-print .mb-2 {
        margin-bottom: 4px !important;
    }
    
    .comanda-print .pb-3,
    .comanda-print .pb-2 {
        padding-bottom: 2px !important;
    }
    
    .comanda-print .p-3,
    .comanda-print .p-2 {
        padding: 4px !important;
    }
    
    /* Eliminar fondos y bordes decorativos en impresión */
    .comanda-print .bg-yellow-50,
    .comanda-print .bg-green-50 {
        background: white !important;
        border: 1px solid #000 !important;
    }
    
    .comanda-print .border-2 {
        border-width: 1px !important;
    }
    
    /* Optimizar tabla */
    .comanda-print table {
        width: 100%;
        border-collapse: collapse;
    }
    
    .comanda-print th,
    .comanda-print td {
        padding: 2px !important;
    }
}
/* ====== Mapas de mensajes (Leaflet/OpenStreetMap) ====== */
.location-preview { display: flex; flex-direction: column; gap: 6px; }
.message-map { height: 160px; width: 100%; border-radius: 8px; overflow: hidden; }
.map-link { color: #2563eb; font-size: 12px; text-decoration: none; }
.map-link:hover { text-decoration: underline; }
