/* ═══════════════════════════════════════════════════════════════
   DASHBOARD (Tarjetas de estadísticas)
   ═══════════════════════════════════════════════════════════════ */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 20px; margin-bottom: 20px; }

.stat-card {
    background: var(--card-bg);
    padding: 20px;
    border-radius: 12px;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 15px;
}

.stat-icon { width: 50px; height: 50px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 24px; }
.stat-icon.green { background: #e8f5e9; color: var(--primary); }
.stat-icon.orange { background: #fff3e0; color: var(--secondary); }
.stat-icon.blue { background: #e3f2fd; color: #1976d2; }

.stat-info h4 { font-size: 13px; color: var(--text-light); font-weight: 500; margin-bottom: 5px; }
.stat-info .value { font-size: 22px; font-weight: 700; color: var(--text-dark); }

/* ═══════════════════════════════════════════════════════════════
   PUNTO DE VENTA (POS) - LAYOUT ALTA VELOCIDAD
   ═══════════════════════════════════════════════════════════════ */
.pos-layout { 
    display: grid; 
    grid-template-columns: 380px 1fr;
    gap: 20px; 
    height: calc(100vh - 100px); 
}

.pos-sidebar {
    display: flex;
    flex-direction: column;
    gap: 15px;
    height: 100%;
}

.pos-products { 
    display: flex; 
    flex-direction: column; 
    gap: 15px; 
    height: 100%;
}

.categories-scroll {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding-bottom: 5px;
    scrollbar-width: none;
}
.categories-scroll::-webkit-scrollbar { display: none; }
.category-btn {
    padding: 8px 16px;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    white-space: nowrap;
    cursor: pointer;
    font-weight: 600;
    color: var(--text-light);
    transition: 0.2s;
}
.category-btn.active, .category-btn:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.search-box { position: relative; }
.search-box input { width: 100%; padding: 15px 15px 15px 45px; border: 2px solid var(--border-color); border-radius: 10px; font-size: 16px; outline: none; transition: 0.2s; }
.search-box input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(46,125,50,0.1); }
.search-box i { position: absolute; left: 15px; top: 50%; transform: translateY(-50%); color: var(--text-light); font-size: 18px; }

.products-grid { 
    display: grid; 
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); 
    gap: 15px; 
    overflow-y: auto; 
    padding-right: 5px; 
    align-content: start;
}

.product-card {
    background: var(--card-bg); padding: 15px; border-radius: 12px; border: 1px solid var(--border-color);
    text-align: center; cursor: pointer; transition: 0.1s; box-shadow: var(--shadow);
    user-select: none;
}
.product-card:active { transform: scale(0.95); }
.product-card:hover { border-color: var(--primary); }
.product-card.selected { border-color: var(--secondary); background: #fff3e0; }
.product-card h4 { font-size: 15px; margin-bottom: 5px; }
.product-card .price { color: var(--primary); font-weight: 700; font-size: 16px; }
.product-card .unit { font-size: 12px; color: var(--text-light); }

/* NUEVO: Pantalla de inicio de venta y barra de cliente */
.pos-start-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: calc(100vh - 120px);
    text-align: center;
}
.btn-start-sale {
    background: var(--primary);
    color: white;
    border: none;
    padding: 30px 60px;
    font-size: 24px;
    border-radius: 20px;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 10px 20px rgba(46,125,50,0.3);
    transition: 0.3s;
}
.btn-start-sale:hover { transform: scale(1.05); background: var(--primary-light); }

.pos-client-bar {
    background: #fff3e0;
    border: 1px solid var(--secondary);
    padding: 10px 20px;
    border-radius: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    font-weight: bold;
    color: var(--text-dark);
}
.pos-client-bar span { color: var(--secondary); }

/* Teclado Numérico */
.numpad-panel {
    background: var(--card-bg);
    border-radius: 12px;
    box-shadow: var(--shadow);
    padding: 15px;
    border: 2px solid var(--secondary);
    display: none;
}
.numpad-panel.active { display: block; }
.numpad-header { display: flex; justify-content: space-between; margin-bottom: 10px; font-weight: 700; color: var(--secondary); }
.numpad-display {
    width: 100%;
    padding: 15px;
    font-size: 24px;
    text-align: right;
    border: none;
    background: #f5f5f5;
    border-radius: 8px;
    margin-bottom: 10px;
    font-weight: 700;
    color: var(--text-dark);
    outline: none;
}
.numpad-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.numpad-btn {
    padding: 15px;
    font-size: 18px;
    font-weight: 600;
    border: none;
    border-radius: 8px;
    background: #f0f0f0;
    cursor: pointer;
    transition: 0.1s;
}
.numpad-btn:active { background: #ddd; }
.numpad-btn.action { background: var(--primary-light); color: white; }
.numpad-btn.action:active { background: var(--primary); }

.pos-cart { background: var(--card-bg); border-radius: 12px; box-shadow: var(--shadow); display: flex; flex-direction: column; overflow: hidden; flex: 1; }
.cart-header { padding: 15px; background: #f1f8e9; border-bottom: 1px solid var(--border-color); font-weight: 700; color: var(--primary); display: flex; justify-content: space-between; }
.cart-items { flex: 1; overflow-y: auto; padding: 15px; display: flex; flex-direction: column; gap: 10px; }
.cart-item { display: flex; justify-content: space-between; align-items: center; padding-bottom: 10px; border-bottom: 1px dashed var(--border-color); }
.cart-item .item-info { display: flex; flex-direction: column; }
.cart-item .item-name { font-weight: 600; font-size: 14px; }
.cart-item .item-qty { font-size: 12px; color: var(--text-light); }
.cart-item .item-price { font-weight: 700; color: var(--text-dark); }
.btn-remove { background: none; border: none; color: var(--danger); cursor: pointer; padding: 5px; font-size: 16px; }

.cart-footer { padding: 20px; background: #fafafa; border-top: 1px solid var(--border-color); }
.total-row { display: flex; justify-content: space-between; font-size: 28px; font-weight: 800; color: var(--primary); margin-bottom: 15px; }
.btn-checkout { width: 100%; padding: 15px; background: var(--secondary); color: white; border: none; border-radius: 8px; font-size: 18px; font-weight: 700; cursor: pointer; transition: 0.2s; text-transform: uppercase; letter-spacing: 1px;}
.btn-checkout:hover { background: #e65100; }
.btn-checkout:disabled { background: #ccc; cursor: not-allowed; }

.checkout-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 15px; }
.btn-pay-method { padding: 15px; border: 2px solid var(--border-color); border-radius: 8px; background: white; font-weight: 700; cursor: pointer; font-size: 15px; transition: 0.2s; }
.btn-pay-method.active { border-color: var(--primary); background: #e8f5e9; color: var(--primary); }
.cash-quick-btns { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 15px; justify-content: center; }
.btn-cash { padding: 10px 15px; background: #eee; border: none; border-radius: 6px; font-weight: 700; cursor: pointer; }
.btn-cash:hover { background: #ddd; }

/* ═══════════════════════════════════════════════════════════════
   TABLAS Y VISTAS DE GESTIÓN
   ═══════════════════════════════════════════════════════════════ */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 10px;
}

.table-container {
    background: var(--card-bg);
    border-radius: 12px;
    box-shadow: var(--shadow);
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

.data-table th {
    background: #f1f8e9;
    color: var(--primary);
    padding: 15px;
    font-weight: 600;
    white-space: nowrap;
}

.data-table td {
    padding: 15px;
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
}

.data-table tbody tr:hover {
    background: #fafafa;
}

.badge {
    padding: 5px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
}
.badge.danger { background: #ffebee; color: var(--danger); }
.badge.success { background: #e8f5e9; color: var(--primary); }
.badge.warning { background: #fff3e0; color: var(--secondary); }

/* Formularios en modales */
.form-row {
    display: flex;
    gap: 15px;
    margin-bottom: 15px;
}
.form-row .input-group { flex: 1; margin-bottom: 0; }
.modal-box .input-group { margin-bottom: 15px; }
.modal-box .input-group input, 
.modal-box .input-group select { text-align: left; padding: 12px 15px 12px 40px; font-size: 16px; font-weight: normal; width: 100%; border: 1px solid var(--border-color); border-radius: 8px; outline: none; }
.modal-box .input-group input:focus,
.modal-box .input-group select:focus { border-color: var(--primary); }

/* ═══════════════════════════════════════════════════════════════
   TOASTS Y MODALES GENÉRICOS
   ═══════════════════════════════════════════════════════════════ */
.toast-container { position: fixed; bottom: 20px; right: 20px; z-index: 9999; display: flex; flex-direction: column; gap: 10px; }
.toast { background: var(--text-dark); color: white; padding: 12px 20px; border-radius: 8px; box-shadow: 0 4px 12px rgba(0,0,0,0.15); font-size: 14px; display: flex; align-items: center; gap: 10px; animation: slideIn 0.3s ease; }
.toast.success { background: var(--primary); }
.toast.error { background: var(--danger); }
.toast.info { background: #1976d2; }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.5); display: flex; align-items: center; justify-content: center; z-index: 2000; }
.modal-box { background: white; padding: 25px; border-radius: 12px; width: 90%; max-width: 400px; text-align: center; }
.modal-box h3 { margin-bottom: 15px; }
.modal-box input { width: 100%; padding: 12px; font-size: 20px; text-align: center; border: 2px solid var(--border-color); border-radius: 8px; margin-bottom: 15px; outline: none; }
.modal-box input:focus { border-color: var(--primary); }
.modal-actions { display: flex; gap: 10px; justify-content: center; }
.btn-modal { padding: 10px 20px; border: none; border-radius: 8px; font-weight: 600; cursor: pointer; }
.btn-modal.cancel { background: #eee; color: #333; }
.btn-modal.confirm { background: var(--primary); color: white; }

/* ═══════════════════════════════════════════════════════════════
   RESPONSIVE (Ajustes para móviles y tablets)
   ═══════════════════════════════════════════════════════════════ */
@media (max-width: 900px) {
    .pos-layout { grid-template-columns: 1fr; height: auto; }
    .pos-cart { height: 400px; }
    .pos-sidebar { flex-direction: column-reverse; }
    .pos-start-screen { height: auto; padding: 50px 20px; }
    .btn-start-sale { padding: 20px 40px; font-size: 20px; }
}

/* ═══════════════════════════════════════════════════════════════
   IMPRESIÓN DE TICKET (80mm)
   ═══════════════════════════════════════════════════════════════ */
.ticket-print-area { display: none; }

@media print {
    body * { visibility: hidden; }
    .ticket-print-area, .ticket-print-area * { visibility: visible; }
    .ticket-print-area {
        display: block !important;
        position: absolute;
        left: 0; top: 0;
        width: 72mm;
        font-family: 'Courier New', Courier, monospace;
        font-size: 12px;
        color: #000;
    }
    @page { size: 80mm auto; margin: 0; }
}

.ticket-header { text-align: center; margin-bottom: 10px; }
.ticket-header h2 { margin: 0; font-size: 16px; }
.ticket-header p { margin: 2px 0; font-size: 11px; }
.ticket-divider { border-top: 1px dashed #000; margin: 5px 0; }
.ticket-table { width: 100%; border-collapse: collapse; margin: 5px 0; }
.ticket-table th, .ticket-table td { text-align: left; font-size: 11px; padding: 2px 0; }
.ticket-table th:nth-child(2), .ticket-table td:nth-child(2) { text-align: center; }
.ticket-table th:nth-child(3), .ticket-table td:nth-child(3),
.ticket-table th:nth-child(4), .ticket-table td:nth-child(4) { text-align: right; }
.ticket-footer { text-align: center; margin-top: 10px; font-size: 11px; }