/* --- Contenedor Layout para el POS --- */
.pos-container {
    width: 100%;
    max-width: 1500px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: 24px;
    padding: 30px 20px;
    min-height: calc(100vh - 80px);
}

.card {
    background: #ffffff;
    padding: 24px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    border: 1px solid #eef2f5;
}

/* --- Sección de búsqueda y productos --- */
.search-section {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.search-card {
    border-top: 5px solid var(--primary-color);
}

.search-card h2, .cart-card h2 {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 14px;
}

.search-box {
    position: relative;
    display: flex;
    align-items: center;
}

#pos-search {
    width: 100%;
    padding: 14px;
    font-size: 1.2rem;
    font-weight: 600;
    border: 2px solid #e1e8ed;
    border-radius: var(--radius-sm);
    background-color: #fafafa;
    transition: var(--transition);
}

#pos-search:focus {
    border-color: var(--primary-color);
    background-color: #ffffff;
    outline: none;
    box-shadow: 0 0 0 3px rgba(255, 223, 14, 0.2);
}

.btn-clear {
    position: absolute;
    right: 14px;
    background: none;
    border: none;
    font-size: 1.1rem;
    color: var(--text-muted);
    cursor: pointer;
}

/* --- Tabla de Productos --- */
.products-grid-wrapper {
    background: #ffffff;
    border-radius: var(--radius-md);
    border: 1px solid #e1e8ed;
    overflow-x: auto;
    max-height: 550px;
}

.pos-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

.pos-table th, .pos-table td {
    padding: 12px 16px;
    border-bottom: 1px solid #eef2f5;
}

.pos-table th {
    background-color: #f8fafc;
    font-size: 0.85rem;
    text-transform: uppercase;
    color: var(--text-muted);
}

.pos-table tr:hover {
    background-color: #fcfdfe;
}

.btn-add-item {
    background-color: var(--primary-color);
    color: var(--text-dark);
    border: none;
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
}

.btn-add-item:hover {
    background-color: #e6c600;
    transform: translateY(-1px);
}

/* --- Carrito --- */
.cart-card {
    border-top: 5px solid var(--accent-color);
    display: flex;
    flex-direction: column;
    height: 100%;
    max-height: 720px;
}

.cart-items-wrapper {
    flex: 1;
    overflow-y: auto;
    margin: 16px 0;
    min-height: 250px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.cart-item {
    display: grid;
    grid-template-columns: 1fr 100px 30px;
    align-items: center;
    background: #fafafa;
    padding: 10px;
    border-radius: var(--radius-sm);
    border: 1px solid #eef2f5;
    cursor: pointer;
}

.item-info p {
    font-weight: 600;
    font-size: 0.9rem;
}

.item-info span {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.item-qty-controls {
    display: flex;
    align-items: center;
    gap: 4px;
}

.item-qty-controls input {
    width: 35px;
    text-align: center;
    border: 1px solid #e1e8ed;
    border-radius: 4px;
    padding: 4px 0;
}

.btn-qty, .btn-remove {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.9rem;
}

.btn-remove {
    color: var(--accent-color);
}

.empty-cart-msg {
    text-align: center;
    color: var(--text-muted);
    font-style: italic;
    margin: auto 0;
}

/* --- Resumen y Botón de Acción --- */
.cart-summary {
    border-top: 2px solid #f1f1f1;
    padding-top: 14px;
    margin-bottom: 14px;
}

.summary-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

.total-row {
    font-size: 1.6rem;
    font-weight: 800;
}

.btn-primary-action {
    width: 100%;
    background-color: #06aa00;
    color: #ffffff;
    border: none;
    padding: 14px;
    font-size: 1.1rem;
    font-weight: 700;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
}

.btn-primary-action:hover:not(:disabled) {
    background-color: #058e00;
}

.btn-primary-action:disabled {
    background-color: #cccccc;
    cursor: not-allowed;
}

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    background: #1e1e1e;
    padding: 25px;
    border-radius: 8px;
    width: 400px;
    color: white;
}

.modal-content h3 {
    margin-bottom: 10px;
}

.modal-content input,
.modal-content select{
    width: 100%;
    margin-bottom: 15px;
    padding: 10px;
    background: #2d2d2d;
    border: 1px solid #444;
    color: white;
    border-radius: 4px;
}

.modal-content input:disabled {
    color: #818181;
}

.modal-actions {
    display: flex;
    justify-content: space-between;
    gap: 10px;
}

.btn-save {
    background: #28a745;
    color: white;
    border: none;
    padding: 10px;
    cursor: pointer;
    flex: 1;
}

.btn-cancel {
    background: #6c757d;
    color: white;
    border: none;
    padding: 10px;
    cursor: pointer;
}

/* Responsive */
@media (max-width: 1100px) {
    .pos-container {
        grid-template-columns: 1fr;
    }
    .cart-card {
        max-height: none;
    }
}