/* CONFIGURACIONES GENERALES */
* { margin: 0; padding: 0; box-sizing: border-box; font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; }
body { background-color: #f0f2f5; color: #333; overflow: hidden; }

/* PANTALLA DE LOGIN (NUEVO) */
.login-overlay { position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; background: linear-gradient(135deg, #1a1a1a 0%, #333 100%); display: flex; justify-content: center; align-items: center; z-index: 9999; }
.login-box { background: white; padding: 40px; border-radius: 10px; box-shadow: 0 10px 25px rgba(0,0,0,0.5); width: 100%; max-width: 350px; text-align: center; }
.login-box h2 { color: #ff4500; font-size: 28px; margin-bottom: 10px; }
.login-box p { color: #666; margin-bottom: 25px; font-size: 14px; }
.login-box input { width: 100%; padding: 12px; margin-bottom: 15px; border: 1px solid #ddd; border-radius: 5px; font-size: 16px; background: #f9f9f9; }
.login-box button { width: 100%; padding: 12px; background: #ff4500; color: white; border: none; border-radius: 5px; font-size: 16px; font-weight: bold; cursor: pointer; transition: 0.3s; }
.login-box button:hover { background: #e03e00; transform: translateY(-2px); }

/* MENÚ SUPERIOR */
header { background-color: #1a1a1a; color: white; padding: 10px 20px; box-shadow: 0 2px 5px rgba(0,0,0,0.2); z-index: 10; }
.navbar { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 10px; }
.logo h2 { color: #ff4500; font-size: 20px; }
.categories { display: flex; overflow-x: auto; white-space: nowrap; }
.categories::-webkit-scrollbar { display: none; }
.categories button { background: none; border: none; color: white; margin: 0 5px; font-size: 15px; cursor: pointer; padding: 5px 10px; border-radius: 5px; }
.categories button:hover, .categories button.active { background-color: #ff4500; color: white; }
.user-info { display: flex; align-items: center; gap: 10px; }

/* BOTONES DE HEADER */
.btn-config { background: #333; color: white; border: none; padding: 8px 12px; border-radius: 5px; cursor: pointer; font-size: 16px; transition: 0.3s; }
.btn-config:hover { background: #ff4500; }
.btn-mobile-cart { display: none; background: #ff4500; color: white; border: none; padding: 8px 12px; border-radius: 5px; cursor: pointer; font-size: 16px; font-weight: bold; }

/* ESTRUCTURA POS */
.pos-layout { display: flex; flex: 1; height: calc(100vh - 60px); overflow: hidden; }

/* IZQUIERDA: PRODUCTOS Y BUSCADOR */
.products-section { flex: 7; padding: 20px; overflow-y: auto; display: flex; flex-direction: column; }
.search-bar { display: flex; align-items: center; background: white; padding: 10px 15px; border-radius: 8px; margin-bottom: 20px; box-shadow: 0 2px 4px rgba(0,0,0,0.05); border: 1px solid #ddd; }
.search-bar i { color: #888; font-size: 18px; margin-right: 10px; }
.search-bar input { border: none; outline: none; width: 100%; font-size: 16px; }

.products-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 15px; }
.product-card { background: white; padding: 15px; border-radius: 8px; box-shadow: 0 2px 4px rgba(0,0,0,0.1); text-align: center; cursor: pointer; border: 2px solid transparent; transition: 0.2s; }
.product-card:active { transform: scale(0.95); }
.product-card i.prod-icon { font-size: 40px; color: #666; margin-bottom: 10px; }
.product-card h3 { font-size: 14px; margin-bottom: 5px; height: 35px; display: flex; align-items: center; justify-content: center; }
.product-card .price-main { font-size: 18px; font-weight: bold; color: #ff4500; }
.product-card .price-sec { font-size: 13px; color: #888; }

/* DERECHA: TICKET */
.cart-section { flex: 3; background: white; border-left: 1px solid #ddd; display: flex; flex-direction: column; padding: 20px; box-shadow: -2px 0 5px rgba(0,0,0,0.05); }
.cart-section h3 { border-bottom: 2px solid #eee; padding-bottom: 10px; margin-bottom: 10px; text-align: center; color: #1a1a1a; }
.cart-items { flex: 1; overflow-y: auto; }
.empty-cart-msg { text-align: center; color: #999; margin-top: 20px; font-style: italic; }
.cart-item { display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid #eee; padding: 10px 0; }
.cart-item-info { flex: 1; }
.cart-item-title { font-size: 13px; font-weight: bold; color: #333; }
.cart-item-price { font-size: 11px; color: #666; }
.cart-item-controls { display: flex; align-items: center; gap: 8px; margin-right: 10px; }
.cart-item-controls button { background: #eee; border: none; width: 25px; height: 25px; border-radius: 5px; cursor: pointer; font-weight: bold; }
.cart-item-controls button:active { background: #ff4500; color: white; }
.cart-item-subtotal { font-weight: bold; width: 70px; text-align: right; color: #333; font-size: 14px; }

/* TOTALES Y BOTONES */
.cart-summary { margin-top: 15px; border-top: 2px solid #eee; padding-top: 15px; }
.summary-line { display: flex; justify-content: space-between; margin-bottom: 10px; font-size: 16px; color: #555; }
.summary-line.total { align-items: flex-end; margin-bottom: 15px; }
.totales-derecha { text-align: right; }
.total-principal { font-size: 24px; font-weight: bold; color: #ff4500; }
.total-secundario { font-size: 14px; color: #666; font-weight: bold; }
.btn-cobrar, .btn-cancelar { width: 100%; padding: 12px; border: none; border-radius: 5px; font-size: 16px; font-weight: bold; cursor: pointer; margin-bottom: 10px; color: white; transition: 0.3s; }
.btn-cobrar { background-color: #28a745; }
.btn-cancelar { background-color: #dc3545; }

/* MODALES */
.modal { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.6); z-index: 999; justify-content: center; align-items: center; }
.modal-content { background: white; padding: 0; border-radius: 8px; width: 90%; max-width: 400px; overflow: hidden; box-shadow: 0 5px 15px rgba(0,0,0,0.3); animation: slideDown 0.3s ease; }
@keyframes slideDown { from { transform: translateY(-50px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.modal-header { background: #1a1a1a; color: white; padding: 15px; display: flex; justify-content: space-between; align-items: center; }
.close-modal { font-size: 24px; cursor: pointer; color: #ff4500; font-weight: bold; }
.modal-body { padding: 20px; }
.form-group { margin-bottom: 15px; }
.form-group label { display: block; font-weight: bold; margin-bottom: 5px; font-size: 14px; }
.form-group input { width: 100%; padding: 10px; border: 1px solid #ccc; border-radius: 5px; font-size: 16px; }
.btn-save { width: 100%; padding: 12px; background: #ff4500; color: white; border: none; border-radius: 5px; font-size: 16px; font-weight: bold; cursor: pointer; }

/* TABLAS (Inventario / Historial) */
.modal-large { max-width: 800px; width: 95%; }
.inv-form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-bottom: 20px; background: #f9f9f9; padding: 15px; border-radius: 8px; border: 1px solid #ddd; }
.inv-form-grid .form-group { margin-bottom: 0; }
.inv-form-grid select { width: 100%; padding: 10px; border: 1px solid #ccc; border-radius: 5px; font-size: 14px; background: white; }
.table-responsive { overflow-x: auto; max-height: 350px; }
.inv-table { width: 100%; border-collapse: collapse; text-align: left; }
.inv-table th, .inv-table td { padding: 12px 10px; border-bottom: 1px solid #eee; font-size: 14px; }
.inv-table th { background-color: #1a1a1a; color: white; position: sticky; top: 0; }
.inv-table tr:hover { background-color: #f5f5f5; }
.badge-stock { background: #28a745; color: white; padding: 3px 8px; border-radius: 10px; font-size: 12px; font-weight: bold; }
.badge-stock.low { background: #dc3545; }
.btn-edit, .btn-delete { border: none; padding: 6px 10px; border-radius: 4px; cursor: pointer; color: white; font-size: 12px; margin-right: 5px; }
.btn-edit { background: #007bff; } .btn-delete { background: #dc3545; }

/* RESPONSIVO */
@media (max-width: 768px) {
    body { overflow-y: auto; height: auto; display: block; }
    .pos-layout { flex-direction: column; height: auto; overflow: visible; }
    .btn-mobile-cart { display: block; }
    .products-section { padding: 10px; }
    .products-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
    .cart-section { border-left: none; border-top: 4px solid #1a1a1a; padding: 15px; height: auto; }
    .cart-items { max-height: 300px; }
}