﻿/* ==========================================================
   SABORES PDV DESIGN SYSTEM
   ========================================================== */

:root {
    /* Colores */

    --sp-primary: #2563eb;
    --sp-success: #16a34a;
    --sp-warning: #f59e0b;
    --sp-danger: #dc2626;
    --sp-bg: #eef2f7;
    --sp-surface: #ffffff;
    --sp-text: #1f2937;
    --sp-text-light: #6b7280;
    --sp-border: #dbe3ec;
    /* Sombras */

    --sp-shadow: 0 2px 8px rgba(0,0,0,.08);
    --sp-shadow-hover: 0 10px 30px rgba(0,0,0,.12);
    /* Radios */

    --sp-radius: 16px;
    /* Transiciones */

    --sp-transition: .18s;
}

/* ==========================================================
   FONDO
   ========================================================== */

body {
    background: var(--sp-bg);
}

/* ==========================================================
   TITULOS
   ========================================================== */

.pos-title {
    font-size: 2.2rem;
    font-weight: 700;
    color: var(--sp-text);
    margin-bottom: 8px;
}

.pos-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.pos-subtitle {
    color: var(--sp-text-light);
    font-size: 1rem;
}

.pos-empty,
.pos-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 240px;
    background: white;
    border-radius: var(--sp-radius);
    border: 1px solid var(--sp-border);
    box-shadow: var(--sp-shadow);
    padding: 28px;
    text-align: center;
    margin-top: 12px;
}

.pos-empty h3 {
    margin-bottom: 12px;
    font-size: 1.6rem;
}

.pos-empty p {
    color: #64748b;
    font-size: 1rem;
    max-width: 420px;
}

.pos-loading .spinner-border {
    width: 3rem;
    height: 3rem;
}

/* ==========================================================
   TARJETA
   ========================================================== */

.pos-card {
    background: white;
    border-radius: var(--sp-radius);
    border: 1px solid var(--sp-border);
    box-shadow: var(--sp-shadow);
}

/* ==========================================================
   CLICKABLE
   ========================================================== */

.pos-click {
    cursor: pointer;
    transition: .18s;
}

    .pos-click:hover {
        transform: translateY(-3px);
        box-shadow: var(--sp-shadow-hover);
    }

/* ==========================================================
   SCROLL
   ========================================================== */

::-webkit-scrollbar {
    width: 10px;
}

::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 20px;
}


/*==========================================================
    MESAS
==========================================================*/

.pos-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill,minmax(170px,1fr));
    gap: 18px;
}

.pos-mesa {
    position: relative;
    height: 170px;
    border-radius: 18px;
    background: white;
    border: 1px solid var(--sp-border);
    box-shadow: var(--sp-shadow);
    padding: 18px;
    cursor: pointer;
    transition: .18s;
}

    .pos-mesa:hover {
        transform: translateY(-4px);
        box-shadow: var(--sp-shadow-hover);
    }

.pos-mesa-numero {
    font-size: 32px;
    font-weight: 700;
    color: var(--sp-text);
}

.pos-mesa-tiempo {
    margin-top: 18px;
    font-size: 20px;
    font-weight: 600;
}

.pos-mesa-total {
    position: absolute;
    bottom: 18px;
    left: 18px;
    font-size: 22px;
    font-weight: 700;
}

.pos-badge {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
}

.estado-normal {
    background: #22c55e;
}

.estado-atrasado {
    background: #f59e0b;
}

.estado-urgente {
    background: #ef4444;
}

.estado-cuenta {
    background: #7c3aed;
}


/*==========================================================
    GRID DE MESAS
==========================================================*/

.mesa-grid {
    display: grid;
    gap: 18px;
    grid-template-columns: repeat(auto-fill,minmax(180px,1fr));
    align-items: start;
}
/*==================================================
  TOOLBAR
==================================================*/

.pos-toolbar {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    margin-bottom: 20px;
    gap: 12px;
}

/*==================================================
  BOTONES POS
==================================================*/

.pos-button {
    background: #2563eb;
    color: #fff;
    border: none;
    border-radius: 12px;
    padding: 12px 22px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: .18s;
    box-shadow: 0 4px 10px rgba(37,99,235,.20);
}

    .pos-button:hover {
        background: #1d4ed8;
        transform: translateY(-1px);
    }

    .pos-button:active {
        transform: scale(.98);
    }

.pos-button-secondary {
    background: #f3f4f6;
    color: #111827;
    border: none;
    border-radius: 12px;
    padding: 12px 22px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
}

    .pos-button-secondary:hover {
        background: #e5e7eb;
    }

.pos-button-danger {
    background: #dc2626;
    color: white;
    border: none;
    border-radius: 12px;
    padding: 12px 22px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
}

    .pos-button-danger:hover {
        background: #b91c1c;
    }


.observacion-btn {
    width: 42px;
    height: 42px;
    border: none;
    border-radius: 12px;
    background: #FEF3C7;
    cursor: pointer;
    transition: .18s;
}

    .observacion-btn:hover {
        background: #FDE68A;
    }

/*==================================================
    CONSUMO ROW
==================================================*/

.producto-observacion {
    margin-top: 6px;
    color: #64748B;
    font-size: .90rem;
    font-style: italic;
    white-space: pre-line;
}

.consumo-row {
    display: flex;
    align-items: center;
    gap: 20px;
    background: white;
    border-radius: 8px;
    padding: 16px 18px;
    margin-bottom: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,.05);
}

.row-producto {
    flex: 1;
}

.producto-nombre {
    font-size: 20px;
    font-weight: 600;
    color: #1F2937;
}

.producto-precio {
    margin-top: 3px;
    color: #64748B;
    font-size: 15px;
}

.row-total {
    width: 120px;
    text-align: right;
    color: #16A34A;
    font-size: 26px;
    font-weight: bold;
}

.row-acciones {
    display: flex;
    align-items: center;
    gap: 10px;
}

.cantidad-btn {
    width: 48px;
    height: 48px;
    border: none;
    border-radius: 12px;
    background: #EEF2FF;
    font-size: 24px;
    cursor: pointer;
}

    .cantidad-btn:hover {
        background: #DBEAFE;
    }

.cantidad {
    width: 30px;
    text-align: center;
    font-size: 22px;
    font-weight: bold;
}

.eliminar-btn {
    width: 48px;
    height: 48px;
    border: none;
    border-radius: 12px;
    background: #FEE2E2;
    cursor: pointer;
}

    .eliminar-btn:hover {
        background: #FECACA;
    }

/*==================================================
HEADER CONSUMO
==================================================*/
.header-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

.consumo-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
}

.header-titulo {
    font-size: 34px;
    font-weight: 700;
}

.header-subtitulo {
    color: #64748b;
    margin-top: 4px;
    font-size: 16px;
}

/*==================================================
RESUMEN DEL CONSUMO
==================================================*/

.consumo-resumen {
    background: white;
    border-radius: 8px;
    padding: 22px;
    box-shadow: 0 2px 8px rgba(0,0,0,.08);
    position: sticky;
    top: 18px;
}

.resumen-titulo {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 18px;
}

.resumen-linea {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
    font-size: 18px;
}

.resumen-total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 30px;
    font-weight: bold;
    color: #16A34A;
}

/*==================================================
WORKSPACE
==================================================*/

.workspace-consumo {
    display: grid;
    grid-template-columns: 1fr 340px;
    gap: 28px;
    align-items: start;
}

.workspace-lista {
    min-width: 0;
}

.workspace-lateral {
    min-width: 320px;
}

.consumo-page {
    padding: 18px 20px 30px;
    max-width: 1320px;
    margin: 0 auto;
}

@media (max-width: 980px) {
    .workspace-consumo {
        grid-template-columns: 1fr;
    }

    .workspace-lateral {
        position: static;
        min-width: 0;
        order: -1;
    }
}

@media (max-width: 720px) {
    .consumo-page {
        padding: 14px 14px 24px;
    }

    .workspace-lateral {
        position: static;
    }

    .consumo-row {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        gap: 0.75rem;
        padding: 0.9rem;
    }

    .row-total {
        width: auto;
        font-size: 1.35rem;
    }

    .row-acciones {
        grid-column: 1 / -1;
        justify-content: flex-end;
        flex-wrap: wrap;
    }
}

/*==================================================
DRAWER PRODUCTOS
==================================================*/

.drawer-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.35);
    display: flex;
    justify-content: flex-end;
    z-index: 2000;
    backdrop-filter: blur(2px);
}

.drawer-productos {
    width: 100%;
    max-width: 100%;
    height: 100dvh;
    background: white;
    box-shadow: -6px 0 20px rgba(0,0,0,.15);
    display: flex;
    flex-direction: column;
    animation: drawerOpen .20s ease;
    overflow: hidden;
}

@media (max-width: 860px) {
    .drawer-productos {
        width: 100%;
        max-width: 100%;
    }
}

.drawer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 22px;
    border-bottom: 1px solid #E5E7EB;
}

.drawer-close {
    width: 48px;
    height: 48px;
    border: 1px solid #d1d5db;
    border-radius: 0.4rem;
    background: #f8fafc;
    font-size: 28px;
    cursor: pointer;
}

.drawer-close:active {
    transform: scale(0.94);
}

@media (max-width: 860px) and (orientation: landscape) {
    .drawer-header {
        padding: 0.5rem 1rem;
    }

    .drawer-close {
        width: 44px;
        height: 44px;
    }
}

@keyframes drawerOpen {

    from {
        transform: translateX(100%);
    }

    to {
        transform: translateX(0);
    }
}

body.touch-keyboard-open {
    padding-bottom: min(440px, 56vh);
}

/*==================================================
FOOTER SELECTOR PRODUCTOS
==================================================*/

.selector-footer {
    padding: 18px;
    border-top: 1px solid #E5E7EB;
    background: white;
    position: sticky;
    bottom: 0;
}

/*==================================================
PRODUCTO CARD
==================================================*/

.producto-card {
    width: 100%;
    border: none;
    background: white;
    border-radius: 12px;
    padding: 14px 16px;
    margin-bottom: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: .15s;
    cursor: pointer;
    box-shadow: 0 1px 4px rgba(0,0,0,.05);
}

    .producto-card:hover {
        background: #EFF6FF;
        transform: translateX(4px);
    }

    .producto-card:active {
        transform: scale(.98);
    }

.producto-nombre {
    font-size: 17px;
    font-weight: 600;
}

.producto-precio {
    color: #16A34A;
    font-size: 18px;
    font-weight: bold;
}

/*=========================================================
    DIALOGOS
=========================================================*/

.pos-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.45);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 5000;
}

.pos-modal {
    width: 520px;
    background: white;
    border-radius: 18px;
    padding: 24px;
    box-shadow: 0 20px 60px rgba(0,0,0,.25);
}

.modal-buttons {
    margin-top: 20px;
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

.cancelar-btn {
    background: #ffe5e5;
    color: #c62828;
    border: none;
    border-radius: 10px;
    padding: 10px 16px;
    font-weight: 600;
    cursor: pointer;
    transition: .2s;
}

    .cancelar-btn:hover {
        background: #ffd1d1;
    }