/* pos.css - Estilos específicos del Punto de Venta y Cocina */

.pos-layout {
    display: grid;
    grid-template-columns: 1fr 420px;
    gap: 30px;
    height: calc(100vh - 120px);
    overflow: hidden;
}

@media (max-width: 1200px) { .pos-layout { grid-template-columns: 1fr 340px; } }
@media (max-width: 1024px) { .pos-layout { grid-template-columns: 1fr 300px; } }
@media (max-width: 768px) {
    .pos-layout {
        grid-template-columns: 1fr;
        height: auto;
        overflow: visible;
        padding-bottom: 120px;
    }
}

/* --- SELECTOR DE MESAS --- */
.table-selector {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    padding-bottom: 5px;
    width: 100%;
}

.table-btn {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 2px solid var(--border);
    background: white;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
}

.table-btn.active {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.2);
}

.table-btn.occupied:not(.active) {
    background: #fff7ed;
    border-color: #f97316;
    color: #f97316;
    position: relative;
}

.table-btn.occupied::after {
    content: '';
    position: absolute;
    top: -2px;
    right: -2px;
    width: 12px;
    height: 12px;
    background: #f97316;
    border: 2px solid white;
    border-radius: 50%;
}

/* Indicador verde cuando un pedido está listo */
.table-btn.ready:not(.active) {
    background: #f0fdf4;
    border-color: #22c55e;
    color: #22c55e;
}

.table-btn.ready::after {
    background: #22c55e;
    box-shadow: 0 0 8px rgba(34, 197, 94, 0.6);
    animation: pulse-soft 2s infinite ease-in-out;
}

/* --- GRILLA DE PRODUCTOS --- */
.product-grid-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 10px;
    min-width: 0; /* Fix for grid 1fr overflow */
}

.categories-bar {
    display: flex;
    overflow-x: auto;
    gap: 12px;
    margin-bottom: 25px;
    padding: 5px 2px;
    scrollbar-width: none;
    align-items: center;
    flex-shrink: 0; /* Evita que los productos aplasten las categorías */
    width: 100%;
}

@media (min-width: 768px) {
    .categories-bar {
        flex-wrap: wrap;
        overflow-x: visible;
    }
}

.categories-bar::-webkit-scrollbar {
    display: none;
}

.cat-pill {
    flex: 0 0 auto;
    text-align: center;
    padding: 10px 24px;
    font-size: 0.9rem;
    white-space: nowrap;
    background: white;
    border: 1px solid var(--border);
    border-radius: 30px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.02);
    margin-bottom: 10px; /* Margen para cuando hay varias filas */
}

.cat-pill:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.cat-pill.active {
    background: var(--accent-secondary);
    color: white;
    border-color: var(--accent-secondary);
}

.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 20px;
}

@media (max-width: 480px) {
    .product-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
}

.product-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 20px 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    cursor: pointer;
    box-shadow: var(--shadow);
    min-height: 160px;
    transition: all 0.3s ease;
}

.product-card:hover { transform: translateY(-4px); border: 1px solid var(--accent); }

.product-icon-box {
    width: 56px;
    height: 56px;
    background: var(--bg-app);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
    color: var(--accent);
}

/* --- VARIANTES Y MODIFICADORES --- */
.modal-section-title {
    font-size: 0.9rem;
    font-weight: 800;
    color: var(--text-muted);
    margin: 20px 0 12px;
    text-transform: uppercase;
}

.variants-grid, .modifiers-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 12px;
}

.variant-btn, .modifier-btn {
    padding: 16px;
    background: white;
    border: 2px solid var(--border);
    border-radius: 16px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
}

.variant-btn.active, .modifier-btn.active {
    border-color: var(--accent);
    background: #fffbeb;
}

.m-checkbox {
    width: 22px;
    height: 22px;
    border: 2px solid var(--border);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.m-checkbox.checked { background: var(--accent); border-color: var(--accent); color: white; }

/* --- COCINA Y ESTADOS --- */
.timer-badge {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: #f1f5f9;
    padding: 8px 12px;
    border-radius: 12px;
}

.timer-badge.time-warning { background: var(--warning-bg); color: var(--warning-text); animation: fadeIn 2s infinite alternate; }
.timer-badge.time-critical { background: var(--danger-bg); color: var(--danger-text); animation: scaleIn 1s infinite alternate; }

.order-number { background: var(--primary); color: white; padding: 2px 8px; border-radius: 6px; font-weight: 800; }

.notice-box {
    padding: 15px;
    background: var(--warning-bg);
    border-radius: 12px;
    margin-top: 15px;
    border: 1px solid rgba(245, 158, 11, 0.2);
}

.floating-cart-bar {
    position: fixed;
    bottom: 90px;
    left: 15px;
    right: 15px;
    background: var(--primary);
    color: white;
    padding: 16px 24px;
    border-radius: 20px;
    display: none;
    justify-content: space-between;
    align-items: center;
    z-index: 1000;
    box-shadow: 0 15px 40px rgba(0,0,0,0.3);
    animation: fadeIn 0.4s ease-out;
}
