@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&display=swap');
@import url('modal.css');

/* --- BOOTSTRAP OVERRIDES (Minimalist Monochromatic) --- */
:root {
    --bs-primary: #1e293b;
    --bs-secondary: #64748b;
    --bs-body-bg: #f8fafc;
    --bs-body-color: #0f172a;
    --bs-border-color: #e2e8f0;
    --bs-font-sans-serif: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
}
.btn-primary { background-color: var(--bs-primary); border-color: var(--bs-primary); }
.btn-primary:hover { background-color: #0f172a; border-color: #0f172a; }
.card { transition: transform 0.2s ease, box-shadow 0.2s ease; border: none; box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03); }
.card:hover { transform: translateY(-3px); box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -2px rgba(0, 0, 0, 0.04); }
/* Category Chips */
.category-chip { padding: 0.5rem 1.2rem; border-radius: 50rem; background: #fff; border: 1px solid var(--bs-border-color); color: var(--bs-body-color); transition: all 0.2s; white-space: nowrap; cursor: pointer; text-decoration: none; }
.category-chip:hover, .category-chip.active { background: var(--bs-primary); color: #fff; border-color: var(--bs-primary); }
/* Admin Layout Fix */
.app-module-content { width: calc(100% - 250px); margin-left: 250px; padding: 28px 36px; transition: all 0.15s ease-in-out; }
@media (max-width: 1024px) {
    .app-module-content { padding: 22px 20px; }
}
@media (max-width: 768px) {
    .app-module-content { width: 100%; margin-left: 0; margin-top: 56px; padding: 16px 14px 44px; min-height: calc(100vh - 56px); }
}
/**
 * Order and Dinner - Sistema de Diseño Minimalista y Responsivo
 * Compatible con Desktop (PC) y Smartphones (Mobile-first)
 */

:root {
    /* Tipografía */
    --font-sans: 'Plus Jakarta Sans', system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;

    /* Colores Base */
    --bg-app: #f8fafc;
    --bg-card: #ffffff;
    --bg-input: #ffffff;
    --border-color: #e2e8f0;
    --border-hover: #cbd5e1;

    /* Textos */
    --text-primary: #0f172a;
    --text-secondary: #334155;
    --text-muted: #64748b;
    --text-light: #94a3b8;

    /* Marca y Acentos (Coral Gastronómico) */
    --accent: #ea580c;
    --accent-hover: #c2410c;
    --accent-light: #fff7ed;
    --accent-border: #fed7aa;

    /* Primario (Azul Sistema) */
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --primary-light: #eff6ff;

    /* Estados Semánticos */
    --success: #16a34a;
    --success-bg: #f0fdf4;
    --success-border: #bbf7d0;

    --warning: #d97706;
    --warning-bg: #fffbeb;
    --warning-border: #fde68a;

    --danger: #dc2626;
    --danger-bg: #fef2f2;
    --danger-border: #fecaca;

    --info: #0284c7;
    --info-bg: #f0f9ff;
    --info-border: #bae6fd;

    /* Sombras Suaves */
    --shadow-xs: 0 1px 2px 0 rgba(0, 0, 0, 0.04);
    --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.06), 0 1px 2px -1px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.04);

    /* Radios */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --radius-full: 9999px;

    /* Transiciones */
    --transition: all 0.15s ease-in-out;
}

/* Reset y Base */
*, *::before, *::after {
    box-sizing: border-box;
}

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    padding: 0;
    background-color: var(--bg-app);
    color: var(--text-primary);
    font-family: var(--font-sans);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Tipografía */
h1, h2, h3, h4, h5, h6 {
    margin: 0 0 0.5rem 0;
    font-weight: 600;
    line-height: 1.25;
    color: var(--text-primary);
}

h1 { font-size: clamp(1.4rem, 2.2vw, 2rem); }
h2 { font-size: clamp(1.2rem, 1.8vw, 1.5rem); }
h3 { font-size: 1.15rem; }

p {
    margin: 0 0 0.8rem 0;
    color: var(--text-secondary);
}

a {
    color: var(--accent);
    text-decoration: none;
    transition: var(--transition);
}

a:hover {
    color: var(--accent-hover);
}

/* Layout del Módulo con Sidebar */
.app-module-content {
    box-sizing: border-box;
    min-height: 100vh;
    width: calc(100% - 250px);
    margin-left: 250px;
    padding: 28px 36px;
    transition: var(--transition);
}

@media (max-width: 768px) {
    .app-module-content {
        width: 100%;
        margin-left: 0;
        margin-top: 56px; /* Altura de la topbar móvil */
        padding: 18px 16px 40px;
        min-height: calc(100vh - 56px);
    }
}

/* Tarjetas (Cards) */
.card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-xs);
    padding: 20px;
    margin-bottom: 20px;
    transition: var(--transition);
}

.card:hover {
    border-color: var(--border-hover);
}

/* Botones */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 9px 16px;
    min-height: 42px;
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 500;
    line-height: 1;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    cursor: pointer;
    text-decoration: none;
    transition: var(--transition);
    user-select: none;
    white-space: nowrap;
}

.btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.btn-primary {
    background-color: var(--primary);
    color: #ffffff;
}
.btn-primary:hover:not(:disabled) {
    background-color: var(--primary-hover);
    color: #ffffff;
}

.btn-accent {
    background-color: var(--accent);
    color: #ffffff;
}
.btn-accent:hover:not(:disabled) {
    background-color: var(--accent-hover);
    color: #ffffff;
}

.btn-secondary {
    background-color: #ffffff;
    color: var(--text-primary);
    border-color: var(--border-color);
}
.btn-secondary:hover:not(:disabled) {
    background-color: #f1f5f9;
    border-color: var(--border-hover);
}

.btn-success {
    background-color: var(--success);
    color: #ffffff;
}
.btn-success:hover:not(:disabled) {
    background-color: #15803d;
}

.btn-danger {
    background-color: var(--danger);
    color: #ffffff;
}
.btn-danger:hover:not(:disabled) {
    background-color: #b91c1c;
}

.btn-outline {
    background-color: transparent;
    border-color: var(--border-color);
    color: var(--text-primary);
}
.btn-outline:hover:not(:disabled) {
    background-color: #f8fafc;
    border-color: var(--border-hover);
}

.btn-sm {
    padding: 6px 12px;
    min-height: 32px;
    font-size: 0.82rem;
}

.btn-block {
    width: 100%;
    display: flex;
}

/* Formularios e Inputs */
.form-group {
    margin-bottom: 16px;
}

.form-label {
    display: block;
    margin-bottom: 6px;
    font-size: 0.86rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.form-control, .form-select, select, input[type="text"], input[type="email"], input[type="password"], input[type="number"], input[type="search"], input[type="tel"], textarea {
    width: 100%;
    box-sizing: border-box;
    min-height: 42px;
    padding: 9px 13px;
    font-family: inherit;
    font-size: 0.92rem;
    color: var(--text-primary);
    background-color: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    outline: none;
    transition: var(--transition);
}

.form-control:focus, select:focus, input:focus, textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(234, 88, 12, 0.15);
}

/* Badges / Estados */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 9px;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: var(--radius-full);
    line-height: 1.3;
    letter-spacing: 0.02em;
}

.badge-revision { background-color: #fef3c7; color: #92400e; border: 1px solid #fde68a; }
.badge-pendiente { background-color: var(--warning-bg); color: var(--warning); border: 1px solid var(--warning-border); }
.badge-preparacion { background-color: var(--primary-light); color: var(--primary); border: 1px solid #bfdbfe; }
.badge-listo { background-color: var(--info-bg); color: var(--info); border: 1px solid var(--info-border); }
.badge-camino { background-color: #faf5ff; color: #7c3aed; border: 1px solid #e9d5ff; }
.badge-entregado { background-color: var(--success-bg); color: var(--success); border: 1px solid var(--success-border); }
.badge-cancelado { background-color: var(--danger-bg); color: var(--danger); border: 1px solid var(--danger-border); }

/* Tablas Responsivas */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-card);
    margin-bottom: 20px;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
    text-align: left;
}

th, td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
}

th {
    background-color: #f8fafc;
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.8rem;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

tr:last-child td {
    border-bottom: none;
}

tr:hover td {
    background-color: #fbfcfe;
}

/* Tarjetas KPI (Dashboard) */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.kpi-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 18px 20px;
    box-shadow: var(--shadow-xs);
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.kpi-card span {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.kpi-card h3 {
    margin: 0;
    font-size: 1.7rem;
    font-weight: 700;
    color: var(--text-primary);
}

/* Pestañas (Tabs) */
.tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 18px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 8px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.tab-btn {
    padding: 8px 16px;
    min-height: 38px;
    border: 1px solid transparent;
    background: transparent;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-muted);
    cursor: pointer;
    white-space: nowrap;
    transition: var(--transition);
}

.tab-btn:hover {
    color: var(--text-primary);
    background: #f1f5f9;
}

.tab-btn.active {
    color: var(--accent);
    background: var(--accent-light);
    border-color: var(--accent-border);
    font-weight: 600;
}

/* Utilidades Flex y Grid */
.flex-between {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.gap-sm { gap: 8px; }
.gap-md { gap: 16px; }

/* Encabezados y barras de acciones responsivas */
.header-panel,
.actions-header,
.page-header,
.header-module,
.header-delivery,
.header-dashboard,
.toolbar-module {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 20px;
}

@media (max-width: 640px) {
    .header-panel,
    .actions-header,
    .page-header,
    .header-module,
    .header-delivery,
    .toolbar-module {
        flex-direction: column;
        align-items: stretch !important;
        gap: 12px;
    }
    .header-panel > div,
    .actions-header > div,
    .header-module > div,
    .header-delivery > div,
    .toolbar-module > div,
    .header-panel > button,
    .actions-header > button,
    .actions-header > a,
    .header-panel > a,
    .header-module > a,
    .header-module > button {
        width: 100% !important;
        justify-content: center !important;
        text-align: center !important;
    }
    .actions-bar,
    .actions-cell {
        display: flex;
        flex-wrap: wrap;
        width: 100%;
        gap: 8px;
    }
    .actions-bar > button,
    .actions-bar > a {
        flex: 1 1 auto;
        justify-content: center;
        text-align: center;
    }
    .search-box {
        min-width: 100% !important;
        max-width: 100% !important;
        width: 100% !important;
    }
    .form-row,
    .modal-grid-2 {
        grid-template-columns: 1fr !important;
        gap: 10px !important;
    }
    .lista-productos,
    .config-grid,
    .modules-grid {
        grid-template-columns: 1fr !important;
    }
}

/* --- REJILLAS RESPONSIVAS AUTOMÁTICAS --- */
.grid-pagos,
.grid-comandas,
.grid-despachos,
.orders-grid,
.pedidos-grid,
.empresas-delivery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 16px;
}

@media (max-width: 768px) {
    .grid-pagos,
    .grid-comandas,
    .grid-despachos,
    .orders-grid,
    .pedidos-grid,
    .empresas-delivery-grid {
        grid-template-columns: 1fr !important;
        gap: 14px;
    }
}

.stats-bar,
.kpi-grid,
.kpis-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
}

@media (max-width: 480px) {
    .stats-bar,
    .kpi-grid,
    .kpis-grid {
        grid-template-columns: 1fr !important;
        gap: 8px;
    }
    .stat-card,
    .kpi-card {
        padding: 10px 12px !important;
    }
    .stat-icon {
        width: 36px !important;
        height: 36px !important;
        font-size: 1.1rem !important;
    }
    .stat-info .stat-val {
        font-size: 1.15rem !important;
    }
}

/* Tablas con scroll horizontal suave y sin desbordamientos */
.table-responsive,
.card-table,
.table-container {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-card);
    margin-bottom: 20px;
}

/* Accesibilidad táctil en móvil */
@media (max-width: 768px) {
    .btn, .form-control, select, input {
        min-height: 44px; /* Tamaño táctil mínimo */
    }
    th, td {
        padding: 10px 12px;
        font-size: 0.85rem;
    }
}

/* Estilos SweetAlert2 adaptados al tema */
.swal2-od-popup {
    border-radius: var(--radius-md) !important;
    font-family: var(--font-sans) !important;
    box-shadow: var(--shadow-lg) !important;
}
.swal2-od-popup .swal2-title {
    color: var(--text-primary) !important;
    font-size: 1.25rem !important;
}
.swal2-od-popup .swal2-html-container {
    color: var(--text-secondary) !important;
    font-size: 0.95rem !important;
}
.swal2-od-popup .swal2-confirm,
.swal2-od-popup .swal2-cancel {
    border-radius: var(--radius-sm) !important;
    font-weight: 600 !important;
    font-size: 0.9rem !important;
}
.swal2-od-popup .swal2-input,
.swal2-popup .swal2-input {
    max-width: 100% !important;
    box-sizing: border-box !important;
}

/* Asegurar que las alertas, modales y confirmaciones de SweetAlert2 SIEMPRE se sobrepongan al frente de todo */
.swal2-container,
.swal2-container.swal2-backdrop-show,
div:where(.swal2-container),
div:where(.swal2-container).swal2-backdrop-show {
    z-index: 999999 !important;
}

/* Posicionamiento y diseño de Toasts SweetAlert2 limpios */
body.swal2-toast-shown .swal2-container,
.swal2-container:has(.swal2-toast),
.swal2-container.swal2-bottom-end,
.swal2-container.swal2-top-end,
div:where(.swal2-container).swal2-bottom-end,
div:where(.swal2-container).swal2-top-end {
    background: transparent !important;
    background-color: transparent !important;
    pointer-events: none !important;
    height: auto !important;
    width: auto !important;
    max-width: 100vw !important;
    z-index: 999999 !important;
}
.swal2-popup.swal2-toast {
    pointer-events: auto !important;
    box-shadow: 0 10px 25px -3px rgba(0, 0, 0, 0.12), 0 4px 6px -2px rgba(0, 0, 0, 0.05) !important;
    border-radius: var(--radius-md) !important;
    border: 1px solid var(--border-color) !important;
}

/* --- APP MOBILE REDESIGN (PEDIDOS YA STYLE) --- */

/* Header */
.app-header {
    background-color: #ffffff;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}
.app-title {
    color: #dc3545;
    font-weight: 800;
    font-size: 1.25rem;
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
@media (max-width: 767px) {
    .app-title { margin: 0 auto; }
    .desktop-header-items { display: none !important; }
}
.header-icon { color: #dc3545; font-size: 1.2rem; cursor: pointer; }

/* Desktop Search Bar */
.desktop-search {
    background-color: #f1f3f5;
    border-radius: 999px;
    padding: 8px 20px;
    display: flex;
    align-items: center;
    width: 400px;
}
.desktop-search input {
    border: none; background: transparent; width: 100%; outline: none; margin-left: 10px; font-size: 0.95rem;
}

/* Top Tabs */
.top-tabs {
    background-color: #ffffff;
    display: flex;
    overflow-x: auto;
    padding: 10px 0 0;
    gap: 20px;
    border-bottom: 1px solid #e9ecef;
    scrollbar-width: none;
}
.top-tabs::-webkit-scrollbar { display: none; }
.tab-item {
    color: #495057; font-weight: 600; font-size: 0.95rem; padding-bottom: 12px; white-space: nowrap; cursor: pointer;
}
.tab-item.active { color: #212529; border-bottom: 3px solid #dc3545; }

/* Category Grid */
.category-container {
    display: flex; gap: 15px; padding: 20px 0; overflow-x: auto; scrollbar-width: none;
}
.category-container::-webkit-scrollbar { display: none; }
.category-card {
    flex: 0 0 auto; width: 110px; height: 110px; border-radius: 16px; display: flex; flex-direction: column; justify-content: center; align-items: center; font-weight: 600; font-size: 0.85rem; text-decoration: none; box-shadow: 0 4px 6px rgba(0,0,0,0.05); transition: transform 0.2s;
}
.category-card:hover { transform: translateY(-5px); color: inherit; }
.category-card i { font-size: 2rem; margin-bottom: 8px; }
@media (min-width: 768px) {
    .category-card { width: 140px; height: 140px; font-size: 1rem; }
    .category-card i { font-size: 2.5rem; }
}
.cat-orange { background-color: #fd7e14; color: white; }
.cat-yellow { background-color: #ffc107; color: #212529; }
.cat-pink { background-color: #f8d7da; color: #dc3545; }
.cat-blue { background-color: #0dcaf0; color: white; }

/* Carousel Promo Banner */
.promo-banner {
    background: linear-gradient(135deg, var(--cInicio, #0d6efd), var(--cFin, #0dcaf0));
    border-radius: 16px; padding: 30px; color: white; display: flex; align-items: center; justify-content: space-between; min-height: 150px; position: relative; overflow: hidden; box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}
.promo-content { position: relative; z-index: 2; width: 100%; }
.promo-title { font-weight: 800; font-size: 1.8rem; margin: 0; }
.promo-subtitle { font-weight: 500; font-size: 1rem; opacity: 0.9; }
@media (min-width: 768px) {
    .promo-banner { min-height: 250px; padding: 40px; }
    .promo-title { font-size: 3rem; }
    .promo-subtitle { font-size: 1.2rem; }
}

/* Product Grid */
.product-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; padding-bottom: 20px; }
@media (min-width: 576px) { .product-grid { grid-template-columns: 1fr 1fr 1fr; } }
@media (min-width: 992px) { .product-grid { grid-template-columns: 1fr 1fr 1fr 1fr; gap: 20px; } }
.product-card { background: #ffffff; border-radius: 16px; overflow: hidden; box-shadow: 0 2px 10px rgba(0,0,0,0.04); position: relative; transition: box-shadow 0.2s, transform 0.2s; cursor: pointer; border: 1px solid #f1f3f5; }
.product-card:hover { box-shadow: 0 8px 25px rgba(0,0,0,0.1); transform: translateY(-4px); }
.product-img-wrapper { position: relative; padding-top: 100%; background-color: #f8f9fa; }
.product-img { position: absolute; top: 0; left: 0; width: 100%; height: 100%; object-fit: cover; }
.fav-btn { position: absolute; top: 10px; right: 10px; background: rgba(0,0,0,0.4); border: none; border-radius: 50%; width: 32px; height: 32px; display: flex; align-items: center; justify-content: center; color: white; z-index: 10; transition: background 0.2s; }
.fav-btn:hover { background: rgba(0,0,0,0.6); }
.fav-btn.active { color: #dc3545; }
.product-info { padding: 15px; }
.product-name { font-weight: 700; font-size: 1rem; margin: 0 0 6px; color: #212529; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.product-rating { color: #ffc107; font-size: 0.85rem; margin-bottom: 10px; }
.product-rating .bi-star { color: #dee2e6; }
.product-price { font-weight: 800; color: #dc3545; font-size: 1.15rem; margin: 0; }

/* Bottom Nav */
.bottom-nav { position: fixed; bottom: 0; left: 0; right: 0; background: #ffffff; display: flex; justify-content: space-around; padding: 12px 0; border-top: 1px solid #e9ecef; z-index: 1000; box-shadow: 0 -4px 10px rgba(0,0,0,0.03); }
@media (min-width: 768px) { .bottom-nav { display: none; } }
.nav-item { display: flex; flex-direction: column; align-items: center; color: #6c757d; text-decoration: none; font-size: 0.75rem; font-weight: 500; gap: 4px; }
.nav-item i { font-size: 1.4rem; }
.nav-item.active { color: #dc3545; }
