/* public/css/style.css — L'Art Dance Boutique POS v2.0 */

* { box-sizing: border-box; }

body {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    color: #1a1a1a;
}

/* ─────────────────────────────────────────────────────────
   SCROLLBAR PERSONALIZADO
───────────────────────────────────────────────────────── */
::-webkit-scrollbar              { width: 5px; height: 5px; }
::-webkit-scrollbar-track        { background: transparent; }
::-webkit-scrollbar-thumb        { background: #d1c8e8; border-radius: 99px; }
::-webkit-scrollbar-thumb:hover  { background: #7b5db3; }

/* ─────────────────────────────────────────────────────────
   CORRECCIONES DE CONTRASTE
───────────────────────────────────────────────────────── */
.text-gris-plata   { color: #5c556b !important; }
.border-gris-plata { border-color: #e5e5e5 !important; }

/* ─────────────────────────────────────────────────────────
   TABLAS
───────────────────────────────────────────────────────── */
table { border-collapse: collapse; width: 100%; }

.table-carrito th, .table-inventario th {
    color: #4a4a4a !important;
    font-weight: 600;
    letter-spacing: 0.04em;
}

.table-carrito td, .table-inventario td,
.table-carrito th, .table-inventario th {
    padding-left: 0.5rem;
    padding-right: 0.5rem;
}

/* ─────────────────────────────────────────────────────────
   NAVEGACIÓN LATERAL
───────────────────────────────────────────────────────── */
.nav-btn {
    color: #5c556b;
    transition: all 0.2s ease;
    position: relative;
}
.nav-btn:hover {
    background-color: #f3f0f9;
    color: #7b5db3;
}
.nav-btn.active {
    background-color: rgba(123, 93, 179, 0.12) !important;
    color: #7b5db3 !important;
}
.nav-btn .text-lg { transition: transform 0.2s ease; }
.nav-btn.active .text-lg { transform: scale(1.15); }

/* ─────────────────────────────────────────────────────────
   KPI CARDS
───────────────────────────────────────────────────────── */
.card-kpi {
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}
.card-kpi:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 24px -6px rgba(123, 93, 179, 0.14);
}

/* ─────────────────────────────────────────────────────────
   BADGES DE STOCK
───────────────────────────────────────────────────────── */
.badge-stock-ok  { background: #dcfce7; color: #15803d; }
.badge-stock-bajo { background: #fee2e2; color: #dc2626; }

/* ─────────────────────────────────────────────────────────
   FILTROS DE CATEGORÍA (POS e Inventario)
───────────────────────────────────────────────────────── */
.filtro-cat-pos {
    padding: 0.35rem 0.9rem;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 500;
    border: 1.5px solid #e5e5e5;
    color: #5c556b;
    background: #fff;
    transition: all 0.18s ease;
    cursor: pointer;
}
.filtro-cat-pos:hover {
    border-color: #7b5db3;
    color: #7b5db3;
}
.filtro-cat-pos.active {
    background: #7b5db3;
    border-color: #7b5db3;
    color: #fff;
}

/* ─────────────────────────────────────────────────────────
   INPUTS Y FORMULARIOS GENERALES
───────────────────────────────────────────────────────── */
.label-seccion {
    display: block;
    font-size: 0.68rem;
    font-weight: 600;
    color: #5c556b;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.input-config {
    padding: 0.6rem 0.85rem;
    border: 1.5px solid #e5e5e5;
    border-radius: 0.75rem;
    font-size: 0.875rem;
    color: #1a1a1a;
    background: #fff;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
    font-family: inherit;
}
.input-config:focus {
    border-color: #7b5db3;
    box-shadow: 0 0 0 3px rgba(123, 93, 179, 0.12);
}

/* ─────────────────────────────────────────────────────────
   BOTONES REUTILIZABLES
───────────────────────────────────────────────────────── */
.btn-primario {
    padding: 0.75rem 1.25rem;
    border-radius: 0.85rem;
    background: #7b5db3;
    color: #fff;
    font-weight: 600;
    font-size: 0.875rem;
    border: none;
    cursor: pointer;
    transition: background 0.18s, transform 0.15s;
    font-family: inherit;
}
.btn-primario:hover  { background: rgba(123,93,179,0.88); }
.btn-primario:active { transform: scale(0.97); }

.btn-secundario {
    padding: 0.75rem 1.25rem;
    border-radius: 0.85rem;
    background: #fff;
    color: #5c556b;
    font-weight: 500;
    font-size: 0.875rem;
    border: 1.5px solid #e5e5e5;
    cursor: pointer;
    transition: background 0.18s;
    font-family: inherit;
}
.btn-secundario:hover { background: #f3f0f9; }

/* ─────────────────────────────────────────────────────────
   MODALES
───────────────────────────────────────────────────────── */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.55);
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    backdrop-filter: blur(2px);
}
.modal-overlay.hidden { display: none !important; }

.modal-box {
    background: #fff;
    border-radius: 1.5rem;
    padding: 2rem;
    box-shadow: 0 25px 50px -12px rgba(0,0,0,0.25);
    max-height: 92vh;
    overflow-y: auto;
    animation: modalEntrada 0.2s ease;
}
@keyframes modalEntrada {
    from { opacity: 0; transform: scale(0.96) translateY(8px); }
    to   { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1.25rem;
}
.modal-titulo {
    font-family: 'Playfair Display', serif;
    font-weight: 700;
    font-size: 1.35rem;
    color: #1a1a1a;
}
.modal-close-btn {
    color: #5c556b;
    font-size: 1.75rem;
    font-weight: 300;
    line-height: 1;
    background: none;
    border: none;
    cursor: pointer;
    transition: color 0.15s;
    padding: 0;
}
.modal-close-btn:hover { color: #1a1a1a; }

/* ─────────────────────────────────────────────────────────
   TOASTS
───────────────────────────────────────────────────────── */
#toast-container > div {
    min-width: 220px;
    max-width: 320px;
}

/* Color de toasts con Tailwind custom */
.bg-morado-lart { background-color: #7b5db3 !important; }

/* ─────────────────────────────────────────────────────────
   VISTA ACTIVA (transición)
───────────────────────────────────────────────────────── */
.vista {
    transition: opacity 0.25s ease;
}

/* ─────────────────────────────────────────────────────────
   FILA HOVER DE TABLAS
───────────────────────────────────────────────────────── */
#tabla-inventario tr:hover td,
#tabla-clientes tr:hover td {
    background-color: #f8f5fc;
}

/* ─────────────────────────────────────────────────────────
   ESTILOS DE IMPRESIÓN
───────────────────────────────────────────────────────── */
@media print {
    body > *          { display: none !important; }
    #print-area       { display: block !important; }
    #print-area pre   { font-family: monospace; font-size: 11px; white-space: pre; }
}

/* ─────────────────────────────────────────────────────────
   FORMULARIO FORMULARIO LABELS ORIGINALES (compat.)
───────────────────────────────────────────────────────── */
.input-form {
    background-color: #ffffff !important;
    color: #1a1a1a !important;
    font-weight: 500;
}
.input-form:focus ~ .label-form,
.input-form:not(:placeholder-shown) ~ .label-form {
    top: 0;
    left: 10px;
    font-size: 0.7rem;
    color: #7b5db3 !important;
    background-color: #ffffff;
    padding: 0 6px;
    font-weight: 600;
}
.label-form {
    color: #5c556b;
    pointer-events: none;
}

/* ─────────────────────────────────────────────────────────
   MINIATURAS DE PRODUCTO (sin parpadeo)
───────────────────────────────────────────────────────── */
.img-producto {
    background-color: #f3f0f9;
    object-fit: cover;
    vertical-align: middle;
}

.img-producto-ph {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background-color: #f3f0f9;
    color: #7b5db3;
    font-size: 1rem;
    line-height: 1;
    flex-shrink: 0;
    user-select: none;
}

img.img-producto-ph {
    object-fit: none;
    padding: 0.25rem;
}

/* ─────────────────────────────────────────────────────────
   RESPONSIVE — MÓVIL / TABLET
───────────────────────────────────────────────────────── */
body.pin-locked .app-shell > *:not(#pin-gate) {
    pointer-events: none;
    user-select: none;
}

@media (max-width: 1023px) {
    .app-shell {
        padding-bottom: env(safe-area-inset-bottom, 0);
    }

    .app-shell > .flex-1.flex {
        flex-direction: column;
    }

    #vista-pos {
        flex-direction: column !important;
    }

    .pos-sidebar.collapsed-mobile > *:not(:first-child) {
        display: none !important;
    }

    .pos-sidebar.collapsed-mobile {
        max-height: 3rem !important;
        overflow: hidden;
    }

    #tabla-carrito-wrapper thead { display: none; }

    #lista-carrito tr {
        display: block;
        margin-bottom: 0.75rem;
        padding: 0.75rem;
        background: #fff;
        border-radius: 1rem;
        border: 1px solid #e5e5e5;
        box-shadow: 0 1px 4px rgba(0,0,0,0.04);
    }

    #lista-carrito td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 0.35rem 0 !important;
        border: none;
        white-space: normal;
    }

    #lista-carrito td::before {
        content: attr(data-label);
        font-size: 0.65rem;
        text-transform: uppercase;
        color: #5c556b;
        font-weight: 600;
        margin-right: 0.5rem;
    }

    #lista-carrito td:first-child { display: block; }
    #lista-carrito td:first-child::before { display: none; }

    /* Nav lateral → barra inferior */
    .nav-principal {
        width: 100% !important;
        height: auto;
        min-height: 62px;
        flex-direction: row !important;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        z-index: 45;
        border-right: none !important;
        border-top: 1px solid #e5e5e5;
        padding: 0.35rem 0.25rem calc(0.35rem + env(safe-area-inset-bottom, 0)) !important;
        justify-content: space-around;
        gap: 0 !important;
    }

    .nav-principal .flex-1 { display: none; }

    .nav-principal .nav-btn {
        width: auto;
        min-width: 3.5rem;
        height: 3rem;
        flex: 1;
        max-width: 4.5rem;
    }

    /* Espacio para nav inferior + barra cobro */
    .app-shell > .flex-1 {
        padding-bottom: calc(62px + env(safe-area-inset-bottom, 0));
    }

    #vista-pos.active-mobile-checkout {
        padding-bottom: calc(120px + env(safe-area-inset-bottom, 0));
    }

    /* Vistas con scroll */
    .vista {
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch;
    }

    /* POS: ocultar botón cobrar del sidebar (usa barra fija) */
    #btn-cobrar { display: none; }

    /* Sidebar ticket más compacto */
    .pos-sidebar {
        max-height: 38vh;
    }

    /* Modales full width */
    .modal-box {
        padding: 1.25rem;
        border-radius: 1.25rem;
        max-height: 88vh;
    }

    /* KPIs en 2 columnas */
    .grid-cols-2.xl\\:grid-cols-4 {
        grid-template-columns: repeat(2, 1fr);
    }

    /* Tablas scroll horizontal */
    .table-inventario,
    .table-carrito {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
        -webkit-overflow-scrolling: touch;
    }

    /* Toasts arriba centrados */
    #toast-container {
        left: 1rem;
        right: 1rem;
        top: auto;
        bottom: calc(72px + env(safe-area-inset-bottom, 0));
    }

    #toast-container > div {
        max-width: 100%;
    }

    /* Header compacto */
    header h1 { font-size: 1.25rem !important; }
}

@media (max-width: 640px) {
    header .hidden.md\\:block { display: none !important; }

    .vista-inventario header,
    .vista-reportes header,
    #vista-clientes header {
        flex-direction: column;
        align-items: flex-start !important;
    }

    .modal-box .grid-cols-2 {
        grid-template-columns: 1fr;
    }
}

/* Barra de cobro móvil */
.mobile-checkout-bar {
    display: none;
    position: fixed;
    bottom: calc(62px + env(safe-area-inset-bottom, 0));
    left: 0;
    right: 0;
    z-index: 44;
}

@media (max-width: 1023px) {
    .mobile-checkout-bar:not(.hidden) {
        display: block;
    }
}

@media (min-width: 1024px) {
    .mobile-checkout-bar { display: none !important; }
}

/* Header por encima del overlay de alertas (botón visible al abrir) */
.app-header {
    position: relative;
    z-index: 210;
}

#wrap-alerta-stock {
    position: relative;
    z-index: 2;
}

#btn-alerta-stock {
    position: relative;
    z-index: 2;
}

/* Overlay + panel stock bajo (fixed, raíz del documento) */
.overlay-alerta-stock {
    position: fixed;
    inset: 0;
    z-index: 200;
    background: rgba(26, 26, 26, 0.4);
    backdrop-filter: blur(2px);
}

.overlay-alerta-stock.hidden {
    display: none !important;
}

.popover-alerta-stock {
    position: fixed;
    z-index: 205;
    width: min(17rem, calc(100vw - 1.5rem));
    max-height: min(70vh, 22rem);
    background: #fff;
    border: 1px solid #e5e5e5;
    border-radius: 0.875rem;
    box-shadow: 0 16px 40px rgba(74, 45, 120, 0.22);
    padding: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.popover-alerta-stock.hidden {
    display: none !important;
}

.popover-alerta-stock-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem 0.35rem;
    border-bottom: 1px solid #f0f0f0;
    flex-shrink: 0;
}

.popover-alerta-stock-titulo {
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #5c556b;
    margin: 0;
}

.popover-alerta-stock-cerrar {
    flex-shrink: 0;
    width: 1.75rem;
    height: 1.75rem;
    border: none;
    border-radius: 999px;
    background: #f5f0fc;
    color: #7b5db3;
    font-size: 1.1rem;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.popover-alerta-stock-cerrar:hover {
    background: #ebe3f7;
}

.popover-alerta-stock-lista {
    list-style: none;
    margin: 0;
    padding: 0;
    flex: 1;
    min-height: 0;
    max-height: 14rem;
    overflow-y: auto;
}

.popover-alerta-stock-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    width: 100%;
    padding: 0.5rem 0.75rem;
    text-align: left;
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 0.75rem;
    transition: background 0.15s;
}

.popover-alerta-stock-item:hover {
    background: #f5f0fc;
}

.popover-alerta-stock-nombre {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #1a1a1a;
    font-weight: 500;
}

.popover-alerta-stock-uds {
    flex-shrink: 0;
    font-size: 0.65rem;
    padding: 0.15rem 0.4rem;
}

.popover-alerta-stock-link {
    display: block;
    width: calc(100% - 1rem);
    margin: 0.35rem 0.5rem 0.5rem;
    padding: 0.45rem 0.5rem;
    font-size: 0.7rem;
    font-weight: 600;
    color: #7b5db3;
    text-align: center;
    border: none;
    border-top: 1px solid #eee;
    background: transparent;
    cursor: pointer;
    border-radius: 0.5rem;
    flex-shrink: 0;
}

.popover-alerta-stock-link:hover {
    background: #f5f0fc;
}

/* Escritorio: anclado al botón del header (posición vía JS) */
@media (min-width: 1024px) {
    .popover-alerta-stock:not(.hidden) {
        transform: none;
    }
}

/* Buscador POS: debajo del overlay cuando la alerta está abierta */
.pos-buscador-wrap {
    position: relative;
    z-index: 10;
}

body.alerta-stock-abierta .pos-buscador-wrap,
body.alerta-stock-abierta .mob-pos-search {
    z-index: 1;
}

#sugerencias-pos {
    z-index: 15;
}

/* Touch targets mínimos */
@media (hover: none) and (pointer: coarse) {
    .nav-btn,
    .btn-primario,
    .btn-secundario,
    .filtro-cat-pos,
    button {
        min-height: 44px;
    }
}

