:root {
    --bg-main: #f4f6f8;
    --bg-panel: #ffffff;
    --text-main: #333333;
    --text-muted: #666666;
    --primary: #007bff;
    --primary-hover: #0056b3;
    --success: #28a745;
    --success-hover: #218838;
    --danger: #dc3545;
    --danger-hover: #c82333;
    --warning: #ffc107;
    --border: #e0e0e0;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.1);

    --nav-width: 250px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

body {
    background-color: var(--bg-main);
    color: var(--text-main);
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* Typography & Utilities */
.hidden {
    display: none !important;
}

.mt-10 {
    margin-top: 10px;
}

.mt-20 {
    margin-top: 20px;
}

button {
    cursor: pointer;
    border: none;
    outline: none;
    font-weight: 600;
    border-radius: 6px;
}

input {
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 1rem;
}

/* Navbar */
.navbar {
    width: var(--nav-width);
    background-color: #2c3e50;
    color: white;
    display: flex;
    flex-direction: column;
    padding: 20px 0;
}

.nav-brand {
    font-size: 1.5rem;
    font-weight: bold;
    text-align: center;
    margin-bottom: 30px;
    padding: 0 20px;
}

.nav-links {
    list-style: none;
    flex-grow: 1;
}

.nav-btn {
    width: 100%;
    padding: 15px 20px;
    background: transparent;
    color: #bdc3c7;
    text-align: left;
    font-size: 1.1rem;
    border-radius: 0;
    transition: all 0.2s;
}

.nav-btn:hover,
.nav-btn.active {
    background-color: #34495e;
    color: white;
    border-left: 4px solid var(--primary);
}

.nav-status {
    padding: 20px;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 10px;
    background: #1a252f;
}

.status-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    display: inline-block;
}

.status-dot.green {
    background-color: var(--success);
}

.status-dot.red {
    background-color: var(--danger);
}

.status-dot.yellow {
    background-color: var(--warning);
}

#btn-force-sync {
    background: transparent;
    font-size: 1.2rem;
    margin-left: auto;
}

/* Main Container */
.main-container {
    flex-grow: 1;
    overflow-y: auto;
    position: relative;
}

.seccion {
    height: 100%;
    padding: 20px;
    display: flex;
    flex-direction: column;
}

/* Venta Layout */
.venta-layout {
    display: flex;
    gap: 20px;
    height: 100%;
}

.venta-catalogo {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: 15px;
    overflow: hidden;
}

.venta-carrito {
    width: 400px;
    min-width: 350px;
    background: var(--bg-panel);
    border-radius: 8px;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Buscador y Categorías */
.search-bar-container input {
    width: 100%;
    padding: 15px;
    font-size: 1.2rem;
    border: 2px solid var(--primary);
}

.categorias-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 10px 5px;
    justify-content: flex-start;
    max-height: 120px;
    overflow-y: auto;
}

.chip {
    padding: 8px 14px;
    background: #e9ecef;
    border-radius: 20px;
    white-space: normal;
    font-size: 0.9rem;
    color: #333;
    flex: 0 0 auto;
}

.chip.active {
    background: var(--primary);
    color: white;
}



/* Grilla Productos */
.productos-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 15px;
    overflow-y: auto;
    align-content: start;
    padding-right: 5px;
}

.producto-card {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 15px 10px;
    text-align: center;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    transition: transform 0.1s;
    user-select: none;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 120px;
}

.producto-card.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.producto-card:active:not(.disabled) {
    transform: scale(0.95);
}

.producto-card .nombre {
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 8px;
    line-height: 1.2;
}

.producto-card .precio {
    font-size: 1.1rem;
    color: var(--success);
    font-weight: bold;
}

.producto-card .stock-badge {
    font-size: 0.75rem;
    margin-top: 5px;
    padding: 2px 5px;
    border-radius: 4px;
    display: inline-block;
}

.stock-ok {
    background: #e6f4ea;
    color: #1e8e3e;
}

.stock-bajo {
    background: #fef7e0;
    color: #b06000;
}

.stock-critico {
    background: #fce8e6;
    color: #d93025;
    font-weight: bold;
}

/* Carrito */
.carrito-title {
    padding: 15px;
    background: #f8f9fa;
    border-bottom: 1px solid var(--border);
    text-align: center;
}

.carrito-items {
    flex-grow: 1;
    overflow-y: auto;
    padding: 10px;
}

.cart-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px;
    border-bottom: 1px solid var(--border);
}

.cart-item-info {
    flex-grow: 1;
}

.cart-item-info .nombre {
    font-weight: bold;
    font-size: 0.95rem;
}

.cart-item-info .precio-unit {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.cart-item-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-qty {
    width: 30px;
    height: 30px;
    background: #e9ecef;
    border-radius: 4px;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-qty:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.btn-remove {
    background: var(--danger);
    color: white;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.carrito-resumen {
    padding: 20px;
    border-top: 2px solid var(--border);
    background: #f8f9fa;
}

.resumen-fila {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
    font-size: 1.1rem;
}

.total-grande {
    font-size: 2rem;
    font-weight: bold;
    color: var(--text-main);
    margin-bottom: 0;
}

.carrito-acciones {
    padding: 15px;
    background: white;
}

.medios-pago-title {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 10px;
    text-align: center;
}

.botones-pago {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 10px;
}

.btn-pago {
    padding: 15px;
    font-size: 1.1rem;
    background: var(--success);
    color: white;
    transition: background 0.2s;
}

.btn-pago:hover {
    background: var(--success-hover);
}

.btn-cancelar {
    width: 100%;
    padding: 15px;
    background: var(--danger);
    color: white;
}

/* Generales para Tablas */
.seccion-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-shrink: 0;
}

.header-actions {
    display: flex;
    gap: 10px;
}

.btn-accion {
    padding: 10px 20px;
    background: var(--primary);
    color: white;
}

.btn-accion:hover {
    background: var(--primary-hover);
}

.table-container {
    background: white;
    border-radius: 8px;
    box-shadow: var(--shadow);
    overflow-x: auto;
    flex-grow: 1;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th,
.data-table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.data-table th {
    background: #f8f9fa;
    font-weight: 600;
    position: sticky;
    top: 0;
    z-index: 10;
}

/* Estado Sync en tablas */
.status-badge {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.85rem;
    font-weight: bold;
    display: inline-block;
}

.status-badge.sync-ok {
    background: #e6f4ea;
    color: #1e8e3e;
}

.status-badge.sync-pending {
    background: #fef7e0;
    color: #b06000;
}

.status-badge.sync-error {
    background: #fce8e6;
    color: #d93025;
}

/* Caja y Formularios */
.caja-layout {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.caja-cards {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.caja-card {
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: var(--shadow);
    flex: 1;
    min-width: 300px;
}

.caja-card h3 {
    color: var(--text-muted);
    font-size: 1rem;
    margin-bottom: 15px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 5px;
}

.caja-monto {
    font-size: 2rem;
    font-weight: bold;
    color: var(--text-main);
}

.caja-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.caja-botones {
    display: flex;
    gap: 10px;
}

.btn-ingreso {
    flex: 1;
    padding: 12px;
    background: var(--success);
    color: white;
}

.btn-egreso {
    flex: 1;
    padding: 12px;
    background: var(--danger);
    color: white;
}

/* Configuración */
.config-container {
    max-width: 600px;
    margin: 0 auto;
    width: 100%;
}

.config-card {
    background: white;
    padding: 30px;
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.form-group {
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group label {
    font-weight: 600;
    color: var(--text-main);
}

.form-group input {
    width: 100%;
}

.form-group small {
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* Toasts */
.toast-container {
    position: fixed;
    bottom: 20px;
    left: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 9999;
}

.toast {
    background: #333;
    color: white;
    padding: 12px 20px;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.3s;
}

.toast.show {
    opacity: 1;
    transform: translateY(0);
}

.toast.success {
    background: var(--success);
}

.toast.error {
    background: var(--danger);
}

.toast.warning {
    background: var(--warning);
    color: #333;
}

/* Responsive básico */
@media (max-width: 900px) {
    .venta-layout {
        flex-direction: column;
    }

    .venta-carrito {
        width: 100%;
        min-width: auto;
        height: 50%;
    }

    .venta-catalogo {
        height: 50%;
    }
}








.seccion-venta {
    display: flex;
    flex-direction: column;
    height: 100%;
}

#productos-grid {
    flex: 1;
    overflow-y: auto;
}






/* =========================
   MOBILE REAL (NO PARCHE)
========================= */

@media (max-width: 768px) {

    /* 🔥 SACAR SIDEBAR */
    .sidebar {
        display: none;
    }

    /* 🔥 CONTENIDO FULL WIDTH */
    .main-content {
        margin-left: 0 !important;
        width: 100% !important;
        padding: 10px;
    }

    /* 🔥 BUSCADOR */
    .search-bar input {
        width: 100%;
        font-size: 16px;
        padding: 10px;
    }

    /* 🔥 CATEGORÍAS */
    .categorias-chips {
        display: flex;
        flex-wrap: wrap;
        gap: 4px;
        margin-bottom: 6px;
        max-height: 80px;
        overflow-y: auto;
    }

    .chip {
        font-size: 12px;
        padding: 6px 10px;
    }

    /* 🔥 PRODUCTOS */
    .productos-grid {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .producto-card {
        padding: 10px;
        border-radius: 12px;
    }

    .producto-card .nombre {
        font-size: 13px;
        line-height: 1.2;
    }

    .producto-card .precio {
        font-size: 14px;
        font-weight: bold;
    }

    .stock-badge {
        font-size: 11px;
        padding: 4px;
    }

    /* 🔥 CAJA ABAJO (CLAVE) */
    .venta-actual {
        position: fixed;
        bottom: 0;
        left: 0;
        width: 100%;
        border-radius: 0;
        z-index: 1000;
    }

    /* 🔥 BOTONES GRANDES */
    .venta-actual button {
        font-size: 14px;
        padding: 12px;
    }

}

@media (max-width: 768px) {
    .main-content {
        width: 100% !important;
        margin: 0 !important;
    }
}


#btn-menu {
    position: fixed;
    top: 10px;
    left: 10px;
    z-index: 2000;
    background: #1f2d3d;
    color: white;
    border: none;
    padding: 10px 12px;
    font-size: 18px;
    border-radius: 6px;
}
