/* ==========================================================================
   POS Multitienda — estilos base
   Usa variable --color-primario (definida inline por tienda) para que cada
   cliente pueda personalizar el acento de color de su panel.
   ========================================================================== */

:root {
    --color-primario: #0d6efd;
    --sidebar-ancho: 250px;
    --transicion: all .2s ease-in-out;
}

body {
    background-color: #f4f6f9;
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
}

.btn-primary,
.bg-primary {
    background-color: var(--color-primario) !important;
    border-color: var(--color-primario) !important;
}

.text-primary { color: var(--color-primario) !important; }

/* ----- Autenticación ------------------------------------------------- */
.auth-body {
    background: linear-gradient(135deg, #0d6efd 0%, #6610f2 100%);
    min-height: 100vh;
}

.auth-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
}

.auth-card {
    width: 100%;
    max-width: 420px;
    border-radius: 1rem;
    animation: aparecer .35s ease-out;
}

@keyframes aparecer {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ----- Layout de la app ------------------------------------------------ */
.app-shell {
    display: flex;
    min-height: 100vh;
}

.app-sidebar {
    width: var(--sidebar-ancho);
    background: #171b26;
    color: #cfd3dc;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; bottom: 0; left: 0;
    z-index: 1030;
    transition: var(--transicion);
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: .6rem;
    padding: 1.1rem 1.2rem;
    font-weight: 600;
    color: #fff;
    border-bottom: 1px solid rgba(255,255,255,.08);
}

.sidebar-brand i { font-size: 1.4rem; color: var(--color-primario); }
.sidebar-logo { width: 28px; height: 28px; object-fit: contain; border-radius: .25rem; }

.sidebar-nav { padding: .75rem .6rem; overflow-y: auto; }

.nav-link-app {
    display: flex;
    align-items: center;
    gap: .7rem;
    padding: .6rem .8rem;
    border-radius: .5rem;
    color: #cfd3dc;
    text-decoration: none;
    font-size: .92rem;
    margin-bottom: .15rem;
    transition: var(--transicion);
}

.nav-link-app i { font-size: 1.05rem; width: 1.2rem; text-align: center; }

.nav-link-app:hover { background: rgba(255,255,255,.06); color: #fff; }

.nav-link-app.activo {
    background: var(--color-primario);
    color: #fff;
}

.nav-link-app.disabled { opacity: .45; pointer-events: none; }

.badge-proximamente {
    margin-left: auto;
    font-size: .6rem;
    background: rgba(255,255,255,.1);
    padding: .1rem .4rem;
    border-radius: .3rem;
}

.app-main {
    margin-left: var(--sidebar-ancho);
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    transition: var(--transicion);
}

.app-topbar {
    background: #fff;
    border-bottom: 1px solid #e7e9ee;
    padding: .85rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    position: sticky;
    top: 0;
    z-index: 1020;
}

.app-topbar-titulo { font-size: 1.15rem; font-weight: 600; margin: 0; flex: 1; }

.btn-icon {
    background: none;
    border: none;
    font-size: 1.3rem;
    color: #495057;
}

.btn-usuario {
    background: none;
    border: none;
    display: flex;
    align-items: center;
    gap: .5rem;
}

.avatar-circulo {
    width: 34px; height: 34px;
    border-radius: 50%;
    background: var(--color-primario);
    color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-weight: 600;
    font-size: .95rem;
}

.app-content {
    padding: 1.5rem;
    animation: aparecer .25s ease-out;
}

/* ----- Tarjetas de estadísticas / módulos ------------------------------ */
.stat-card {
    background: #fff;
    border-radius: .75rem;
    padding: 1.1rem 1.3rem;
    box-shadow: 0 1px 3px rgba(0,0,0,.06);
    display: flex;
    flex-direction: column;
    border-left: 4px solid var(--color-primario);
}

.stat-card-valor { font-size: 1.7rem; font-weight: 700; }
.stat-card-etiqueta { color: #6c757d; font-size: .85rem; }
.stat-card-ok { border-left-color: #198754; }
.stat-card-info { border-left-color: #0dcaf0; }
.stat-card-alerta { border-left-color: #dc3545; }

.modulo-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: .6rem;
    background: #fff;
    border-radius: .75rem;
    padding: 1.6rem 1rem;
    text-decoration: none;
    color: #343a40;
    box-shadow: 0 1px 3px rgba(0,0,0,.06);
    transition: var(--transicion);
    height: 100%;
}

.modulo-card i { font-size: 1.8rem; color: var(--color-primario); }
.modulo-card:hover { transform: translateY(-3px); box-shadow: 0 6px 16px rgba(0,0,0,.09); color: #212529; }

.badge-estado {
    padding: .25rem .6rem;
    border-radius: 1rem;
    font-size: .75rem;
    font-weight: 600;
}
.badge-estado-activa   { background: #d1e7dd; color: #0f5132; }
.badge-estado-prueba   { background: #cff4fc; color: #055160; }
.badge-estado-suspendida,
.badge-estado-inactiva { background: #f8d7da; color: #842029; }

/* ----- Punto de venta (POS) --------------------------------------------- */
.pos-layout {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
}

.pos-productos { flex: 1; min-width: 0; }

.pos-grid-productos {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: .75rem;
}

.pos-producto-card {
    background: #fff;
    border: 1px solid #e7e9ee;
    border-radius: .6rem;
    padding: .6rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .3rem;
    cursor: pointer;
    transition: var(--transicion);
    text-align: center;
}
.pos-producto-card:hover { border-color: var(--color-primario); transform: translateY(-2px); box-shadow: 0 4px 10px rgba(0,0,0,.08); }
.pos-producto-card img { width: 64px; height: 64px; object-fit: cover; border-radius: .4rem; }
.pos-producto-sinimagen {
    width: 64px; height: 64px; border-radius: .4rem; background: #f1f3f6;
    display: flex; align-items: center; justify-content: center; color: #adb5bd; font-size: 1.4rem;
}
.pos-producto-nombre { font-size: .78rem; font-weight: 600; line-height: 1.15; }
.pos-producto-precio { font-size: .82rem; color: var(--color-primario); font-weight: 700; }
.pos-producto-stock { font-size: .68rem; color: #6c757d; }

.pos-carrito {
    width: 360px;
    flex-shrink: 0;
    background: #fff;
    border-radius: .75rem;
    box-shadow: 0 1px 3px rgba(0,0,0,.06);
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 160px);
    position: sticky;
    top: 80px;
}

.pos-carrito-header {
    padding: .8rem 1rem;
    font-weight: 600;
    border-bottom: 1px solid #eef0f3;
}

.pos-carrito-lineas { flex: 1; overflow-y: auto; padding: .5rem 1rem; min-height: 120px; }

.pos-carrito-linea {
    display: flex;
    align-items: center;
    gap: .5rem;
    padding: .5rem 0;
    border-bottom: 1px solid #f2f3f5;
}

.pos-carrito-footer { padding: 1rem; border-top: 1px solid #eef0f3; }

.pos-autocomplete {
    position: absolute;
    z-index: 20;
    background: #fff;
    border: 1px solid #e7e9ee;
    border-radius: .4rem;
    box-shadow: 0 4px 10px rgba(0,0,0,.08);
    width: 100%;
    max-height: 180px;
    overflow-y: auto;
}
.pos-autocomplete-item {
    display: block;
    width: 100%;
    text-align: left;
    padding: .4rem .6rem;
    border: none;
    background: none;
    font-size: .82rem;
}
.pos-autocomplete-item:hover { background: #f4f6f9; }

.pos-modal-fondo {
    position: fixed; inset: 0; background: rgba(0,0,0,.45);
    display: flex; align-items: center; justify-content: center;
    z-index: 1050; padding: 1rem;
}
.pos-modal {
    background: #fff; border-radius: .75rem; padding: 1.5rem;
    width: 100%; max-width: 380px;
    animation: aparecer .2s ease-out;
}

@media (max-width: 991.98px) {
    .pos-layout { flex-direction: column; }
    .pos-carrito { width: 100%; position: static; max-height: none; }
}

/* ----- Responsive: sidebar colapsable en móvil ------------------------- */
@media (max-width: 991.98px) {
    .app-sidebar { transform: translateX(-100%); }
    .app-sidebar.abierto { transform: translateX(0); }
    .app-main { margin-left: 0; }
}
