/* index.css — Estilos específicos del POS (index.html) */

.hidden { display: none !important; }

.pos-container { display: flex; height: calc(100vh - 64px); overflow: hidden; background: var(--bg-body); }
.main-area { flex: 1; padding: 20px; overflow-y: auto; display: flex; flex-direction: column; }
.grid-mesas { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 15px; }
.mesa-card { background: var(--bg-card); border: 2px solid var(--border); border-radius: var(--radius); padding: 14px 10px; text-align: center; cursor: pointer; transition: transform 0.2s, box-shadow 0.2s, background 0.2s, border-color 0.2s; box-shadow: var(--shadow); height: 115px; display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 2px; }
.mesa-card:hover { transform: translateY(-3px); }
.mesa-card h3 { margin: 0; font-size: 15px; font-weight: 700; color: var(--text-main); }
.mesa-card small { font-size: 11px; font-weight: 700; margin-top: 3px; letter-spacing: 0.4px; text-transform: uppercase; }

.btn-mesa-menu { margin-top: 10px; background: transparent; border: 1px solid var(--accent); color: var(--accent); border-radius: 4px; padding: 4px 8px; font-size: 10px; cursor: pointer; transition: 0.2s; font-weight: bold; }
.btn-mesa-menu:hover { background: var(--accent); color: #fff; }

/* Mesa Libre */
.status-available { border-color: var(--success) !important; background: rgba(16, 185, 129, 0.07) !important; }
.status-available:hover { background: rgba(16, 185, 129, 0.14) !important; box-shadow: 0 6px 18px rgba(16, 185, 129, 0.22) !important; border-color: var(--success) !important; }
.status-available small { color: var(--success) !important; }
.status-available .mesa-status-icon { color: var(--success); }

/* Mesa Ocupada */
.status-occupied { border-color: var(--danger) !important; background: rgba(239, 68, 68, 0.10) !important; border-top-width: 4px !important; }
.status-occupied:hover { background: rgba(239, 68, 68, 0.18) !important; box-shadow: 0 6px 18px rgba(239, 68, 68, 0.25) !important; border-color: var(--danger) !important; }
.status-occupied small { color: var(--danger) !important; }
.status-occupied .mesa-status-icon { color: var(--danger); }
.status-occupied .mesa-status-icon i { animation: pulse-mesa 1.8s ease-in-out infinite; display: inline-block; }

@keyframes pulse-mesa { 0%, 100% { transform: scale(1); opacity: 1; } 50% { transform: scale(1.2); opacity: 0.7; } }

.category-view { display: flex; flex-direction: column; gap: 15px; }
.grid-categories { display: flex; overflow-x: auto; gap: 10px; padding-bottom: 5px; scroll-behavior: smooth; }
.grid-categories::-webkit-scrollbar { height: 6px; }
.grid-categories::-webkit-scrollbar-track { background: var(--bg-body); }
.grid-categories::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

.category-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: 20px; padding: 10px 20px; text-align: center; cursor: pointer; font-weight: 600; color: var(--text-main); transition: 0.2s; box-shadow: var(--shadow); font-size: 14px; white-space: nowrap; flex-shrink: 0;}
.category-card:hover { border-color: var(--accent); background: rgba(59, 130, 246, 0.05); }
.category-card.active { background: var(--accent); color: #fff; border-color: var(--accent); }

.grid-products { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 15px; margin-top: 10px; }
.product-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; cursor: pointer; transition: 0.2s; box-shadow: var(--shadow); display: flex; flex-direction: column; height: 100%;}
.product-card:hover { transform: translateY(-3px); border-color: var(--accent); }
.product-img { width: 100%; height: 100px; background-color: var(--border); background-size: cover; background-position: center; flex-shrink: 0;}
.product-info { padding: 12px; flex: 1; display: flex; flex-direction: column; justify-content: space-between;}
.product-info h4 { margin: 0; font-size: 14px; color: var(--text-main); line-height: 1.3; font-weight: 600;}
.product-info .price { margin-top: 8px; font-weight:bold; color: var(--success); font-size: 15px; }

.cart-area { width: 380px; background: var(--bg-card); border-left: 1px solid var(--border); display: flex; flex-direction: column; z-index: 10; box-shadow: var(--shadow); }
.cart-header { padding: 15px; border-bottom: 1px solid var(--border); display: flex; flex-direction: column; gap: 10px; }
.cart-title { font-size: 18px; font-weight: 700; color: var(--text-main); display: flex; justify-content: space-between; align-items: center; }

.client-selector { display: flex; gap: 8px; align-items: center; background: var(--bg-body); padding: 8px; border-radius: 8px; border: 1px solid var(--border); }
.client-selector input { margin: 0; flex: 1; padding: 8px; border: none; background: transparent; font-size: 13px; color: var(--text-main); outline: none; }

.cart-items { flex: 1; overflow-y: auto; padding: 10px; display: flex; flex-direction: column; gap: 8px; }
.cart-item { display: flex; justify-content: space-between; align-items: center; background: var(--bg-body); padding: 10px; border-radius: 8px; border: 1px solid var(--border); font-size: 14px; }
.item-controls { display: flex; align-items: center; gap: 8px; margin-left: 15px;}
.qty-btn { width: 26px; height: 26px; border-radius: 50%; border: 1px solid var(--border); background: var(--bg-card); color: var(--text-main); cursor: pointer; display: flex; align-items: center; justify-content: center; font-size: 12px;}
.qty-btn:hover { background: var(--border); }
.cart-empty { flex: 1; display: flex; flex-direction: column; justify-content: center; align-items: center; color: var(--text-muted); opacity: 0.6; text-align: center; padding: 20px;}

.cart-footer { padding: 20px; border-top: 1px solid var(--border); background: var(--bg-card); margin-top: auto; }
.cart-total-row { display: flex; justify-content: space-between; font-size: 20px; font-weight: 800; margin-bottom: 15px; color: var(--text-main); }
.btn-action { flex: 1; padding: 15px; color: white; border: none; border-radius: var(--radius); font-size: 15px; font-weight: bold; cursor: pointer; transition: 0.2s; display: flex; justify-content: center; align-items: center; gap: 8px; }
.btn-action:disabled { opacity: 0.5; cursor: not-allowed; }

.pay-method-card { background: var(--bg-card); border: 2px solid var(--border); border-radius: 8px; padding: 15px; text-align: center; cursor: pointer; transition: 0.2s; display: flex; flex-direction: column; align-items: center; gap: 8px;}
.pay-method-card i { font-size: 20px; color: var(--text-muted); transition: 0.2s;}
.pay-method-card b { transition: 0.2s; color: var(--text-main);}
.pay-method-card.active { border-color: var(--accent); background: rgba(59, 130, 246, 0.1); box-shadow: 0 0 10px rgba(59, 130, 246, 0.3); }
.pay-method-card.active i, .pay-method-card.active b { color: var(--accent); }

.tip-btn { border: 1px solid var(--border); background: var(--bg-card); color: var(--text-main); padding: 12px; font-size: 13px; cursor: pointer; border-radius: 6px; font-weight: 600; transition: 0.2s;}
.tip-btn.active { border-color: var(--accent); background: rgba(59, 130, 246, 0.1); color: var(--accent); font-weight: bold;}

.modal-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.6); z-index: 99999; justify-content: center; align-items: center; padding: 20px; box-sizing: border-box; backdrop-filter: blur(3px); }
.modal-overlay.active { display: flex; }
.modal-content { background: var(--bg-card); border-radius: var(--radius); box-sizing: border-box; box-shadow: 0 15px 30px rgba(0,0,0,0.2); display: flex; flex-direction: column; overflow-x: hidden;}

#toast-container { position: fixed; top: 20px; right: 20px; z-index: 999999; display: flex; flex-direction: column; gap: 10px; pointer-events: none; }
.toast { background: var(--bg-card); color: var(--text-main); padding: 15px 20px; border-radius: 8px; box-shadow: 0 10px 25px rgba(0,0,0,0.15); display: flex; align-items: center; gap: 12px; font-weight: 600; font-size: 14px; min-width: 280px; transform: translateX(120%); transition: transform 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55); border-left: 4px solid var(--accent); pointer-events: auto; }
.toast.show { transform: translateX(0); }
.toast-success { border-left-color: var(--success); } .toast-success i { color: var(--success); font-size: 18px; }
.toast-danger { border-left-color: var(--danger); } .toast-danger i { color: var(--danger); font-size: 18px; }
.toast-warning { border-left-color: var(--warning); } .toast-warning i { color: var(--warning); font-size: 18px; }

@keyframes shimmer { 0% { background-position: -200% 0; } 100% { background-position: 200% 0; } }
.skeleton { background: linear-gradient(90deg, var(--bg-card) 25%, var(--border) 50%, var(--bg-card) 75%); background-size: 200% 100%; animation: shimmer 1.5s infinite; border-radius: var(--radius); }
.skeleton-mesa { height: 110px; width: 100%; }
.skeleton-prod { height: 200px; width: 100%; }

.numpad { display:grid; grid-template-columns:repeat(3, 80px); gap:20px; justify-content:center; margin-top: 20px;}
.num-btn { width: 80px; height: 80px; border-radius: 50%; border: 2px solid var(--border); background: var(--bg-card); font-size: 28px; font-weight: bold; color: var(--text-main); cursor: pointer; transition: 0.1s; display:flex; justify-content:center; align-items:center; }
.num-btn:hover { background: rgba(59, 130, 246, 0.1); border-color: var(--accent); color: var(--accent); }
.num-btn:active { transform: scale(0.90); }
.pin-dot { width: 18px; height: 18px; border-radius: 50%; border: 3px solid var(--border); transition: 0.2s; }
.pin-dot.filled { background: var(--accent); border-color: var(--accent); transform: scale(1.2); }
@keyframes shake { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-10px); } 75% { transform: translateX(10px); } }
.shake { animation: shake 0.4s ease-in-out; }

/* ============================================================
   RESPONSIVE POS — Tablet (≤ 1100px)
   ============================================================ */
@media (max-width: 1100px) {
    .cart-area { width: 310px; }
    .grid-products { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
    .modal-content[style*="width: 1000px"] { height: 90vh !important; flex-direction: column !important; }
}

/* ============================================================
   RESPONSIVE POS — Móvil (≤ 768px)
   ============================================================ */
@media (max-width: 768px) {
    /* POS layout: stack vertical */
    .pos-container {
        flex-direction: column;
        height: auto;
        min-height: calc(100vh - 64px);
        overflow-y: auto;
    }

    /* Panel de productos ocupa el ancho completo */
    .main-area {
        flex: none;
        min-height: 55vh;
        padding: 12px;
    }

    /* Grid de mesas: columnas más pequeñas */
    .grid-mesas {
        grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
        gap: 10px;
    }
    .mesa-card { height: 90px; }

    /* Productos: 2 columnas fijas en móvil */
    .grid-products {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
    .product-img { height: 80px; }

    /* Carrito: ancho completo, altura fija con scroll */
    .cart-area {
        width: 100%;
        border-left: none;
        border-top: 2px solid var(--border);
        max-height: 55vh;
        flex-shrink: 0;
    }

    /* Modal de cobro: vertical en móvil */
    #modal-pay .modal-content {
        flex-direction: column !important;
        height: 95vh !important;
        width: 100% !important;
        max-width: 100% !important;
        border-radius: 20px 20px 0 0 !important;
    }
    #modal-pay .modal-content > div:first-child {
        border-right: none !important;
        border-bottom: 1px solid var(--border);
        flex: 1;
        overflow-y: auto;
    }
    #modal-pay .modal-content > div:last-child {
        min-width: auto !important;
        flex: none;
        padding: 20px !important;
    }

    /* Ocultar labels largos en top-bar */
    .top-bar h3 { font-size: 15px; }
}

/* ============================================================
   RESPONSIVE POS — Pantalla muy pequeña (≤ 480px)
   ============================================================ */
@media (max-width: 480px) {
    .grid-products { grid-template-columns: repeat(2, 1fr); }
    .grid-mesas { grid-template-columns: repeat(3, 1fr); }
    .cart-area { max-height: 45vh; }
    .numpad { grid-template-columns: repeat(3, 70px); gap: 12px; }
    .num-btn { width: 70px; height: 70px; font-size: 24px; }
}

/* REGLA DE IMPRESIÓN BLINDADA PARA TICKETERAS TÉRMICAS 80mm */
#print-zone { display: none; }
@media print {
    @page {
        size: 80mm auto;   /* Ancho exacto impresora térmica 80mm, largo automático */
        margin: 0;
        padding: 0;
    }
    body, html { margin: 0; padding: 0; background: #fff !important; width: 100%; height: auto; }
    body > *:not(#print-zone) { display: none !important; }

    #print-zone {
        display: block !important;
        width: 76mm;          /* 80mm - 2mm márgen interno c/lado */
        margin: 0 auto;
        padding: 2mm 2mm 4mm 2mm;
        font-family: 'Courier New', Courier, monospace;
        color: #000;
        background: #fff;
        font-size: 11px;
        line-height: 1.35;
    }

    /* ── Encabezado ─────────────────────────────── */
    .ticket-header { text-align: center; margin-bottom: 6px; }
    .ticket-header h2 { margin: 0 0 2px 0; font-size: 16px; text-transform: uppercase; font-weight: 900; letter-spacing: 0.5px; }
    .ticket-header p { margin: 1px 0; font-size: 11px; }

    .ticket-box { border: 2px solid #000; padding: 4px 3px; margin: 6px 0; text-align: center; font-weight: bold; }
    .ticket-box p { margin: 2px 0; font-size: 12px; }

    /* ── Separador ──────────────────────────────── */
    .ticket-divider { border: none; border-bottom: 1px dashed #000; margin: 5px 0; }

    /* ── Tabla de ítems ─────────────────────────── */
    .ticket-table { width: 100%; text-align: left; border-collapse: collapse; font-size: 11px; }
    .ticket-table th { border-bottom: 1px solid #000; padding-bottom: 2px; font-weight: bold; font-size: 11px; }
    .ticket-table td { padding: 3px 0; vertical-align: top; word-break: break-word; }
    .ticket-table .col-qty   { width: 12%; text-align: center; font-weight: bold; }
    .ticket-table .col-item  { width: 58%; padding-right: 3px; }
    .ticket-table .col-price { width: 30%; text-align: right; }

    /* ── Total ──────────────────────────────────── */
    .ticket-total { display: flex; justify-content: space-between; font-size: 16px; font-weight: 900; margin-top: 4px; border-top: 2px solid #000; padding-top: 4px; }

    /* ── Modificadores / Notas ──────────────────── */
    .ticket-mods { font-size: 10px; margin-left: 8px; font-style: italic; color: #333; }
    .ticket-note { font-size: 10px; font-weight: bold; margin-left: 8px; color: #000; border-left: 2px solid #000; padding-left: 3px; margin-top: 2px; }

    /* ── Timbre SII ─────────────────────────────── */
    .timbre-placeholder { border: 1px solid #000; padding: 6px 4px; margin: 8px 0; text-align: center; font-size: 10px; font-weight: bold; }

    /* ════════════════════════════════════════════ */
    /*  MODO COMANDA (cocina) — texto grande y bold */
    /* ════════════════════════════════════════════ */
    .comanda-mode #print-zone { font-size: 13px; }
    .comanda-mode .ticket-header h2 { font-size: 22px; letter-spacing: 1px; }
    .comanda-mode .ticket-header p  { font-size: 13px; }
    .comanda-mode .ticket-table     { font-size: 15px; font-weight: bold; }
    .comanda-mode .ticket-table th  { font-size: 13px; }
    .comanda-mode .ticket-table .col-qty  { width: 14%; font-size: 18px; }
    .comanda-mode .ticket-table .col-item { width: 86%; font-size: 15px; }
    .comanda-mode .ticket-mods { font-size: 13px; font-weight: normal; font-style: italic; }
    .comanda-mode .ticket-note { font-size: 14px; border-left: 4px solid #000; padding-left: 5px; margin-top: 3px; }

    /* ════════════════════════════════════════════ */
    /*  MODO BOLETA — texto compacto, legible       */
    /* ════════════════════════════════════════════ */
    .boleta-mode .ticket-header h2 { font-size: 15px; }
    .boleta-mode .ticket-total     { font-size: 15px; }
}
