/* --- ESTILOS GENERALES --- */
:root { --primary: #FF3D00; --dark: #263238; --light: #f4f6f8; --success: #2ecc71; --warning: #f1c40f; --danger: #e74c3c; }
body { font-family: 'Roboto', sans-serif; margin: 0; background: var(--light); display: flex; height: 100vh; overflow: hidden; color: #333; }

/* MODAL POS ADD & ZOOM */
.zoom-container { width: 100%; height: 250px; overflow: hidden; border-radius: 8px; margin-bottom: 15px; cursor: zoom-in; position: relative; background-color: #f9f9f9; display: flex; justify-content: center; align-items: center; }
.zoom-container img { max-width: 100%; max-height: 100%; object-fit: contain; transition: transform 0.1s ease-out; }
.qty-control { display: flex; justify-content: center; align-items: center; gap: 15px; margin: 15px 0; }
.qty-control button { width: 45px; height: 45px; border-radius: 50%; border: none; background: #eee; font-size: 1.5rem; cursor: pointer; color: #555; transition: 0.2s; }
.qty-control button:hover { background: #ddd; color: var(--primary); }
.qty-control input { width: 80px; height: 45px; text-align: center; font-size: 1.5rem; font-weight: bold; border: 1px solid #ddd; border-radius: 8px; }
.price-text { font-size: 2rem; color: var(--primary); font-weight: 800; margin: 5px 0; }

/* ESTILOS DE TABLAS Y LAYOUT */
#splash-screen { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: #ffffff; z-index: 10000; display: none; flex-direction: column; justify-content: center; align-items: center; }
.spinner { border: 5px solid #f3f3f3; border-top: 5px solid var(--primary); border-radius: 50%; width: 50px; height: 50px; animation: spin 1s linear infinite; margin-bottom: 20px; }
.splash-logo { width: 280px; max-width: 80%; height: auto; margin-bottom: 30px; border-radius: 12px; box-shadow: 0 15px 30px rgba(0,0,0,0.15); }
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

#toast-container { position: fixed; top: 20px; right: 20px; z-index: 5000; display: flex; flex-direction: column; gap: 10px; pointer-events: none; }
.toast { background: #333; color: white; padding: 12px 20px; border-radius: 8px; box-shadow: 0 4px 12px rgba(0,0,0,0.3); font-size: 0.9rem; animation: slideIn 0.3s; display: flex; align-items: center; gap: 10px; min-width: 200px; pointer-events: auto; }
.toast.success { border-left: 5px solid var(--success); } .toast.error { border-left: 5px solid var(--danger); }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes fadeOut { from { opacity: 1; } to { opacity: 0; } }

#login-screen { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: var(--dark); z-index: 9999; display: flex; justify-content: center; align-items: center; flex-direction: column; }
.login-box { background: white; padding: 40px; border-radius: 12px; width: 90%; max-width: 350px; text-align: center; box-shadow: 0 10px 30px rgba(0,0,0,0.3); }
.login-box input { width: 100%; padding: 12px; margin: 10px 0; border: 1px solid #ccc; border-radius: 5px; box-sizing: border-box; }

#app-container { display: none; width: 100%; height: 100%; flex-direction: row; }
.sidebar { width: 250px; background: var(--dark); color: white; display: flex; flex-direction: column; transition: transform 0.3s ease; z-index: 1001; flex-shrink: 0; }
.sidebar-header { padding: 25px; font-size: 1.4rem; font-weight: bold; border-bottom: 1px solid #37474F; text-align: center; letter-spacing: 1px; }
.mobile-header { display: none; background: var(--dark); color: white; padding: 0 15px; align-items: center; justify-content: space-between; position: fixed; top: 0; left: 0; width: 100%; z-index: 900; height: 60px; box-sizing: border-box; }
.main-content { flex: 1; padding: 25px; overflow-y: auto; position: relative; width: 100%; }
.menu-item { padding: 15px 20px; cursor: pointer; transition: 0.2s; display: flex; align-items: center; gap: 15px; color: #B0BEC5; font-size: 0.95rem; }
.menu-item:hover, .menu-item.active { background: var(--primary); color: white; }
.menu-item.hidden { display: none !important; }
.module { display: none; animation: fadeIn 0.4s; padding-bottom: 80px; } .module.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

.btn { background: var(--primary); color: white; border: none; padding: 10px 20px; border-radius: 6px; cursor: pointer; font-weight: bold; display: inline-flex; align-items: center; gap: 5px; justify-content: center; transition: all 0.2s; }
.btn:hover { transform: translateY(-2px); box-shadow: 0 4px 8px rgba(0,0,0,0.2); }
.btn-sm { padding: 6px 12px; font-size: 0.8rem; }
.btn-success { background: var(--success); } .btn-danger { background: var(--danger); }
.btn:disabled { background: #ccc; cursor: not-allowed; transform: none; box-shadow: none; }

.table-responsive { overflow-x: auto; margin-top: 15px; background: white; border-radius: 8px; box-shadow: 0 2px 10px rgba(0,0,0,0.05); -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; }
.table-responsive table { min-width: 700px; }
th, td { padding: 15px; text-align: left; border-bottom: 1px solid #eee; } th { background: #f8f9fa; font-weight: 600; color: #555; white-space: nowrap; }
.action-icon { cursor: pointer; margin: 0 8px; font-size: 1.1rem; padding: 5px; opacity: 0.7; transition: 0.2s; }
.action-icon:hover { opacity: 1; transform: scale(1.2); }

.dashboard-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 20px; }
.card { background: white; padding: 25px; border-radius: 12px; box-shadow: 0 4px 15px rgba(0,0,0,0.05); display: flex; justify-content: space-between; align-items: center; transition: transform 0.3s ease; border-left: 5px solid transparent; }
.card:hover { transform: translateY(-5px); box-shadow: 0 8px 25px rgba(0,0,0,0.1); }
.card h3 { margin: 0; font-size: 2.2rem; color: #2c3e50; } .card p { margin: 5px 0 0; color: #7f8c8d; font-size: 0.9rem; font-weight: 500; text-transform: uppercase; letter-spacing: 0.5px; } .card-icon { font-size: 3rem; opacity: 0.15; }

.pos-container { height: calc(100vh - 220px); overflow-y: auto; }
.pos-products { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 15px; align-content: start; padding-bottom: 20px; }
.prod-card { background: white; padding: 10px; border-radius: 8px; text-align: center; cursor: pointer; box-shadow: 0 2px 8px rgba(0,0,0,0.05); border: 1px solid transparent; transition: all 0.2s; display: flex; flex-direction: column; justify-content: space-between; }
.prod-card:active { transform: scale(0.95); border-color: var(--primary); }
.prod-card:hover { transform: translateY(-3px); box-shadow: 0 5px 15px rgba(0,0,0,0.1); }
.prod-ref { font-size: 0.75rem; color: #888; text-align: left; width: 100%; margin-bottom: 5px; font-weight: 500; }
.pos-search-bar { width: 100%; max-width: 300px; padding: 10px 15px; border: 1px solid #ddd; border-radius: 25px; outline: none; transition: 0.3s; }
.pos-search-bar:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(255, 61, 0, 0.1); }
.cart-badge { background: white; color: var(--primary); border-radius: 50%; padding: 2px 6px; font-size: 0.8rem; font-weight: bold; margin-left: 5px; box-shadow: 0 2px 4px rgba(0,0,0,0.1); }
.qty-input { width: 50px; padding: 5px; text-align: center; border: 1px solid #ddd; border-radius: 4px; font-weight: bold; }
#pos-lock { display: none; background: #e74c3c; color: white; padding: 15px; text-align: center; border-radius: 8px; margin-bottom: 15px; font-weight: bold; box-shadow: 0 4px 10px rgba(231, 76, 60, 0.3); }

.pagination-controls { display: flex; justify-content: center; align-items: center; gap: 5px; padding: 10px 0; margin-top: 10px; flex-wrap: wrap; }
.pg-btn { background: white; border: 1px solid #ddd; padding: 5px 10px; border-radius: 4px; cursor: pointer; color: #555; font-size: 0.9rem; min-width: 30px; }
.pg-btn:hover { background: #eee; }
.pg-btn.active { background: var(--primary); color: white; border-color: var(--primary); }
.pg-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.modal-overlay { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.5); z-index: 2000; justify-content: center; align-items: center; backdrop-filter: blur(2px); }
.modal-box { background: white; padding: 30px; border-radius: 12px; width: 450px; max-width: 90%; max-height: 90vh; overflow-y: auto; box-shadow: 0 15px 35px rgba(0,0,0,0.25); position: relative; }
#modal-cliente { z-index: 3000 !important; }
.form-group { margin-bottom: 15px; } .form-group label { display: block; margin-bottom: 6px; font-weight: 600; color: #444; font-size: 0.9rem; }
.form-group input, select, textarea { width: 100%; padding: 12px; border: 1px solid #ddd; border-radius: 6px; box-sizing: border-box; font-size: 16px; transition: 0.2s; }
.form-group input:focus { border-color: var(--primary); }
.role-checks { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.sidebar-overlay { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.5); z-index: 1000; }
.filter-bar { display: flex; gap: 10px; margin-bottom: 15px; flex-wrap: wrap; align-items: center; background: white; padding: 10px; border-radius: 8px; box-shadow: 0 2px 5px rgba(0,0,0,0.05); }
.filter-input { padding: 8px; border: 1px solid #ddd; border-radius: 5px; flex: 1; min-width: 150px; }

.badge-diff { padding: 4px 8px; border-radius: 4px; font-weight: bold; font-size: 0.85rem; }
.badge-diff.neg { background: #ffebee; color: #c62828; } .badge-diff.pos { background: #e8f5e9; color: #2e7d32; }
.close-modal { position: absolute; top: 10px; right: 15px; font-size: 28px; cursor: pointer; color: #666; transition: 0.2s; }
.close-modal:hover { color: var(--primary); }

/* Totales Carrito */
.cart-summary-line { display:flex; justify-content:space-between; margin-bottom:5px; font-size: 0.95rem; }
.cart-summary-line span:first-child { color: #555; }
.cart-summary-line span:last-child { font-weight: bold; color: #333; }
.cart-summary-total { display:flex; justify-content:space-between; font-size:1.3rem; font-weight:bold; margin-top:10px; border-top: 1px dashed #ccc; padding-top:10px; color:var(--dark); }

@media (max-width: 768px) { 
    #app-container { flex-direction: column; padding-top: 60px; } 
    .mobile-header { display: flex; } 
    .sidebar { position: fixed; top: 0; left: 0; height: 100%; transform: translateX(-100%); width: 260px; box-shadow: 2px 0 10px rgba(0,0,0,0.2); } 
    .sidebar.open { transform: translateX(0); } 
    .sidebar-overlay.active { display: block; } 
    .main-content { padding: 15px; overflow-x: hidden; } 
    .pos-products { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; } 
    .pos-search-bar { max-width: 100%; margin-top: 10px; } 
    .hide-on-mobile { display: none !important; } 
    .pos-header-container { flex-direction: column; align-items: flex-start !important; gap: 10px; } 
    .pos-header-actions { width: 100%; display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px; } 
    .table-responsive { overflow-x: auto; -webkit-overflow-scrolling: touch; max-width: 100%; }
    table { min-width: 600px; } 
    th, td { padding: 10px; font-size: 0.85rem; white-space: nowrap; } 
}